aboutsummaryrefslogtreecommitdiff
path: root/handle_repo_index.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-12 20:47:33 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-12 20:47:33 +0800
commit7c008d4f16acaeb826f82d402772288f729e6e54 (patch)
tree62db0810c5b1ffe96703429bea2481981ec6e60f /handle_repo_index.go
parentrepo_log: Fix anchor (diff)
downloadforge-7c008d4f16acaeb826f82d402772288f729e6e54.tar.gz
forge-7c008d4f16acaeb826f82d402772288f729e6e54.tar.zst
forge-7c008d4f16acaeb826f82d402772288f729e6e54.zip
repo_index: Add clone instructions
Diffstat (limited to 'handle_repo_index.go')
-rw-r--r--handle_repo_index.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/handle_repo_index.go b/handle_repo_index.go
index c0bef4a..1c03ece 100644
--- a/handle_repo_index.go
+++ b/handle_repo_index.go
@@ -2,6 +2,7 @@ package main
import (
"net/http"
+ "net/url"
)
func handle_repo_index(w http.ResponseWriter, r *http.Request, params map[string]string) {
@@ -40,6 +41,8 @@ func handle_repo_index(w http.ResponseWriter, r *http.Request, params map[string
data["readme_filename"], data["readme"] = render_readme_at_tree(tree)
data["files"] = build_display_git_tree(tree)
+ data["clone_url"] = "ssh://" + r.Host + "/" + url.PathEscape(params["group_name"]) + "/:/repos/" + url.PathEscape(params["repo_name"])
+
err = templates.ExecuteTemplate(w, "repo_index", data)
if err != nil {
_, _ = w.Write([]byte("Error rendering template: " + err.Error()))