Rename admin routes to ISAC

This commit is contained in:
JB
2026-07-25 20:55:13 -04:00
parent 0425fede8e
commit 67db106fba
38 changed files with 46 additions and 38 deletions
+5 -1
View File
@@ -4,8 +4,12 @@ import { getSessionUser } from '$lib/server/auth/session';
import { DATA_MODULES, queueDataProposal, shouldModerateDataMutation, type DataModule } from '$lib/server/data-moderation';
export const handle: Handle = async ({ event, resolve }) => {
if (event.url.pathname === '/admin' || event.url.pathname.startsWith('/admin/')) {
const location = `/isac${event.url.pathname.slice('/admin'.length)}${event.url.search}`;
return new Response(null, { status: 308, headers: { location } });
}
if (event.request.method === 'POST') {
const match = event.url.pathname.match(/^\/admin\/([^/]+)$/);
const match = event.url.pathname.match(/^\/isac\/([^/]+)$/);
const module = match?.[1] as DataModule | undefined;
const action = event.url.search.startsWith('?/') ? event.url.search.slice(2) : '';
if (module && DATA_MODULES.includes(module) && action) {