diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2025-09-07 09:24:30 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2025-09-07 09:24:30 -0700 |
| commit | fd53ea1213d7d5484c1feaf7bddfde11000684a9 (patch) | |
| tree | 74329865c65a481fd500b370942162193c3aed2a /roseh.moe.go | |
| parent | 8cc8b98b938b44af8ff6ec2cc173057d19f92920 (diff) | |
| download | roseh.moe-fd53ea1213d7d5484c1feaf7bddfde11000684a9.tar.zst | |
Remove redirect
Diffstat (limited to 'roseh.moe.go')
| -rw-r--r-- | roseh.moe.go | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/roseh.moe.go b/roseh.moe.go index 8ca8872..5d6d2d5 100644 --- a/roseh.moe.go +++ b/roseh.moe.go @@ -8,23 +8,19 @@ import ( "io" "log" "net/http" - "net/http/httputil" - "net/url" "strings" "time" ) var ( - port = flag.Int("port", 42069, "port to listen on") - https = flag.Bool("https", false, "use https") + port = flag.Int("port", 42069, "port to listen on") serverStartTime = time.Now() ) var ( //go:embed templates/404.html.template - notFoundString string - + notFoundString string notFoundTemplate = template.Must(template.New("notFound").Parse(notFoundString)) ) @@ -40,15 +36,11 @@ func notFound(w http.ResponseWriter, r *http.Request) { var ( //go:embed templates/outline.html.template - outlineString string - + outlineString string outlineTemplate = template.Must(template.New("outline").Parse(outlineString)) -) -var ( //go:embed templates/index.html.template - indexString string - + indexString string indexTemplate = template.Must(template.Must(outlineTemplate.Clone()).New("body").Parse(indexString)) ) @@ -60,8 +52,7 @@ func index(w http.ResponseWriter, _ *http.Request) { var ( //go:embed templates/pong.html.template - pongString string - + pongString string pongTemplate = template.Must(template.New("pong").Parse(pongString)) ) @@ -96,23 +87,12 @@ func main() { flag.Parse() http.HandleFunc("GET /pong", pong) - jellyfinURL, err := url.Parse("http://localhost:8096") - if err != nil { - log.Fatalf("Jellyfin URL: %s", err) - } - http.Handle("/cinema/", httputil.NewSingleHostReverseProxy(jellyfinURL)) http.HandleFunc("GET /static/", static) http.HandleFunc("GET /favicon.ico", favicon) http.HandleFunc("GET /{$}", index) - notFoundMux := http.NewServeMux() - notFoundMux.HandleFunc("GET /", notFound) - http.Handle("/", notFoundMux) + http.HandleFunc("GET /", notFound) addr := fmt.Sprintf(":%d", *port) log.Printf("Listening on %q", addr) - if *https { - log.Fatal(http.ListenAndServeTLS(addr, "/var/lib/acme/roseh.moe/cert.pem", "/var/lib/acme/roseh.moe/key.pem", nil)) - } else { - log.Fatal(http.ListenAndServe(addr, nil)) - } + log.Fatal(http.ListenAndServe(addr, nil)) } |
