fix: middleware traefik redirect url (#1040)

This commit is contained in:
phoval 2025-08-28 13:24:29 +02:00 committed by GitHub
parent c661bc37d1
commit 9ddc1eb840
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 84 additions and 37 deletions

View file

@ -53,6 +53,17 @@ const loadTranslations = async (lang) => {
}
};
const getRedirectUrl = () => {
const publicUrl = JSON.parse(
document.getElementById("anubis_public_url").textContent,
);
if (publicUrl && window.location.href.startsWith(publicUrl)) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get('redir');
}
return window.location.href;
}
let translations = {};
let currentLang;
@ -205,7 +216,7 @@ const t = (key) => translations[`js_${key}`] || translations[key] || key;
container.innerHTML = t('finished_reading');
function onDetailsExpand() {
const redir = window.location.href;
const redir = getRedirectUrl();
window.location.replace(
u(`${basePrefix}/.within.website/x/cmd/anubis/api/pass-challenge`, {
id: challenge.id,
@ -220,7 +231,7 @@ const t = (key) => translations[`js_${key}`] || translations[key] || key;
container.onclick = onDetailsExpand;
setTimeout(onDetailsExpand, 30000);
} else {
const redir = window.location.href;
const redir = getRedirectUrl();
window.location.replace(
u(`${basePrefix}/.within.website/x/cmd/anubis/api/pass-challenge`, {
id: challenge.id,