mirror of
https://github.com/usetrmnl/byos_next.git
synced 2026-04-29 13:34:28 -07:00
306fd8741b
Capture the repo-wide Biome formatting pass and fold the tiny BMP palette helpers back into render-bmp.ts so the monochrome palette fix stays self-contained. Made-with: Cursor
38 lines
816 B
TypeScript
38 lines
816 B
TypeScript
import { headers } from "next/headers";
|
|
import { NextRequest, NextResponse } from "next/server";
|
|
import { auth } from "@/lib/auth/auth";
|
|
|
|
// Paths that don't require authentication
|
|
const PUBLIC_PATHS = [
|
|
"/api",
|
|
"/_next",
|
|
"/favicon.ico",
|
|
"/sign-in",
|
|
"/sign-up",
|
|
"/recover",
|
|
];
|
|
|
|
export async function proxy(request: NextRequest) {
|
|
const { pathname } = request.nextUrl;
|
|
|
|
// Skip auth for public paths
|
|
if (PUBLIC_PATHS.some((path) => pathname.startsWith(path))) {
|
|
return NextResponse.next();
|
|
}
|
|
|
|
// Skip auth check if authentication is disabled (mono-user mode)
|
|
if (!auth) {
|
|
return NextResponse.next();
|
|
}
|
|
|
|
const session = await auth.api.getSession({
|
|
headers: await headers(),
|
|
});
|
|
|
|
if (!session) {
|
|
return NextResponse.redirect(new URL("/sign-in", request.url));
|
|
}
|
|
|
|
return NextResponse.next();
|
|
}
|