summaryrefslogtreecommitdiff
path: root/git-gmi/gateway.py
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@macaw.me>2020-06-19 22:46:41 +0800
committerFrederick Yin <fkfd@macaw.me>2020-06-19 22:46:41 +0800
commit036159de2770b5ca9698474dd15fb63e04a51190 (patch)
treead478b88eea833b021c7d65b1c910714837988a5 /git-gmi/gateway.py
parent121921ce0fe2403b2545de5fc678f18eaa824d79 (diff)
Enhance comments
Diffstat (limited to 'git-gmi/gateway.py')
-rw-r--r--git-gmi/gateway.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/git-gmi/gateway.py b/git-gmi/gateway.py
index f8c4601..bb7f2e0 100644
--- a/git-gmi/gateway.py
+++ b/git-gmi/gateway.py
@@ -9,7 +9,8 @@ from os import environ, listdir
def handle_cgi_request(path: str, query: str):
# intended to work with Jetforce.
- # url: gemini://git.gemini.site/cgi-bin/cgi.py/repo/src/static/css/[index.css]
+ # hypothetical example:
+ # url: gemini://git.gemini.site/git/cgi/repo/src/static/css/[index.css]
# path: /repo/src/static/css/[index.css]
# path_trace = ['repo', 'src', 'static', 'css', 'index.css']
path_trace = path[1:].split("/")
@@ -29,6 +30,7 @@ def handle_cgi_request(path: str, query: str):
if len(path_trace) > 1:
view = path_trace[1] # e.g. summary, tree, log
else:
+ # gemini://git.gemini.site/git/cgi/<repo>/
print("31 summary")
return
@@ -42,10 +44,12 @@ def handle_cgi_request(path: str, query: str):
elif view == "tree":
if len(path_trace) == 2:
+ # gemini://git.gemini.site/git/cgi/<repo>/tree/
print(f"31 {MAIN_BRANCH}/")
return
if len(path_trace) > 2:
+ # gemini://git.gemini.site/git/cgi/<repo>/tree/<branch>/
branch = path_trace[2]
location = path_trace[3:]