From 0b8142eee1d0f0a85120f3e43a32a3cda850bf19 Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Sat, 14 Jan 2023 21:23:03 -0500 Subject: protocols: Support http/https --- browset.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'browset.py') 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]) -- cgit 1.4.1