aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/config/config.go3
-rw-r--r--internal/server/server.go10
-rw-r--r--internal/server/templates/index.html1
3 files changed, 9 insertions, 5 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index b819d8f..626873b 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -40,7 +40,8 @@ type SiteConfig struct {
Description string `yaml:"description"`
Logo string `yaml:"logo"`
Favicon string `yaml:"favicon"`
- ThemeURL string `yaml:"theme_url"` // URL to OpenCode-compatible theme JSON
+ ThemeURL string `yaml:"theme_url"` // URL to OpenCode-compatible theme JSON
+ CustomHead string `yaml:"custom_head"` // Custom HTML to inject into <head> (e.g., analytics)
}
// ServerConfig contains HTTP server settings
diff --git a/internal/server/server.go b/internal/server/server.go
index 3a1d793..4217dd2 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -128,10 +128,11 @@ type PageData struct {
LastUpdatedTooltip string // JSON data for last updated tooltip
TickMode string // ping, minute, hour, day
TickCount int
- Timezone string // Timezone for display
- UseBrowserTimezone bool // Use client-side timezone conversion
- ThemeCSS template.CSS // OpenCode theme CSS (safe CSS)
- Scale float64 // UI scale factor (0.5-2.0)
+ Timezone string // Timezone for display
+ UseBrowserTimezone bool // Use client-side timezone conversion
+ ThemeCSS template.CSS // OpenCode theme CSS (safe CSS)
+ CustomHead template.HTML // Custom HTML for <head> (trusted)
+ Scale float64 // UI scale factor (0.5-2.0)
}
// StatusCounts holds monitor status counts for display
@@ -225,6 +226,7 @@ func (s *Server) handleIndex(w http.ResponseWriter, r *http.Request) {
Timezone: s.config.Display.Timezone,
UseBrowserTimezone: s.config.Display.Timezone == "Browser",
ThemeCSS: themeCSS,
+ CustomHead: template.HTML(s.config.Site.CustomHead),
Scale: s.config.Display.Scale,
}
diff --git a/internal/server/templates/index.html b/internal/server/templates/index.html
index ea4a170..cd37584 100644
--- a/internal/server/templates/index.html
+++ b/internal/server/templates/index.html
@@ -20,6 +20,7 @@
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🎐</text></svg>">
{{end}}
<link rel="stylesheet" href="/static/style.css">
+ {{if .CustomHead}}{{.CustomHead}}{{end}}
</head>
<body class="bg-neutral-50 dark:bg-neutral-950 text-neutral-900 dark:text-neutral-100 min-h-screen font-mono">
<div class="max-w-4xl mx-auto px-4 py-8 sm:py-12">