debug: log reroute calls in hooks.ts

This commit is contained in:
Falkan
2026-03-20 01:56:15 -04:00
parent f10e4a6cbe
commit 7239ca6d5a

View File

@@ -24,12 +24,14 @@ export const reroute: Reroute = ({ url }) => {
// Public path → internal /admin
if (url.pathname === prefix || url.pathname.startsWith(prefix + '/')) {
console.log(`[reroute] ${url.pathname} → /admin${url.pathname.slice(prefix.length)}`);
return '/admin' + url.pathname.slice(prefix.length);
}
// Block direct /admin access when a custom path is configured
if (adminPath !== 'admin') {
if (url.pathname === '/admin' || url.pathname.startsWith('/admin/')) {
console.log(`[reroute] blocking direct /admin access → /404`);
return '/404';
}
}