summaryrefslogtreecommitdiffstats
path: root/roseh.moe.go
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2026-09-03 22:06:52 -0700
committerRose Hogenson <rosehogenson@posteo.net>2026-09-03 22:11:09 -0700
commitf63986b8311a0b5cf888016eac1523b6025ebafb (patch)
treea27ea3fdd5682e22e3b8563f5b2580a2f319180d /roseh.moe.go
parentUse the regular roseh.moe branding for cgit (diff)
downloadroseh.moe-f63986b8311a0b5cf888016eac1523b6025ebafb.tar.zst
No need for a separate muxHEADmain
It's a little weird that *cgi.Handler needs a circular reference. I guess it makes sense though, in case cgit uses a local redirect which I think is just when the script tells us to call it again with a different URL.
Diffstat (limited to 'roseh.moe.go')
-rw-r--r--roseh.moe.go21
1 files changed, 10 insertions, 11 deletions
diff --git a/roseh.moe.go b/roseh.moe.go
index fc61213..23c13b4 100644
--- a/roseh.moe.go
+++ b/roseh.moe.go
@@ -1099,18 +1099,17 @@ func main() {
r.SetXForwarded()
},
}})
- cgitMux := http.NewServeMux()
cgitStaticFiles := http.FileServer(http.Dir(*cgit))
- cgitMux.Handle("/cgit.css", cgitStaticFiles)
- cgitMux.Handle("/cgit.js", cgitStaticFiles)
- cgitMux.HandleFunc("/favicon.ico", favicon)
- cgitMux.Handle("/robots.txt", cgitStaticFiles)
- cgitMux.Handle("/", &cgi.Handler{
- Path: filepath.Join(*cgit, "cgit.cgi"),
- Env: []string{"CGIT_CONFIG=" + *cgitConfig},
- PathLocationHandler: cgitMux,
- })
- http.Handle("code."+*domain+"/", cgitMux)
+ http.Handle("code."+*domain+"/cgit.css", cgitStaticFiles)
+ http.Handle("code."+*domain+"/cgit.js", cgitStaticFiles)
+ http.Handle("code."+*domain+"/robots.txt", cgitStaticFiles)
+ http.HandleFunc("code."+*domain+"/favicon.ico", favicon)
+ cgitCGI := &cgi.Handler{
+ Path: filepath.Join(*cgit, "cgit.cgi"),
+ Env: []string{"CGIT_CONFIG=" + *cgitConfig},
+ }
+ cgitCGI.PathLocationHandler = cgitCGI
+ http.Handle("code."+*domain+"/", cgitCGI)
addr := fmt.Sprintf(":%d", *port)
log.Printf("Listening on %q", addr)