From fcf927a1e3c3b13835c0c021f0aefe3a1eca72c5 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Tue, 01 Apr 2025 22:20:55 +0800 Subject: [PATCH] More segments fixes --- remote_url.go | 4 ++-- resources.go | 6 +++--- ssh_server.go | 2 +- diff --git a/remote_url.go b/remote_url.go index 06ee0da3d370687b0c14a2bdcbb1844061fd7221..5c980f5d5cadec1e1aa8bec2adae24abe7d85146 100644 --- a/remote_url.go +++ b/remote_url.go @@ -13,11 +13,11 @@ // genSSHRemoteURL generates SSH remote URLs from a given group path and repo // name. func genSSHRemoteURL(groupPath []string, repoName string) string { - return strings.TrimSuffix(config.SSH.Root, "/") + "/" + segmentsToURL(groupPath) + "/:/repos/" + url.PathEscape(repoName) + return strings.TrimSuffix(config.SSH.Root, "/") + "/" + segmentsToURL(groupPath) + "/-/repos/" + url.PathEscape(repoName) } // genHTTPRemoteURL generates HTTP remote URLs from a given group path and repo // name. func genHTTPRemoteURL(groupPath []string, repoName string) string { - return strings.TrimSuffix(config.HTTP.Root, "/") + "/" + segmentsToURL(groupPath) + "/:/repos/" + url.PathEscape(repoName) + return strings.TrimSuffix(config.HTTP.Root, "/") + "/" + segmentsToURL(groupPath) + "/-/repos/" + url.PathEscape(repoName) } diff --git a/resources.go b/resources.go index 567976d786a41856ce39873df23e06600ea9787d..9d36ddf930d08a9071c04295002c049829873488 100644 --- a/resources.go +++ b/resources.go @@ -17,7 +17,7 @@ //go:embed LICENSE source.tar.gz var sourceFS embed.FS var sourceHandler = http.StripPrefix( - "/:/source/", + "/-/source/", http.FileServer(http.FS(sourceFS)), ) @@ -80,10 +80,10 @@ staticFS, err := fs.Sub(resourcesFS, "static") if err != nil { panic(err) } - staticHandler = http.StripPrefix("/:/static/", http.FileServer(http.FS(staticFS))) + staticHandler = http.StripPrefix("/-/static/", http.FileServer(http.FS(staticFS))) manFS, err := fs.Sub(resourcesFS, "man") if err != nil { panic(err) } - manHandler = http.StripPrefix("/:/man/", http.FileServer(http.FS(manFS))) + manHandler = http.StripPrefix("/-/man/", http.FileServer(http.FS(manFS))) } diff --git a/ssh_server.go b/ssh_server.go index 67477e7c1fba9ae26f451d06695fe6c9f6c3b20f..a3b69e461bd808486d075a83ee68b2f6834d7627 100644 --- a/ssh_server.go +++ b/ssh_server.go @@ -51,7 +51,7 @@ clientPubkeyStr = strings.TrimSuffix(bytesToString(goSSH.MarshalAuthorizedKey(clientPubkey)), "\n") } clog.Info("Incoming SSH: " + session.RemoteAddr().String() + " " + clientPubkeyStr + " " + session.RawCommand()) - fmt.Fprintln(session.Stderr(), ansiec.Blue+"Lindenii Forge "+VERSION+", source at "+strings.TrimSuffix(config.HTTP.Root, "/")+"/:/source/"+ansiec.Reset+"\r") + fmt.Fprintln(session.Stderr(), ansiec.Blue+"Lindenii Forge "+VERSION+", source at "+strings.TrimSuffix(config.HTTP.Root, "/")+"/-/source/"+ansiec.Reset+"\r") cmd := session.Command() -- 2.48.1