Skip to content

A self-hosted dashboard that puts all your feeds in one place

Added error-url parameter to monitor sites

Jeckc8200f2972cb
diff --git a/docs/configuration.md b/docs/configuration.md
index 44f0b90..7bc11d8 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -1220,6 +1220,7 @@ Properties for each site:
| title | string | yes | |
| url | string | yes | |
| check-url | string | no | |
+| error-url | string | no | |
| icon | string | no | |
| allow-insecure | boolean | no | false |
| same-tab | boolean | no | false |
@@ -1237,6 +1238,10 @@ The public facing URL of a monitored service, the user will be redirected here.
The URL which will be requested and its response will determine the status of the site. If not specified, the `url` property is used.
+`error-url`
+
+If the monitored service returns an error, the user will be redirected here. If not specified, the `url` property is used.
+
`icon`
Optional URL to an image which will be used as the icon for the site. Can be an external URL or internal via [server configured assets](#assets-path). You can also directly use [Simple Icons](https://simpleicons.org/) via a `si:` prefix or [Dashboard Icons](https://github.com/walkxcode/dashboard-icons) via a `di:` prefix:
diff --git a/internal/glance/templates/monitor.html b/internal/glance/templates/monitor.html
index 7e95b99..291d638 100644
--- a/internal/glance/templates/monitor.html
+++ b/internal/glance/templates/monitor.html
@@ -25,7 +25,11 @@
<img class="monitor-site-icon{{ if .Icon.IsFlatIcon }} flat-icon{{ end }}" src="{{ .Icon.URL }}" alt="" loading="lazy">
{{ end }}
<div class="min-width-0">
+ {{ if and .Status.Error ( ne "" .ErrorURL)}}
+ <a class="size-h3 color-highlight text-truncate block" href="{{ .ErrorURL | safeURL }}" {{ if not .SameTab }}target="_blank"{{ end }} rel="noreferrer">{{ .Title }}</a>
+ {{ else }}
<a class="size-h3 color-highlight text-truncate block" href="{{ .URL | safeURL }}" {{ if not .SameTab }}target="_blank"{{ end }} rel="noreferrer">{{ .Title }}</a>
+ {{ end }}
<ul class="list-horizontal-text">
{{ if not .Status.Error }}
<li title="{{ .Status.Code }}">{{ .StatusText }}</li>
diff --git a/internal/glance/widget-monitor.go b/internal/glance/widget-monitor.go
index 0890902..c32ca21 100644
--- a/internal/glance/widget-monitor.go
+++ b/internal/glance/widget-monitor.go
@@ -20,6 +20,7 @@ type monitorWidget struct {
Sites []struct {
*SiteStatusRequest `yaml:",inline"`
Status *siteStatus `yaml:"-"`
+ ErrorURL string `yaml:"error-url"`
Title string `yaml:"title"`
Icon customIconField `yaml:"icon"`
SameTab bool `yaml:"same-tab"`