From 097c9de19e9641a1d39ea7d8cf98b3ef83ef0b2f Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Fri, 19 Jun 2026 14:23:35 -0400 Subject: [PATCH] support arbitrary responses --- src/data/apps.ts | 1 - src/index.ts | 10 +++++++--- src/types.ts | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/data/apps.ts b/src/data/apps.ts index ecdcc89..6f5278f 100644 --- a/src/data/apps.ts +++ b/src/data/apps.ts @@ -30,7 +30,6 @@ export const apps: Service[] = [ { name: "Navidrome", url: "https://navidrome.cute.haus", - healthUrl: "https://navidrome.narwhal-snapper.ts.net", icon: "https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/navidrome.png", }, { diff --git a/src/index.ts b/src/index.ts index f51859a..6f2f244 100644 --- a/src/index.ts +++ b/src/index.ts @@ -87,16 +87,20 @@ async function findFavicon(siteOrigin: string): Promise { } async function checkStatuses( - items: { name: string; url: string; healthUrl?: string }[], + items: { name: string; url: string; healthUrl?: string; goodStatuses?: number[] }[], ) { const results = await Promise.all( items.map(async (item) => { try { const response = await fetch(item.healthUrl ?? item.url, { - method: "HEAD", + method: "GET", signal: AbortSignal.timeout(3000), }); - return { name: item.name, online: response.status < 500 }; + const status = response.status; + const online = "goodStatuses" in item + ? item.goodStatuses!.includes(status) + : status < 500; + return { name: item.name, online }; } catch { return { name: item.name, online: false }; } diff --git a/src/types.ts b/src/types.ts index f32a77d..053d6a1 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3,4 +3,5 @@ export type Service = { url: string; icon?: string; healthUrl?: string; + goodStatuses?: number[]; }; -- 2.51.2