initial admin

This commit is contained in:
Dreamgineer
2025-10-15 01:03:31 -04:00 Unverified
parent ba6143f63b
commit fc97ebc35f
99 changed files with 2351 additions and 1408 deletions
+28
View File
@@ -0,0 +1,28 @@
import { getSessionCookie } from "better-auth/cookies";
import { type NextRequest, NextResponse } from "next/server";
export async function proxy(request: NextRequest) {
const sessionCookie = getSessionCookie(request);
// THIS IS NOT SECURE!
// This is the recommended approach to optimistically redirect users
// We recommend handling auth checks in each page/route
if (!sessionCookie) {
const url = new URL("/login", request.url);
url.searchParams.set(
"next",
request.nextUrl.pathname + request.nextUrl.search,
);
return NextResponse.redirect(url);
}
return NextResponse.next();
}
export const config = {
matcher: [
"/artifact/admin/:path*",
"/tl/:path*/:path*/admin",
"/admin/:path*",
], // Specify the routes the middleware applies to
};