Fix: Settings LocalHost Auth (#25)

This commit is contained in:
Youwes09
2026-04-13 10:55:41 -05:00
parent 75430305e6
commit 5a2f88b806
2 changed files with 12 additions and 12 deletions
+3 -2
View File
@@ -3075,9 +3075,10 @@
.perf-stat { font-family: var(--font-ui); font-size: var(--text-xs); color: var(--text-secondary); letter-spacing: var(--tracking-wide); flex-shrink: 0; } .perf-stat { font-family: var(--font-ui); font-size: var(--text-xs); color: var(--text-secondary); letter-spacing: var(--tracking-wide); flex-shrink: 0; }
/* ── Security ────────────────────────────────────────────────────────────── */ /* ── Security ────────────────────────────────────────────────────────────── */
.sec-banner { font-family: var(--font-ui); font-size: var(--text-xs); line-height: var(--leading-snug); border-radius: var(--radius-md); padding: var(--sp-3); letter-spacing: var(--tracking-wide); }
.sec-banner-error { color: var(--color-error); background: var(--color-error-bg); border: 1px solid var(--color-error); } .sec-banner-error { color: var(--color-error); background: var(--color-error-bg); border: 1px solid var(--color-error); }
.sec-banner-warn { color: var(--color-error); background: var(--color-error-bg); border: 1px solid var(--color-error); } .sec-banner-warn { color: var(--color-warn, var(--color-error)); background: var(--color-warn-bg, var(--color-error-bg)); border: 1px solid var(--color-warn, var(--color-error)); }
.sec-banner-warn code { font-family: monospace; font-size: 10px; background: color-mix(in srgb, var(--color-error) 12%, transparent); padding: 1px 4px; border-radius: 3px; } .sec-banner-warn code { font-family: monospace; font-size: 10px; background: color-mix(in srgb, var(--color-warn, var(--color-error)) 12%, transparent); padding: 1px 4px; border-radius: 3px; }
.sec-pill-warn { border-color: var(--color-error); color: var(--color-error); background: var(--color-error-bg); } .sec-pill-warn { border-color: var(--color-error); color: var(--color-error); background: var(--color-error-bg); }
.section-title-row { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3) var(--sp-3) var(--sp-2); } .section-title-row { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3) var(--sp-3) var(--sp-2); }
.section-title-row .section-title { padding: 0; } .section-title-row .section-title { padding: 0; }
+9 -10
View File
@@ -29,7 +29,7 @@ export function fetchAuthenticated(
return fetch(url, { return fetch(url, {
...init, ...init,
signal, signal,
credentials: "include", credentials: "omit",
headers: { headers: {
...(init.headers as Record<string, string> ?? {}), ...(init.headers as Record<string, string> ?? {}),
...(user && pass ? basicHeader(user, pass) : {}), ...(user && pass ? basicHeader(user, pass) : {}),
@@ -37,15 +37,16 @@ export function fetchAuthenticated(
}); });
} }
return fetch(url, { ...init, signal }); return fetch(url, { ...init, signal, credentials: "omit" });
} }
export async function loginBasic(user: string, pass: string): Promise<void> { export async function loginBasic(user: string, pass: string): Promise<void> {
const res = await fetch(`${getServerBase()}/api/graphql`, { const res = await fetch(`${getServerBase()}/api/graphql`, {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json", ...basicHeader(user, pass) }, credentials: "omit",
body: JSON.stringify({ query: "{ __typename }" }), headers: { "Content-Type": "application/json", ...basicHeader(user, pass) },
signal: AbortSignal.timeout(5000), body: JSON.stringify({ query: "{ __typename }" }),
signal: AbortSignal.timeout(5000),
}); });
if (!res.ok) throw new Error(`Authentication failed (${res.status})`); if (!res.ok) throw new Error(`Authentication failed (${res.status})`);
updateSettings({ serverAuthMode: "BASIC_AUTH", serverAuthUser: user, serverAuthPass: pass }); updateSettings({ serverAuthMode: "BASIC_AUTH", serverAuthUser: user, serverAuthPass: pass });
@@ -71,15 +72,13 @@ export async function probeServer(): Promise<"ok" | "auth_required" | "unsupport
const res = await fetch(`${base}/api/graphql`, { const res = await fetch(`${base}/api/graphql`, {
method: "POST", method: "POST",
credentials: "include", credentials: "omit",
headers, headers,
body: JSON.stringify({ query: "{ __typename }" }), body: JSON.stringify({ query: "{ __typename }" }),
signal: AbortSignal.timeout(2000), signal: AbortSignal.timeout(2000),
}); });
if (res.ok) { if (res.ok) return "ok";
return "ok";
}
if (res.status === 401) { if (res.status === 401) {
const wwwAuth = res.headers.get("WWW-Authenticate") ?? ""; const wwwAuth = res.headers.get("WWW-Authenticate") ?? "";