summaryrefslogtreecommitdiffstats
path: root/roseh.moe.go
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2025-10-07 08:47:41 -0700
committerRose Hogenson <rosehogenson@posteo.net>2025-10-07 08:47:41 -0700
commit20761675e284e1c31014f79a5c029dce5dc4a99b (patch)
treea40c8f6e3812832ea33e53f4cedcf8e135470c11 /roseh.moe.go
parent79d1cff0755428edfc192448c04ed5a495264da5 (diff)
downloadroseh.moe-20761675e284e1c31014f79a5c029dce5dc4a99b.tar.zst
Use a vanity URL
Diffstat (limited to 'roseh.moe.go')
-rw-r--r--roseh.moe.go21
1 files changed, 19 insertions, 2 deletions
diff --git a/roseh.moe.go b/roseh.moe.go
index 3a2958c..c1f9c99 100644
--- a/roseh.moe.go
+++ b/roseh.moe.go
@@ -20,8 +20,8 @@ import (
"sync"
"time"
- "gitlab.com/rhogenson/roseh.moe/internal/hole"
- "gitlab.com/rhogenson/roseh.moe/internal/pwhash"
+ "roseh.moe/pkg/roseh.moe/internal/hole"
+ "roseh.moe/pkg/roseh.moe/internal/pwhash"
)
var (
@@ -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 "roseh.moe":
+ source = "git https://gitlab.com/rhogenson/roseh.moe.git"
+ default:
+ notFound(w, r)
+ return
+ }
+ if r.FormValue("go-get") == "1" {
+ fmt.Fprintf(w, `<meta name="go-import" content="roseh.moe/pkg/%s %s">`, 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)