App Nuxt 3 + Nuxt UI qui lit les projets du CMS Grav et compose des portfolios A3 paysage exportés en PDF (gabarit book_v3) : composeur WYSIWYG, templates cover/toc/projet/grille/page libre, pipeline Playwright + Ghostscript, gel du contenu à la génération, partage public opt-in. Dépôt autonome : Dockerfile (base Playwright + Ghostscript + ffmpeg + rsync) inclus. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
13 lines
506 B
TypeScript
13 lines
506 B
TypeScript
// Redirige vers /login toute page visitée sans session valide.
|
|
export default defineNuxtRouteMiddleware(async (to) => {
|
|
if (to.path === '/login' || to.path.startsWith('/print') || to.path.startsWith('/view')) return
|
|
try {
|
|
const { authenticated } = await $fetch<{ authenticated: boolean }>('/api/auth/me', {
|
|
headers: import.meta.server ? useRequestHeaders(['cookie']) : undefined,
|
|
})
|
|
if (!authenticated) return navigateTo('/login')
|
|
} catch {
|
|
return navigateTo('/login')
|
|
}
|
|
})
|