diff --git a/src/index.ts b/src/index.ts --- a/src/index.ts +++ b/src/index.ts @@ -87,16 +87,20 @@ } 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 --- a/src/types.ts +++ b/src/types.ts @@ -3,4 +3,5 @@ url: string; icon?: string; healthUrl?: string; + goodStatuses?: number[]; }; diff --git a/src/data/apps.ts b/src/data/apps.ts --- a/src/data/apps.ts +++ b/src/data/apps.ts @@ -30,7 +30,6 @@ { 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", }, {