BREAKING: postgres + saas

This commit is contained in:
Vasily Zubarev
2025-04-03 13:07:54 +02:00
parent 54a892ddb0
commit f523b1f8ba
136 changed files with 3971 additions and 1563 deletions

27
middleware.ts Normal file
View File

@@ -0,0 +1,27 @@
import { getSessionCookie } from "better-auth/cookies"
import { NextRequest, NextResponse } from "next/server"
import { AUTH_LOGIN_URL, IS_SELF_HOSTED_MODE } from "./lib/constants"
export default async function middleware(request: NextRequest) {
if (IS_SELF_HOSTED_MODE) {
return NextResponse.next()
}
const sessionCookie = getSessionCookie(request, { cookiePrefix: "taxhacker" })
if (!sessionCookie) {
return NextResponse.redirect(new URL(AUTH_LOGIN_URL, request.url))
}
return NextResponse.next()
}
export const config = {
matcher: [
"/transactions/:path*",
"/settings/:path*",
"/export/:path*",
"/import/:path*",
"/unsorted/:path*",
"/files/:path*",
"/dashboard/:path*",
],
}