This commit was merged in pull request #462.
This commit is contained in:
@@ -18,6 +18,25 @@ export async function fetchSoulMd() {
|
||||
}
|
||||
}
|
||||
|
||||
// --- Portal health probes ---
|
||||
export async function checkPortalHealth(portals) {
|
||||
for (const portal of portals) {
|
||||
if (!portal.destination?.url) {
|
||||
portal.status = 'offline';
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
await fetch(portal.destination.url, {
|
||||
mode: 'no-cors',
|
||||
signal: AbortSignal.timeout(5000),
|
||||
});
|
||||
portal.status = 'online';
|
||||
} catch {
|
||||
portal.status = 'offline';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- portals.json ---
|
||||
export async function fetchPortals() {
|
||||
const res = await fetch('./portals.json');
|
||||
|
||||
Reference in New Issue
Block a user