Files
OpenSquawk/server/middleware/auth.global.ts
2026-02-13 18:44:34 +01:00

27 lines
663 B
TypeScript

import {defineEventHandler, getRequestURL} from 'h3'
import {requireUserSession} from '../utils/auth'
export default defineEventHandler(async (event) => {
const url = getRequestURL(event)
if (!url.pathname.startsWith('/api/')) {
return
}
if (url.pathname.startsWith('/api/atc/say')) {
return
}
if (url.pathname.startsWith('/api/service/')) {
return
}
if (url.pathname.startsWith('/api/bridge/')) {
return
}
if (url.pathname === '/api/decision-flows/runtime') {
return
}
if (event.node.req.method === 'OPTIONS') {
return
}
await requireUserSession(event)
})