commit c0f4c8eae49a48a28b21b866935f921becba9a91
parent 0fdf9ac4739c77f667688d48f7ea49d2cb83c401
Author: Solderpunk <solderpunk@sdf.org>
Date: Tue, 5 Nov 2019 19:58:04 +0200
Open HTTP(S) links in the system browser.
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/av98.py b/av98.py
@@ -28,6 +28,7 @@ import urllib.parse
import ssl
import sys
import time
+import webbrowser
_MAX_REDIRECTS = 5
@@ -230,7 +231,10 @@ class GeminiClient(cmd.Cmd):
its a menu, storing the response in a temporary file, choosing
and calling a handler program, and updating the history."""
# Don't try to speak to servers running other protocols
- if gi.scheme not in ("gemini", "gopher"):
+ if gi.scheme in ("http", "https"):
+ webbrowser.open_new_tab(gi.url)
+ return
+ elif gi.scheme not in ("gemini", "gopher"):
print("Sorry, no support for " + gi.scheme)
return
# Obey permanent redirects