From 79d1cff0755428edfc192448c04ed5a495264da5 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Tue, 7 Oct 2025 08:41:18 -0700 Subject: Vanity url? --- roseh.moe.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/roseh.moe.go b/roseh.moe.go index d3e96bf..3a2958c 100644 --- a/roseh.moe.go +++ b/roseh.moe.go @@ -440,6 +440,24 @@ func autosave(w http.ResponseWriter, r *http.Request) { } } +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" + case "trash": + source = "git https://github.com/rhogenson/trash.git" + default: + notFound(w, r) + return + } + if r.FormValue("go-get") == "1" { + fmt.Fprintf(w, ``, r.PathValue("cmd"), source) + } else { + http.Redirect(w, r, "https://pkg.go.dev/roseh.moe/cmd/"+r.PathValue("cmd"), http.StatusFound) + } +} + func main() { flag.Parse() @@ -455,6 +473,7 @@ func main() { http.HandleFunc("POST /login", login) http.HandleFunc("GET /notepad", notepad) http.HandleFunc("POST /notepad", autosave) + http.HandleFunc("GET /cmd/{cmd}", cmd) http.HandleFunc("GET /static/", static) http.HandleFunc("GET /favicon.ico", favicon) http.HandleFunc("GET /{$}", index) -- cgit v1.3.1