From c0f4c8eae49a48a28b21b866935f921becba9a91 Mon Sep 17 00:00:00 2001 From: Solderpunk Date: Tue, 5 Nov 2019 19:58:04 +0200 Subject: [PATCH] Open HTTP(S) links in the system browser. --- av98.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/av98.py b/av98.py index 51c84c7..7a54aee 100755 --- 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