fix: rewrite proxy links with token prefix and correct login redirect
Build and Push to GHCR / build-and-push (push) Has been cancelled
Build and Push to GHCR / build-and-push (push) Has been cancelled
- Add ModifyResponse to DynamicProxy to inject token-prefix JS and rewrite Location headers, same as GitHub proxy already did. - Improve injectTokenPrefixScript to rewrite href/src/action on page load and watch for dynamically added elements via MutationObserver. - Replace hardcoded ../ login redirect with pathname-based calculation so it works regardless of admin_path config. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <[email protected]>
This commit is contained in:
@@ -109,7 +109,8 @@
|
||||
try {
|
||||
const res = await fetch('/api/auth/me', { credentials: 'same-origin' });
|
||||
if (res.ok) {
|
||||
window.location.href = '../';
|
||||
const adminRoot = window.location.pathname.replace(/\/login\/?$/, '/');
|
||||
window.location.href = adminRoot;
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
@@ -138,7 +139,8 @@
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
window.location.href = '../';
|
||||
const adminRoot = window.location.pathname.replace(/\/login\/?$/, '/');
|
||||
window.location.href = adminRoot;
|
||||
} else {
|
||||
const data = await res.json().catch(() => ({}));
|
||||
errorEl.textContent = data.error || '用户名或密码错误';
|
||||
|
||||
Reference in New Issue
Block a user