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>
17 lines
665 B
TypeScript
17 lines
665 B
TypeScript
// Protège toute l'API (sauf login/me) derrière la session mot de passe partagé.
|
|
import { isAuthenticated } from '../lib/session'
|
|
|
|
const PUBLIC_API = new Set(['/api/auth/login', '/api/auth/me'])
|
|
|
|
export default defineEventHandler((event) => {
|
|
const path = event.path.split('?')[0]
|
|
if (!path.startsWith('/api/')) return
|
|
if (PUBLIC_API.has(path)) return
|
|
// Vue publique : /api/public/* est ouvert (chaque endpoint vérifie lui-même
|
|
// que le portfolio ciblé a publicShare actif).
|
|
if (path.startsWith('/api/public/')) return
|
|
if (!isAuthenticated(event)) {
|
|
throw createError({ statusCode: 401, statusMessage: 'Authentification requise' })
|
|
}
|
|
})
|