diff options
| -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() |
