Drop custom auth dialog; rely on browser Basic Auth handling

Remove ImportDialog and all manual credential management. The browser
handles 401 challenges natively for same-origin fetch requests — it
shows its own credential prompt, retries, and caches the result for
the session. No JS-level auth code is needed.

- api.js: remove authHeader() and all credentials parameters
- store.js: remove credentials field
- ImportDialog.js: deleted
- AppShell.js: remove showImport/openImport/onMounted dialog machinery;
  pass importOnLoad through to PaneCP
- PaneCP.js: inline doImport() (was in ImportDialog); auto-triggers on
  mount when importOnLoad is true; shows inline import error on failure
- StatusPoller.js: remove credentials arg from fetchStatus()
- style.css: remove .se-import-dialog and .se-overlay blocks
This commit is contained in:
c0dev0id
2026-06-30 09:32:44 +02:00
parent 86b14dfaa3
commit 67c75781d8
7 changed files with 45 additions and 164 deletions

View File

@@ -2,45 +2,30 @@ const U = window.NEUSICIAN_URLS;
export const URLS = U;
function authHeader(credentials) {
if (!credentials) return {};
const b64 = btoa(`${credentials.username}:${credentials.password}`);
return { Authorization: `Basic ${b64}` };
}
export async function fetchAstLog(credentials) {
const res = await fetch(U.astlog, {
headers: authHeader(credentials),
});
export async function fetchAstLog() {
const res = await fetch(U.astlog);
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
return res.text();
}
export async function fetchScoreText(credentials) {
const res = await fetch(U.score, {
headers: authHeader(credentials),
});
export async function fetchScoreText() {
const res = await fetch(U.score);
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
return res.text();
}
export async function putScoreText(text, credentials) {
export async function putScoreText(text) {
const res = await fetch(U.score, {
method: 'PUT',
headers: {
...authHeader(credentials),
'Content-Type': 'text/yaml',
},
headers: { 'Content-Type': 'text/yaml' },
body: text,
});
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
return res;
}
export async function fetchStatus(credentials) {
const res = await fetch(U.status, {
headers: authHeader(credentials),
});
export async function fetchStatus() {
const res = await fetch(U.status);
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
return res.json();
}