diff options
| -rw-r--r-- | go.mod | 2 | ||||
| -rw-r--r-- | roseh.moe.go | 21 | ||||
| -rw-r--r-- | tools/finditer/finditer.go | 2 | ||||
| -rw-r--r-- | tools/hashpw/hashpw.go | 2 | ||||
| -rw-r--r-- | tools/hole/hole.go | 2 |
5 files changed, 23 insertions, 6 deletions
@@ -1,4 +1,4 @@ -module gitlab.com/rhogenson/roseh.moe +module roseh.moe/pkg/roseh.moe go 1.24.0 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) diff --git a/tools/finditer/finditer.go b/tools/finditer/finditer.go index fbd0363..114785d 100644 --- a/tools/finditer/finditer.go +++ b/tools/finditer/finditer.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "gitlab.com/rhogenson/roseh.moe/internal/pwhash" + "roseh.moe/pkg/roseh.moe/internal/pwhash" ) func mustHex(s string) []byte { diff --git a/tools/hashpw/hashpw.go b/tools/hashpw/hashpw.go index c75fa2e..f6662fa 100644 --- a/tools/hashpw/hashpw.go +++ b/tools/hashpw/hashpw.go @@ -5,8 +5,8 @@ import ( "fmt" "os" - "gitlab.com/rhogenson/roseh.moe/internal/pwhash" "golang.org/x/term" + "roseh.moe/pkg/roseh.moe/internal/pwhash" ) func hashpw() error { diff --git a/tools/hole/hole.go b/tools/hole/hole.go index c6946f0..2834d16 100644 --- a/tools/hole/hole.go +++ b/tools/hole/hole.go @@ -37,7 +37,7 @@ import ( "net/http" "os" - "gitlab.com/rhogenson/roseh.moe/internal/hole" + "roseh.moe/pkg/roseh.moe/internal/hole" ) var url = flag.String("url", "https://roseh.moe", "server URL") |
