fix ops admin frontend fallback

This commit is contained in:
2569718930@qq.com
2026-06-14 22:57:10 +08:00
parent 7fb82c5eba
commit 0e2b076535
2 changed files with 52 additions and 4 deletions
@@ -43,6 +43,19 @@ export function runTests() {
"ops server page gate must honor localhost ops access before Supabase/admin-email redirects",
);
assert(
opsAdminSource.includes("verifyOpsAdminWithBackend") &&
opsAdminSource.includes("POLYWEATHER_API_BASE_URL") &&
opsAdminSource.includes("/api/ops/online-users") &&
opsAdminSource.includes("Authorization") &&
opsAdminSource.includes("BACKEND_ENTITLEMENT_HEADER") &&
opsAdminSource.includes("await supabase.auth.getSession()") &&
opsAdminSource.includes("if (allowedEmails.includes(email))") &&
opsAdminSource.includes("if (await verifyOpsAdminWithBackend(accessToken))") &&
!opsAdminSource.includes("if (!allowedEmails.length || !hasSupabaseServerEnv())"),
"ops admin page gate must fall back to the backend ops admin check when the frontend admin email env is missing or stale",
);
assert(
opsProxyAuthSource.includes("isLocalOpsAccessHost") &&
opsProxyAuthSource.includes("x-forwarded-host") &&