aboutsummaryrefslogtreecommitdiff
path: root/repos.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'repos.cgi')
-rwxr-xr-xrepos.cgi22
1 files changed, 22 insertions, 0 deletions
diff --git a/repos.cgi b/repos.cgi
new file mode 100755
index 0000000..5b67464
--- /dev/null
+++ b/repos.cgi
@@ -0,0 +1,22 @@
+#!/usr/bin/python3
+
+import os
+
+print("Content-type:text/plain\r\n\r\n", end="")
+
+# `ls -d /srv/git/*`
+config_filename = os.environ["GITWEB_CONFIG"]
+project_root = None
+remote_prefix = None
+
+with open(config_filename) as f:
+ for line in f.readlines():
+ if line.startswith("$projectroot"):
+ project_root = line.split('"')[1]
+ elif line.startswith("$remote_prefix"):
+ remote_prefix = line.split('"')[1]
+
+if project_root is not None or remote_prefix is not None:
+ for file in os.scandir(project_root):
+ desc=open(f"{file.path}/description").read()
+ print(f"{file.name},{remote_prefix}{file.path},{desc}".strip())