From 1364d688e454454258c6c97b1dc844cc94a67a9e Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 13 Feb 2025 15:16:11 +0800 Subject: ssh_url_generation.go, etc.: Add config ssh.root and use it Detecting it based on HTTP host name is definitely unreliable. Just add a configuration option and it should work. --- http_handle_repo_index.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'http_handle_repo_index.go') diff --git a/http_handle_repo_index.go b/http_handle_repo_index.go index 8a6f7b8..25bc107 100644 --- a/http_handle_repo_index.go +++ b/http_handle_repo_index.go @@ -2,7 +2,6 @@ package main import ( "net/http" - "net/url" ) func handle_repo_index(w http.ResponseWriter, r *http.Request, params map[string]any) { @@ -40,7 +39,7 @@ func handle_repo_index(w http.ResponseWriter, r *http.Request, params map[string params["readme_filename"], params["readme"] = render_readme_at_tree(tree) params["files"] = build_display_git_tree(tree) - params["clone_url"] = "ssh://" + r.Host + "/" + url.PathEscape(group_name) + "/:/repos/" + url.PathEscape(repo_name) + params["clone_url"] = generate_ssh_remote_url(group_name, repo_name) err = templates.ExecuteTemplate(w, "repo_index", params) if err != nil { -- cgit v1.2.3