From cc280dfd3537379ac9f08e7e0298681b863935a5 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Tue, 7 Oct 2025 09:19:42 -0700 Subject: Fix vanity URL (again) --- roseh.moe.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/roseh.moe.go b/roseh.moe.go index 6d519e9..c9cbbc5 100644 --- a/roseh.moe.go +++ b/roseh.moe.go @@ -444,7 +444,7 @@ func cmd(w http.ResponseWriter, r *http.Request) { var source string switch r.PathValue("cmd") { case "hole": - source = "git https://gitlab.com/rhogenson/roseh.moe.git tools/hole" + source = "git https://gitlab.com/rhogenson/hole.git" case "trash": source = "git https://github.com/rhogenson/trash.git" default: @@ -458,6 +458,22 @@ func cmd(w http.ResponseWriter, r *http.Request) { } } +func pkg(w http.ResponseWriter, r *http.Request) { + var source string + switch r.PathValue("pkg") { + case "wordlist": + source = "git https://gitlab.com/rhogenson/wordlist.git" + default: + notFound(w, r) + return + } + if r.FormValue("go-get") == "1" { + fmt.Fprintf(w, ``, r.PathValue("pkg"), source) + } else { + http.Redirect(w, r, "https://pkg.go.dev/roseh.moe/pkg/"+r.PathValue("pkg"), http.StatusFound) + } +} + func main() { flag.Parse() @@ -474,6 +490,7 @@ func main() { http.HandleFunc("GET /notepad", notepad) http.HandleFunc("POST /notepad", autosave) http.HandleFunc("GET /cmd/{cmd}", cmd) + http.HandleFunc("GET /pkg/{pkg}", pkg) http.HandleFunc("GET /static/", static) http.HandleFunc("GET /favicon.ico", favicon) http.HandleFunc("GET /{$}", index) -- cgit v1.3.1