Init NextJS, Implement Login and more

This commit is contained in:
2026-01-28 11:33:28 +01:00
parent a471b28121
commit 2666c5cd32
36 changed files with 7242 additions and 0 deletions

24
src/proxy.ts Normal file
View File

@@ -0,0 +1,24 @@
import {NextRequest, NextResponse} from "next/server";
export default async function proxy(req: NextRequest) {
const auth_is_valid = true // (await verifySession()).isAuth;
const route_is_login = req.nextUrl.pathname === "/login"
if (route_is_login && auth_is_valid) { // Redirect User to Home if Login already acquired
return NextResponse.redirect(new URL('/home', req.url))
}
if (route_is_login || auth_is_valid) { // Let user pass if Login is passed or asked for
return
}
return NextResponse.redirect(new URL('/login', req.url))
}
export const config = {
matcher: [
// Exclude API routes, static files, image optimizations, and .png files
'/((?!api|_next/static|_next/image|.*\\.png$).*)',
],
}