Headless image-to-video UI queues jobs on the desktop ComfyUI instance with live SSE progress and Authentik SSO.
20 lines
553 B
TypeScript
20 lines
553 B
TypeScript
export default defineEventHandler((event) => {
|
|
if (!authEnabled()) return
|
|
const path = event.path || getRequestURL(event).pathname
|
|
if (
|
|
path.startsWith('/api/auth') ||
|
|
path.startsWith('/api/health') ||
|
|
path.startsWith('/_nuxt') ||
|
|
path.startsWith('/favicon') ||
|
|
path === '/login'
|
|
) {
|
|
return
|
|
}
|
|
const user = getSessionUser(event)
|
|
if (user) return
|
|
if (path.startsWith('/api/')) {
|
|
throw createError({ statusCode: 401, statusMessage: 'Authentication required' })
|
|
}
|
|
return sendRedirect(event, '/login', 302)
|
|
})
|