Initial commit

This commit is contained in:
monoadmin
2026-04-10 15:36:33 -07:00
commit b2be19ed14
134 changed files with 16234 additions and 0 deletions

25
middleware.ts Normal file
View File

@@ -0,0 +1,25 @@
import { auth } from '@/auth'
import { NextResponse } from 'next/server'
export default auth((req) => {
const { nextUrl, auth: session } = req
const isLoggedIn = !!session
const isProtectedPath =
nextUrl.pathname.startsWith('/dashboard') ||
nextUrl.pathname.startsWith('/viewer')
if (isProtectedPath && !isLoggedIn) {
const loginUrl = new URL('/auth/login', nextUrl.origin)
loginUrl.searchParams.set('callbackUrl', nextUrl.pathname)
return NextResponse.redirect(loginUrl)
}
return NextResponse.next()
})
export const config = {
matcher: [
'/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)',
],
}