feat: formations host 301 to moodle domain

This commit is contained in:
electron-rare
2026-06-11 01:44:36 +02:00
parent 8b0a135e0a
commit c0f9c7fe37
+4
View File
@@ -3,6 +3,10 @@ import { COURSES } from './config/courses';
export const onRequest = defineMiddleware((ctx, next) => {
const { pathname, searchParams } = ctx.url;
// legacy alias: the app's canonical domain is moodle.saillant.cc (SP4)
if (ctx.url.hostname === 'formations.saillant.cc') {
return ctx.redirect(`https://moodle.saillant.cc${pathname}${ctx.url.search}`, 301);
}
if (pathname === '/course/view.php') {
const id = Number(searchParams.get('id'));
const course = COURSES.find((c) => c.id === id);