summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--roseh.moe.go19
1 files changed, 18 insertions, 1 deletions
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, `<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)