From b65e5d0de70660bf2572860e5c52f38b4c527ac1 Mon Sep 17 00:00:00 2001
From: Runxi Yu <me@runxiyu.org>
Date: Mon, 10 Feb 2025 21:23:17 +0800
Subject: [PATCH] main: Prefix group names with /g/

---
 main.go              | 6 +++---
 templates/index.html | 2 +-

diff --git a/main.go b/main.go
index 5997e082df7f6168176c461caeab6c9d8f5fb9cd..68194441cb14a7e43745805d4fe450b4d9311a8c 100644
--- a/main.go
+++ b/main.go
@@ -34,9 +34,9 @@
 	serve_source()
 
 	http.HandleFunc("/{$}", handle_index)
-	http.HandleFunc("/{group_name}/repos/{$}", handle_group_repos)
-	http.HandleFunc("/{group_name}/repos/{repo_name}/{$}", handle_repo_index)
-	http.HandleFunc("/{group_name}/repos/{repo_name}/tree/{ref}/{rest...}", handle_repo_tree)
+	http.HandleFunc("/g/{group_name}/repos/{$}", handle_group_repos)
+	http.HandleFunc("/g/{group_name}/repos/{repo_name}/{$}", handle_repo_index)
+	http.HandleFunc("/g/{group_name}/repos/{repo_name}/tree/{ref}/{rest...}", handle_repo_tree)
 
 	listener, err := net.Listen(config.HTTP.Net, config.HTTP.Addr)
 	if err != nil {
diff --git a/templates/index.html b/templates/index.html
index 139abb02d0d3e43df27884b78ce97a14c0180803..79e3cba281ebef4c1d228974356b9442a0c40f83 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -13,7 +13,7 @@ 			</h1>
 			<ul>
 				{{- range .categories }}
 					<li>
-						<a href="{{ . }}/repos/">{{ . }}</a>
+						<a href="g/{{ . }}/repos/">{{ . }}</a>
 					</li>
 				{{- end }}
 			</ul>

-- 
2.48.1