From 0f40d4314dd79e3a985d67d5aa6489a867cc44ae Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Wed, 14 Oct 2026 07:21:50 -0700 Subject: Support go-source meta tag --- roseh.moe.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'roseh.moe.go') diff --git a/roseh.moe.go b/roseh.moe.go index 76e1e18..9a0d548 100644 --- a/roseh.moe.go +++ b/roseh.moe.go @@ -142,12 +142,14 @@ func loadSecrets() error { type packageConfig struct { Name string `xml:",attr"` URL string `xml:",attr"` + Source string `xml:",attr"` Description string `xml:",attr"` } type commandConfig struct { Name string `xml:",attr"` URL string `xml:",attr"` + Source string `xml:",attr"` Description string `xml:",attr"` Multi bool `xml:",attr"` } @@ -886,7 +888,14 @@ func cmd(w http.ResponseWriter, r *http.Request) { return } if r.FormValue("go-get") == "1" { - fmt.Fprintf(w, ``, r.PathValue("cmd"), serviceConfig.CommandRedirects[sourceIdx].URL) + fmt.Fprintf(w, "\n", + r.PathValue("cmd"), + serviceConfig.CommandRedirects[sourceIdx].URL) + if source := serviceConfig.CommandRedirects[sourceIdx].Source; source != "" { + fmt.Fprintf(w, "\n", + r.PathValue("cmd"), + source) + } } else { http.Redirect(w, r, "https://pkg.go.dev/roseh.moe/cmd/"+r.PathValue("cmd"), http.StatusMovedPermanently) } @@ -949,7 +958,12 @@ func pkg(w http.ResponseWriter, r *http.Request) { return } if r.FormValue("go-get") == "1" { - fmt.Fprintf(w, ``, r.PathValue("pkg"), serviceConfig.PackageRedirects[sourceIdx].URL) + fmt.Fprintf(w, "\n", r.PathValue("pkg"), serviceConfig.PackageRedirects[sourceIdx].URL) + if source := serviceConfig.PackageRedirects[sourceIdx].Source; source != "" { + fmt.Fprintf(w, "\n", + r.PathValue("pkg"), + source) + } } else { http.Redirect(w, r, "https://pkg.go.dev/roseh.moe/pkg/"+r.PathValue("pkg"), http.StatusMovedPermanently) } -- cgit v1.3.1