mirror of
https://github.com/TecharoHQ/anubis.git
synced 2026-04-14 20:48:44 +00:00
fix: middleware traefik redirect url (#1040)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user