From 7c008d4f16acaeb826f82d402772288f729e6e54 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Wed, 12 Feb 2025 20:47:33 +0800 Subject: [PATCH] repo_index: Add clone instructions --- handle_repo_index.go | 3 +++ static/style.css | 2 +- templates/repo_index.html.tmpl | 15 +++++++++++++++ diff --git a/handle_repo_index.go b/handle_repo_index.go index c0bef4a2a55b9b3dbb700e23d29faa731e651c6d..1c03ece62091a8be2704757e0b44a8130f3b3c83 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) { @@ -39,6 +40,8 @@ } 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 { diff --git a/static/style.css b/static/style.css index bd724036d0bba6532526004fb8fcd0e0b0ab4ef2..40f130a67cac48359c16a1d87437087ba6c9cc7a 100644 --- a/static/style.css +++ b/static/style.css @@ -50,7 +50,7 @@ a:link, a:visited { text-decoration-color: var(--text-decoration-color); color: var(--link-color); } -code:not(pre > code) { +#readme code:not(pre > code) { background-color: var(--lighter-box-background-color); border-radius: 2px; padding: 2px; diff --git a/templates/repo_index.html.tmpl b/templates/repo_index.html.tmpl index de2d1da50d722d999deace40fc67a5acf9d1bb8f..6bc3253c81449f2719ba241f3b5f3a6c107624ce 100644 --- a/templates/repo_index.html.tmpl +++ b/templates/repo_index.html.tmpl @@ -9,6 +9,21 @@
{{ template "repo_header" . }}
+
+ + + + + + + + + + + + +
Repo Info
Clonegit clone {{ .clone_url }}
+
-- 2.48.1