diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2026-08-15 01:19:20 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2026-08-15 01:19:20 -0700 |
| commit | 0a43c79bd8c35753b329b0622b40daceb8253695 (patch) | |
| tree | 30ecd0ffe78cfe290df2cc9ecc73192838d30bff /roseh.moe.go | |
| parent | 35bb45b03b92f2fae9a183fe860fcfc703d59c79 (diff) | |
| download | roseh.moe-0a43c79bd8c35753b329b0622b40daceb8253695.tar.zst | |
Expose nezuko partition on /nezuko endpoint
Diffstat (limited to 'roseh.moe.go')
| -rw-r--r-- | roseh.moe.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/roseh.moe.go b/roseh.moe.go index 9404070..4473ee2 100644 --- a/roseh.moe.go +++ b/roseh.moe.go @@ -47,6 +47,7 @@ var ( https = flag.String("https", "", "directory containing cert.pem and key.pem, or empty string to use unencrypted http") holeTempDir = flag.String("hole-temp-dir", "hole", "directory to store temporary files for the wormhole") codeDir = flag.String("code-dir", "code", "directory to serve git repos") + nezuko = flag.String("nezuko", "nezuko", "nezuko partition") serverStartTime = time.Now() ) @@ -892,6 +893,18 @@ func pkg(w http.ResponseWriter, r *http.Request) { } } +type nezukoHandler struct { + srv http.Handler +} + +func (h *nezukoHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + if !cookieAuth(w, r) { + redirectLogin(w, r, "/nezuko") + return + } + h.srv.ServeHTTP(w, r) +} + type jellyfinReverseProxy struct { proxy httputil.ReverseProxy } @@ -937,6 +950,7 @@ func main() { mux.HandleFunc("GET /pkg/", pkgIndex) mux.HandleFunc("GET /pkg/{pkg}", pkg) mux.Handle("GET /code/", http.StripPrefix("/code/", http.FileServer(http.Dir(*codeDir)))) + mux.Handle("GET /nezuko/", &nezukoHandler{http.StripPrefix("/nezuko/", http.FileServer(http.Dir(*nezuko)))}) mux.HandleFunc("GET /static/", static) mux.HandleFunc("GET /favicon.ico", favicon) apiMux := http.NewServeMux() |
