Générateur de portfolios PDF Figures Libres (app Nuxt autonome)
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>
This commit is contained in:
16
server/middleware/01.auth.ts
Normal file
16
server/middleware/01.auth.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
// 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' })
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user