From 871ba619a3f8b4e408f0001f4cf4700c61ab31ce Mon Sep 17 00:00:00 2001 From: MrExplode Date: Sat, 3 Aug 2024 14:06:52 +0200 Subject: [PATCH 1/4] Add separate URL for monitor check --- internal/feed/monitor.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/feed/monitor.go b/internal/feed/monitor.go index 03cdcf4..47d604a 100644 --- a/internal/feed/monitor.go +++ b/internal/feed/monitor.go @@ -9,6 +9,7 @@ import ( type SiteStatusRequest struct { URL string `yaml:"url"` + CheckURL string `yaml:"check_url"` AllowInsecure bool `yaml:"allow-insecure"` } @@ -20,7 +21,7 @@ type SiteStatus struct { } func getSiteStatusTask(statusRequest *SiteStatusRequest) (SiteStatus, error) { - request, err := http.NewRequest(http.MethodGet, statusRequest.URL, nil) + request, err := http.NewRequest(http.MethodGet, statusRequest.CheckURL, nil) if err != nil { return SiteStatus{ From 457e0539faa21ccf26a4795b4c75f16e9c3c8976 Mon Sep 17 00:00:00 2001 From: MrExplode Date: Sat, 3 Aug 2024 14:14:24 +0200 Subject: [PATCH 2/4] Allow empty check URL --- internal/feed/monitor.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/feed/monitor.go b/internal/feed/monitor.go index 47d604a..07b8fd7 100644 --- a/internal/feed/monitor.go +++ b/internal/feed/monitor.go @@ -21,7 +21,13 @@ type SiteStatus struct { } func getSiteStatusTask(statusRequest *SiteStatusRequest) (SiteStatus, error) { - request, err := http.NewRequest(http.MethodGet, statusRequest.CheckURL, nil) + var url string + if statusRequest.CheckURL != "" { + url = statusRequest.CheckURL + } else { + url = statusRequest.URL + } + request, err := http.NewRequest(http.MethodGet, url, nil) if err != nil { return SiteStatus{ From 39663cb594bde56528a17616c0f14f4b9de5c948 Mon Sep 17 00:00:00 2001 From: MrExplode Date: Sat, 3 Aug 2024 14:14:42 +0200 Subject: [PATCH 3/4] Document monitor URL changes --- docs/configuration.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/configuration.md b/docs/configuration.md index 12a6a28..750c8cd 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -997,6 +997,7 @@ Properties for each site: | ---- | ---- | -------- | ------- | | title | string | yes | | | url | string | yes | | +| check_url | string | no | | | icon | string | no | | | allow-insecure | boolean | no | false | | same-tab | boolean | no | false | @@ -1007,7 +1008,11 @@ The title used to indicate the site. `url` -The URL which will be requested and its response will determine the status of the site. Optionally, you can specify this using an environment variable with the syntax `${VARIABLE_NAME}`. +The public facing URL of a monitored service, the user will be redirected here. If `check_url` is not specified, this is used as the status check. + +`check_url` + +The URL which will be requested and its response will determine the status of the site. If not specified, the `url` property is used. `icon` From 7afad765cb41d16122185333061b79cd11c83f40 Mon Sep 17 00:00:00 2001 From: Svilen Markov <7613769+svilenmarkov@users.noreply.github.com> Date: Sun, 4 Aug 2024 20:54:30 +0100 Subject: [PATCH 4/4] Use hyphen instead of underscore --- docs/configuration.md | 6 +++--- internal/feed/monitor.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 750c8cd..20e1bf2 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -997,7 +997,7 @@ Properties for each site: | ---- | ---- | -------- | ------- | | title | string | yes | | | url | string | yes | | -| check_url | string | no | | +| check-url | string | no | | | icon | string | no | | | allow-insecure | boolean | no | false | | same-tab | boolean | no | false | @@ -1008,9 +1008,9 @@ The title used to indicate the site. `url` -The public facing URL of a monitored service, the user will be redirected here. If `check_url` is not specified, this is used as the status check. +The public facing URL of a monitored service, the user will be redirected here. If `check-url` is not specified, this is used as the status check. -`check_url` +`check-url` The URL which will be requested and its response will determine the status of the site. If not specified, the `url` property is used. diff --git a/internal/feed/monitor.go b/internal/feed/monitor.go index 07b8fd7..a3da636 100644 --- a/internal/feed/monitor.go +++ b/internal/feed/monitor.go @@ -9,7 +9,7 @@ import ( type SiteStatusRequest struct { URL string `yaml:"url"` - CheckURL string `yaml:"check_url"` + CheckURL string `yaml:"check-url"` AllowInsecure bool `yaml:"allow-insecure"` }