feat: separate irc page
This commit is contained in:
parent
227226b291
commit
7f05221b1b
4 changed files with 54 additions and 4 deletions
16
main.go
16
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))
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
<div class="container">
|
||||
<h1>Welcome home. Again.</h1>
|
||||
<div class="links">
|
||||
<a href="https://src.cultist.club">src</a>
|
||||
<a href="ircs://irc.cultist.club:6697">irc</a>
|
||||
<a href="https://src.cultist.club" target="_blank">src</a>
|
||||
<a href="/irc">irc</a>
|
||||
</div>
|
||||
<div class="uptime">
|
||||
<marquee>{{uptime}}</marquee>
|
||||
|
|
|
|||
23
web/irc.html
Normal file
23
web/irc.html
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>irc - cultist.club</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>cultist.club</h1>
|
||||
<div class="info">
|
||||
<p>server: <span class="hl">cultist.club</span></p>
|
||||
<p>port: <span class="hl">6697</span> (tls)</p>
|
||||
<p>channel: <span class="hl">#main</span></p>
|
||||
</div>
|
||||
<div class="links">
|
||||
<a href="ircs://irc.cultist.club:6697">open in client</a>
|
||||
<a href="/">back</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue