Added files generated by Claude, prompted by sdk based on the md files

This commit is contained in:
Florian "flowdy" Heß
2026-06-21 19:23:54 +02:00
parent 7bc1ad4536
commit 822e2c9f42
20 changed files with 1886 additions and 0 deletions

42
static/api.js Normal file
View File

@@ -0,0 +1,42 @@
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('/sompyle/astlog', {
headers: authHeader(credentials),
});
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
return res.text();
}
export async function fetchScoreText(credentials) {
const res = await fetch('/sompyle/score.spls', {
headers: authHeader(credentials),
});
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
return res.text();
}
export async function putScoreText(text, credentials) {
const res = await fetch('/sompyle/score.spls', {
method: 'PUT',
headers: {
...authHeader(credentials),
'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('/sompyle/status.json', {
headers: authHeader(credentials),
});
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
return res.json();
}