Fix website URL and uptime check logic
- Website: www.akkolli.net has no DNS record, use akkolli.net instead - Uptime: treat any response < 500 as up (was res.ok / 200-299 only). Nextcloud returns non-200 for untrusted Host headers but is still running. Only 5xx and network errors count as down. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@ const { open } = require('sqlite');
|
|||||||
// Node 18+ has global fetch built-in
|
// Node 18+ has global fetch built-in
|
||||||
|
|
||||||
const SERVICES = [
|
const SERVICES = [
|
||||||
{ name: 'Website', url: 'https://www.akkolli.net' },
|
{ name: 'Website', url: 'https://akkolli.net' },
|
||||||
{ name: 'Gitea', url: 'https://code.akkolli.net' },
|
{ name: 'Gitea', url: 'https://code.akkolli.net' },
|
||||||
{ name: 'Nextcloud', url: 'http://host.docker.internal:6060' },
|
{ name: 'Nextcloud', url: 'http://host.docker.internal:6060' },
|
||||||
];
|
];
|
||||||
@@ -49,7 +49,9 @@ async function monitor() {
|
|||||||
});
|
});
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
|
|
||||||
status = res.ok ? 'up' : 'down';
|
// Any HTTP response means the service is reachable (up).
|
||||||
|
// Only network errors/timeouts (caught below) count as down.
|
||||||
|
status = res.status < 500 ? 'up' : 'down';
|
||||||
const end = performance.now();
|
const end = performance.now();
|
||||||
latency = Math.round(end - start);
|
latency = Math.round(end - start);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user