Added error-url parameter to monitor sites

This commit is contained in:
Jeck 2025-01-14 21:32:04 -08:00
parent a7e235441b
commit c8200f2972
3 changed files with 10 additions and 0 deletions

View file

@ -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:

View file

@ -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>

View file

@ -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"`