Fix turnstile

This commit is contained in:
2026-10-15 15:53:32 +02:00
parent 7dc93ac5ed
commit 70b676660d
80 changed files with 1136 additions and 902 deletions
+12 -16
View File
@@ -42,11 +42,11 @@ const SITE_INTEGRATIONS = 'site-integrations';
admin: {
components: {
Field: {
path: '@intecion/ipal-kit/client#IntegrationStatusBanner',
clientProps: {
label,
statusField
},
path: '@intecion/ipal-kit/client#IntegrationStatusBanner'
statusField,
label
}
}
}
}
@@ -60,29 +60,25 @@ const SITE_INTEGRATIONS = 'site-integrations';
const changed = previous?.state !== next.state || next.state === 'degraded' && previous?.code !== next.code;
const stale = next.state === 'degraded' && (!previous?.checkedAt || now.getTime() - new Date(previous.checkedAt).getTime() > REFRESH_MS);
// Healthy and already recorded as healthy (or never recorded) → nothing to do.
if (!changed && !stale) {
return;
}
if (next.state === 'ok' && !previous?.state) {
return;
}
if (!changed && !stale) return;
if (next.state === 'ok' && !previous?.state) return;
const status = {
checkedAt: now.toISOString(),
state: next.state,
code: next.code ?? null,
message: next.message ?? null,
since: changed ? now.toISOString() : previous?.since ?? now.toISOString(),
state: next.state
checkedAt: now.toISOString()
};
try {
await payload.updateGlobal({
slug: SITE_INTEGRATIONS,
context: {
ipalIntegrationStatus: true
},
data: {
[field]: status
},
depth: 0
depth: 0,
context: {
ipalIntegrationStatus: true
}
});
} catch (err) {
console.warn(`[ipal] could not record ${field}:`, err instanceof Error ? err.message : err);