diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2026-07-09 08:27:11 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2026-07-09 08:27:11 -0700 |
| commit | d9135c2be14b63e491aa262921c86be68cf7d0de (patch) | |
| tree | f168781fb5437681c7af10eac428799b0b7d4485 /roseh.moe.go | |
| parent | ef8e36b13c21136a32b6669341007bd88664f75d (diff) | |
| download | roseh.moe-d9135c2be14b63e491aa262921c86be68cf7d0de.tar.zst | |
Add a /code directory
Diffstat (limited to 'roseh.moe.go')
| -rw-r--r-- | roseh.moe.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/roseh.moe.go b/roseh.moe.go index b8758a4..c831b01 100644 --- a/roseh.moe.go +++ b/roseh.moe.go @@ -45,6 +45,7 @@ var ( configFile = flag.String("config", "config.xml", "configuration file (XML, baby!!)") 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") serverStartTime = time.Now() ) @@ -814,6 +815,7 @@ func main() { }() mux := http.NewServeMux() + mux.HandleFunc("GET /{$}", index) mux.HandleFunc("GET /pong", pong) mux.HandleFunc("GET /qr.png", qrHandler) mux.HandleFunc("GET /wormhole", wormhole) @@ -825,9 +827,9 @@ func main() { mux.HandleFunc("POST /notepad", autosave) mux.HandleFunc("GET /cmd/{cmd}", cmd) mux.HandleFunc("GET /pkg/{pkg}", pkg) + mux.Handle("GET /code/", http.StripPrefix("/code/", http.FileServer(http.Dir(*codeDir)))) mux.HandleFunc("GET /static/", static) mux.HandleFunc("GET /favicon.ico", favicon) - mux.HandleFunc("GET /{$}", index) mux.HandleFunc("GET /", notFound) http.Handle("/", http.NewCrossOriginProtection().Handler(mux)) jellyfinURL, err := url.Parse("http://127.0.0.1:8096") |
