perf: embed challenge data in HTML (#279)

This commit is contained in:
Ryan Cao 2025-04-18 04:06:37 +00:00 committed by GitHub
parent 736c3ade09
commit f844dba3dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 63 additions and 42 deletions

View file

@ -133,19 +133,7 @@ function showContinueBar(hash, nonce, t0, t1) {
}
}
const { challenge, rules } = await fetch("/.within.website/x/cmd/anubis/api/make-challenge", { method: "POST" })
.then(r => {
if (!r.ok) throw new Error("Failed to fetch config");
return r.json();
})
.catch(err => {
ohNoes({
titleMsg: "Internal error!",
statusMsg: `Failed to fetch challenge config: ${err.message}`,
imageSrc: imageURL("reject", anubisVersion),
});
throw err;
});
const { challenge, rules } = JSON.parse(document.getElementById('anubis_challenge').textContent);
const process = algorithms[rules.algorithm];
if (!process) {