Commit Diff


commit - ac15aa2cf1c11cbf8a72bdc00a2adc547c2a4b36
commit + 2d018e2bac6e99a837e24643e15a2ec348c49c68
blob - 26e215cdccfbe4ca41b3d00754dc93fbb4b1ea61
blob + fa8ef1649eef82fed22a63eba3c7514fb00c8c8d
--- lonk.py
+++ lonk.py
@@ -603,7 +603,7 @@ def proxy(mime, url):
             stdout.buffer.write(content)
 
 
-def vgi(cert_hash, raw_url):
+def vgi(cert_hash, lonk_url):
     lonk_url = LonkUrl(raw_url)
     if lonk_url.page == "lonk":
         authenticated(cert_hash, lonk_url, page_lonk)
@@ -654,10 +654,11 @@ def vgi(cert_hash, raw_url):
 def main():
     cert_hash_ = environ.get("VGI_CERT_HASH")
     if cert_hash_:
+        input_url = input().strip()
+        lonk_url = LonkUrl(raw_url)
         try:
             start_time = clock_gettime(CLOCK_MONOTONIC)
             try:
-                input_url = input().strip()
                 vgi(cert_hash_, input_url)
             finally:
                 stderr.write(f"{cert_hash_}|{input_url}|{clock_gettime(CLOCK_MONOTONIC) - start_time:.3f}sec.\n")
@@ -667,10 +668,7 @@ def main():
                 print("20 text/gemini\r")
                 print(f"# 𝓗 onk\r")
                 print("\r")
-                print(f"Remote server return {error.code}:\r")
-                print("```\r")
-                print(f"{error.reason}\r")
-                print("```\r")
+                print(f"Remote server return {error.code}: {error.reason}\r")
                 print("\r")
                 print("The previously issued token has probably expired. You need to authenticate again:\r")
                 print(f'=> {lonk_url.build("ask_server")}\r')