diff options
| author | Jason Cameron <git@jasoncameron.dev> | 2025-04-25 14:39:38 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-25 14:39:38 -0400 |
| commit | 24f8ba729b180fb420995b8c6b592f23b3e5a552 (patch) | |
| tree | b9ee24e053fac2125a74bd1d92818a0f7922a94d /web/js | |
| parent | 6858f66a62416354a349d8090fcb45b5262056eb (diff) | |
| download | anubis-24f8ba729b180fb420995b8c6b592f23b3e5a552.tar.xz anubis-24f8ba729b180fb420995b8c6b592f23b3e5a552.zip | |
feat: add support for a base prefix (#294)
* fix: rename variable for preventing collision in ED25519 private key handling
Signed-off-by: Jason Cameron <git@jasoncameron.dev>
* fix: remove unused import and debug print in xess.go
Signed-off-by: Jason Cameron <git@jasoncameron.dev>
* feat: introduce base path configuration for Anubis endpoints
Closes: #231
Signed-off-by: Jason Cameron <git@jasoncameron.dev>
* hack(internal/test): skip these tests for now
Signed-off-by: Xe Iaso <me@xeiaso.net>
* fix(yeet): unbreak package builds
Signed-off-by: Xe Iaso <me@xeiaso.net>
---------
Signed-off-by: Jason Cameron <git@jasoncameron.dev>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Co-authored-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'web/js')
| -rw-r--r-- | web/js/main.mjs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/web/js/main.mjs b/web/js/main.mjs index 9bb6031..c50ed2b 100644 --- a/web/js/main.mjs +++ b/web/js/main.mjs @@ -14,8 +14,8 @@ const u = (url = "", params = {}) => { return result.toString(); }; -const imageURL = (mood, cacheBuster) => - u(`/.within.website/x/cmd/anubis/static/img/${mood}.webp`, { cacheBuster }); +const imageURL = (mood, cacheBuster, basePrefix) => + u(`${basePrefix}/.within.website/x/cmd/anubis/static/img/${mood}.webp`, { cacheBuster }); const dependencies = [ { @@ -81,6 +81,7 @@ function showContinueBar(hash, nonce, t0, t1) { const title = document.getElementById('title'); const progress = document.getElementById('progress'); const anubisVersion = JSON.parse(document.getElementById('anubis_version').textContent); + const basePrefix = JSON.parse(document.getElementById('anubis_base_prefix').textContent); const details = document.querySelector('details'); let userReadDetails = false; @@ -103,7 +104,7 @@ function showContinueBar(hash, nonce, t0, t1) { ohNoes({ titleMsg: "Your context is not secure!", statusMsg: `Try connecting over HTTPS or let the admin know to set up HTTPS. For more information, see <a href="https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts#when_is_a_context_considered_secure">MDN</a>.`, - imageSrc: imageURL("reject", anubisVersion), + imageSrc: imageURL("reject", anubisVersion, basePrefix), }); return; } @@ -128,7 +129,7 @@ function showContinueBar(hash, nonce, t0, t1) { ohNoes({ titleMsg: `Missing feature ${name}`, statusMsg: msg, - imageSrc: imageURL("reject", anubisVersion), + imageSrc: imageURL("reject", anubisVersion, basePrefix), }); } } @@ -140,7 +141,7 @@ function showContinueBar(hash, nonce, t0, t1) { ohNoes({ titleMsg: "Challenge error!", statusMsg: `Failed to resolve check algorithm. You may want to reload the page.`, - imageSrc: imageURL("reject", anubisVersion), + imageSrc: imageURL("reject", anubisVersion, basePrefix), }); return; } @@ -198,7 +199,7 @@ function showContinueBar(hash, nonce, t0, t1) { title.innerHTML = "Success!"; status.innerHTML = `Done! Took ${t1 - t0}ms, ${nonce} iterations`; - image.src = imageURL("happy", anubisVersion); + image.src = imageURL("happy", anubisVersion, basePrefix); progress.style.display = "none"; if (userReadDetails) { @@ -223,7 +224,7 @@ function showContinueBar(hash, nonce, t0, t1) { function onDetailsExpand() { const redir = window.location.href; window.location.replace( - u("/.within.website/x/cmd/anubis/api/pass-challenge", { + u(`${basePrefix}/.within.website/x/cmd/anubis/api/pass-challenge`, { response: hash, nonce, redir, @@ -239,7 +240,7 @@ function showContinueBar(hash, nonce, t0, t1) { setTimeout(() => { const redir = window.location.href; window.location.replace( - u("/.within.website/x/cmd/anubis/api/pass-challenge", { + u(`${basePrefix}/.within.website/x/cmd/anubis/api/pass-challenge`, { response: hash, nonce, redir, @@ -253,7 +254,7 @@ function showContinueBar(hash, nonce, t0, t1) { ohNoes({ titleMsg: "Calculation error!", statusMsg: `Failed to calculate challenge: ${err.message}`, - imageSrc: imageURL("reject", anubisVersion), + imageSrc: imageURL("reject", anubisVersion, basePrefix), }); } })();
\ No newline at end of file |
