From 7f05221b1bf7ffbc67f538ae5766877b10057b46 Mon Sep 17 00:00:00 2001 From: Lain Iwakura Date: Tue, 19 May 2026 23:22:01 +0300 Subject: [PATCH] feat: separate irc page --- main.go | 16 ++++++++++++++-- web/index.html | 4 ++-- web/irc.html | 23 +++++++++++++++++++++++ web/style.css | 15 +++++++++++++++ 4 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 web/irc.html 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 @@

Welcome home. Again.

{{uptime}} diff --git a/web/irc.html b/web/irc.html new file mode 100644 index 0000000..4356fb8 --- /dev/null +++ b/web/irc.html @@ -0,0 +1,23 @@ + + + + + + irc - cultist.club + + + +
+

cultist.club

+
+

server: cultist.club

+

port: 6697 (tls)

+

channel: #main

+
+ +
+ + diff --git a/web/style.css b/web/style.css index bf338d1..381d680 100644 --- a/web/style.css +++ b/web/style.css @@ -44,6 +44,21 @@ h1 { color: var(--muted); } +.info { + margin-top: 1.5rem; + font-size: 0.85rem; + color: var(--muted); + line-height: 1.8; +} + +.info p { + margin: 0; +} + +.hl { + color: var(--fg); +} + .uptime { margin-top: 2rem; overflow: hidden;