diff --git a/main.go b/main.go index 79e79e4..955a95a 100644 --- a/main.go +++ b/main.go @@ -32,14 +32,26 @@ func main() { os.Exit(1) } + ircHTML, err := fs.ReadFile(static, "irc.html") + if err != nil { + slog.Error("read irc", "err", err) + os.Exit(1) + } + + pages := map[string][]byte{ + "/": indexHTML, + "/irc": ircHTML, + } + mux := http.NewServeMux() mux.HandleFunc("GET /", func(w http.ResponseWriter, r *http.Request) { - if r.URL.Path != "/" { + page, ok := pages[r.URL.Path] + if !ok { http.NotFound(w, r) return } uptime := uptimeLine() - body := strings.ReplaceAll(string(indexHTML), "{{uptime}}", html.EscapeString(uptime)) + body := strings.ReplaceAll(string(page), "{{uptime}}", html.EscapeString(uptime)) w.Header().Set("Content-Type", "text/html; charset=utf-8") w.Header().Set("Cache-Control", "no-store") _, _ = w.Write([]byte(body)) diff --git a/web/index.html b/web/index.html index 645b14c..34a6d4a 100644 --- a/web/index.html +++ b/web/index.html @@ -10,8 +10,8 @@
server: cultist.club
+port: 6697 (tls)
+channel: #main
+