Phase 5+6: main host behind Authentik — copyparty trusts X-Authentik-* headers with group permissions (editors, media-admins), dumpd authorizes from headers (admins/media-admins), /sync gated to media-admins, dock drops its dump password; configure.py loses editors/admin
WebDAV continues via Authentik app passwords (provider: Intercept header authentication). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -126,13 +126,10 @@ $("stop").onclick = async () => {
|
||||
|
||||
let armed = 0;
|
||||
$("dump").onclick = async () => {
|
||||
const c = cfg();
|
||||
if (!c.user || !c.pass) return status("fill in settings first", "bad");
|
||||
const auth = "Basic " + btoa(`${c.user}:${c.pass}`);
|
||||
try {
|
||||
if (Date.now() - armed > 10000) { // first click: show what would go, arm for 10 s
|
||||
status("checking what tonight contains…");
|
||||
const dry = await (await fetch("/dump", {headers:{Authorization:auth}})).json();
|
||||
const dry = await (await fetch("/dump", {credentials:"same-origin"})).json(); // identity = your Discord login (Authentik)
|
||||
if (dry.error) throw new Error(dry.error);
|
||||
if (!dry.files.length) return status(`nothing recorded for ${dry.night}`);
|
||||
armed = Date.now();
|
||||
@@ -141,7 +138,7 @@ $("dump").onclick = async () => {
|
||||
return status(`${dry.files.length} file(s), ${dry.gb} GB from the night of ${dry.night}.\nClick Dump again within 10 s to confirm. Undo window: 3 days (ask admin).`);
|
||||
}
|
||||
armed = 0; $("dump").textContent = "Dump tonight";
|
||||
const r = await (await fetch("/dump", {method:"POST", headers:{Authorization:auth, "Content-Type":"application/json"}, body:"{}"})).json();
|
||||
const r = await (await fetch("/dump", {method:"POST", headers:{"Content-Type":"application/json"}, body:"{}", credentials:"same-origin"})).json();
|
||||
if (r.error) throw new Error(r.error);
|
||||
status(`dumped ${r.moved} file(s), ${r.gb} GB (recoverable until ${r.undo_until})`, "ok");
|
||||
} catch (e) { status("dump failed: " + e.message, "bad"); }
|
||||
|
||||
Reference in New Issue
Block a user