aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-01-20 05:06:51 -0800
committerFuwn <[email protected]>2026-01-20 05:06:51 -0800
commit77cb8b493e25b29c8d79f123c197c34714645a1f (patch)
tree3e72caf99f44268e0e523872bf82fe48faaa9193 /internal
parentrefactor: Use CSS prefers-color-scheme instead of JS-based theme toggle (diff)
downloadkaze-77cb8b493e25b29c8d79f123c197c34714645a1f.tar.xz
kaze-77cb8b493e25b29c8d79f123c197c34714645a1f.zip
feat: Add clickable link option for monitor names
Diffstat (limited to 'internal')
-rw-r--r--internal/config/config.go1
-rw-r--r--internal/server/server.go2
-rw-r--r--internal/server/templates/index.html2
3 files changed, 4 insertions, 1 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index dfd403a..7bad5f9 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -77,6 +77,7 @@ type MonitorConfig struct {
Name string `yaml:"name"`
Type string `yaml:"type"` // http, https, tcp, gemini
Target string `yaml:"target"`
+ Link string `yaml:"link,omitempty"` // Custom URL for clicking the monitor name (e.g., docs page)
Interval Duration `yaml:"interval"`
Timeout Duration `yaml:"timeout"`
Retries int `yaml:"retries,omitempty"` // Number of retry attempts before marking as down
diff --git a/internal/server/server.go b/internal/server/server.go
index 6b5ded3..af3660e 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -144,6 +144,7 @@ type GroupData struct {
type MonitorData struct {
Name string
Type string
+ Link string // Custom URL for clicking the monitor name
Status string
StatusClass string
ResponseTime int64
@@ -233,6 +234,7 @@ func (s *Server) handleIndex(w http.ResponseWriter, r *http.Request) {
md := MonitorData{
Name: monCfg.Name,
Type: monCfg.Type,
+ Link: monCfg.Link,
DisablePingTooltips: monCfg.DisablePingTooltips,
}
diff --git a/internal/server/templates/index.html b/internal/server/templates/index.html
index 9d98b44..12bcb12 100644
--- a/internal/server/templates/index.html
+++ b/internal/server/templates/index.html
@@ -88,7 +88,7 @@
{{else}}
<div class="w-2 h-2 rounded-full bg-neutral-400 flex-shrink-0"></div>
{{end}}
- <span class="font-medium truncate">{{.Name}}</span>
+ {{if .Link}}<a href="{{.Link}}" target="_blank" rel="noopener noreferrer" class="font-medium truncate hover:underline">{{.Name}}</a>{{else}}<span class="font-medium truncate">{{.Name}}</span>{{end}}
<span class="text-xs px-1.5 py-0.5 rounded bg-neutral-200 dark:bg-neutral-800 text-neutral-600 dark:text-neutral-400 uppercase">{{.Type}}</span>
</div>
<div class="flex items-center gap-4 text-xs text-neutral-500 dark:text-neutral-400">