fix(hephaestus): make wallet.js /challenge and /verify paths relative

Behind Caddy's /auth/* → auth-proxy rewrite, absolute fetch('/challenge')
resolved to origin root and hit Forgejo instead of the auth-proxy, so every
real user got "challenge request failed" when clicking sign-in.

Same root cause as the earlier fix for the CSS/JS asset paths — relative
paths work under both direct (:4000) and prefixed (/auth/) mounts.
This commit is contained in:
Local Dev 2026-08-31 02:58:19 +02:00
parent 238b3c1131
commit abf21785bc

View file

@ -266,7 +266,7 @@ async function signInWithMnemonic(mnemonic, root) {
if (btn) btn.disabled = true;
try {
const { privateKey, cashaddr } = await keypairFromMnemonic(mnemonic);
const chalRes = await fetch("/challenge", {
const chalRes = await fetch("challenge", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ cashaddr, state, redirect_uri: redirectUri }),
@ -274,7 +274,7 @@ async function signInWithMnemonic(mnemonic, root) {
if (!chalRes.ok) throw new Error("challenge request failed");
const { nonce, message } = await chalRes.json();
const signature = signMessage(privateKey, message);
const verRes = await fetch("/verify", {
const verRes = await fetch("verify", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ nonce, signature }),