diff options
| author | Zach DeCook <zachdecook@librem.one> | 2023-01-14 21:23:03 -0500 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2023-01-14 21:23:03 -0500 |
| commit | 0b8142eee1d0f0a85120f3e43a32a3cda850bf19 (patch) | |
| tree | 1562f6966a94ae9e942e1072e2fed3e7e7fbdf51 /browset.py | |
| parent | 03c758af3eaebd6b7c18e1e595d49b0552eb5278 (diff) | |
| download | browset-0b8142eee1d0f0a85120f3e43a32a3cda850bf19.tar.gz | |
protocols: Support http/https
Diffstat (limited to 'browset.py')
| -rwxr-xr-x | browset.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/browset.py b/browset.py index 292b95d..ebcc330 100755 --- a/browset.py +++ b/browset.py @@ -9,9 +9,17 @@ from mime.plaintext import Plaintext from mime.highlightedcode import HighlightedCode,mimetolexer from protocol.gemini import GeminiProtocol from protocol.data import DataProtocol +from protocol.http import HttpProtocol + +protocols = { + "gemini": GeminiProtocol, + "data": DataProtocol, + "http": HttpProtocol, + "https": HttpProtocol, +} class Browset(App): - url = "" + url = "about:blank" CSS_PATH = "browset.css" BINDINGS = [ Binding("ctrl+q,ctrl+c", "app.quit", "Quit", show=True), @@ -71,10 +79,8 @@ class Browset(App): self.history.append(self.url) self.url = url protocol = url.split(":")[0] - if protocol == "gemini": - (mime, fp) = GeminiProtocol.get(url) - elif protocol == "data": - (mime, fp) = DataProtocol.get(url) + if protocol in protocols: + (mime, fp) = protocols[protocol].get(url) else: (mime, fp) = ("error", ["Unsupported protocol: " + protocol]) |
