Files
OpenSquawk/server/middleware/auth.global.ts
itsrubberduck 896ee4c3df simbrief gefixt
2026-05-06 15:43:05 +02:00

30 lines
736 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.startsWith('/api/copilot/')) {
return
}
if (url.pathname === '/api/decision-flows/runtime') {
return
}
if (event.node.req.method === 'OPTIONS') {
return
}
await requireUserSession(event)
})