summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@macaw.me>2020-06-19 19:26:58 +0800
committerFrederick Yin <fkfd@macaw.me>2020-06-19 19:59:14 +0800
commit1c8d1a0f2e017c8375e080d691dc2f0af10dd9ae (patch)
tree35a2dcdf6c1cf298dca17e5ceebedd525f2bd79d
parentbd8a1b8d460d6857ea8c9ab8544550492ba82cc8 (diff)
Main branch now customizable, annotated configs
-rw-r--r--git-gmi/config.py5
-rw-r--r--git-gmi/gateway.py6
-rw-r--r--git-gmi/git.py4
3 files changed, 8 insertions, 7 deletions
diff --git a/git-gmi/config.py b/git-gmi/config.py
index f136b8e..0cd62de 100644
--- a/git-gmi/config.py
+++ b/git-gmi/config.py
@@ -1,3 +1,8 @@
+# where on the disk are the repos located
GIT_CATALOG = "/home/fakefred/p/gemini/repos/"
+# which path leads to your cgi app after the URL's host part
CGI_PATH = "/git/cgi/"
+# your site's display name
GIT_GMI_SITE_TITLE = "git.gmi demo instance"
+# the "main" branch that git.gmi defaults to
+MAIN_BRANCH = "master"
diff --git a/git-gmi/gateway.py b/git-gmi/gateway.py
index 7de077e..f8c4601 100644
--- a/git-gmi/gateway.py
+++ b/git-gmi/gateway.py
@@ -7,10 +7,6 @@ from os import environ, listdir
# this cgi uses \n as newline.
-def generate_navigation(repo_name: str):
- pass # TODO
-
-
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]
@@ -46,7 +42,7 @@ def handle_cgi_request(path: str, query: str):
elif view == "tree":
if len(path_trace) == 2:
- print("31 master/")
+ print(f"31 {MAIN_BRANCH}/")
return
if len(path_trace) > 2:
diff --git a/git-gmi/git.py b/git-gmi/git.py
index a0eb5e0..2b7fc33 100644
--- a/git-gmi/git.py
+++ b/git-gmi/git.py
@@ -26,14 +26,14 @@ class GitGmiRepo:
f"# {self.name}\n"
f"=> {CGI_PATH} {GIT_GMI_SITE_TITLE}\n"
f"=> {CGI_PATH}{self.name}/summary summary\n"
- f"=> {CGI_PATH}{self.name}/tree/master/ tree\n"
+ f"=> {CGI_PATH}{self.name}/tree/{MAIN_BRANCH}/ tree\n"
f"=> {CGI_PATH}{self.name}/log log\n\n"
)
return header
def view_summary(self) -> str:
response = f"{STATUS_SUCCESS} {META_GEMINI}\n" + self.generate_header()
- tree = self.get_tree("master")
+ tree = self.get_tree(MAIN_BRANCH)
trls = self.list_tree(tree)
found_readme = False
for item in trls: