OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
fix(dashboard): add maintenance in middleware
Carl-Gerhard Lindesvärd16b6786165d5
diff --git a/apps/dashboard/src/app/maintenance/page.tsx b/apps/dashboard/src/app/maintenance/page.tsxindex 4532112d7..a0529fadb 100644--- a/apps/dashboard/src/app/maintenance/page.tsx+++ b/apps/dashboard/src/app/maintenance/page.tsx@@ -3,13 +3,13 @@ import { CalendarCogIcon } from 'lucide-react';export default function Maintenance() {return (<div className="h-screen w-full center-center overflow-hidden">- <div className="relative z-10 col gap-2 center-center">+ <div className="relative z-10 col gap-2 center-center p-4"><CalendarCogIcon className="size-32 mb-4 animate-wiggle text-def-300" />- <div className="text-[150px] font-mono font-bold -mb-16 leading-[1] select-none pointer-events-none whitespace-nowrap bg-gradient-to-b from-def-300 to-def-100 bg-clip-text text-transparent">+ <div className="text-[90px] sm:text-[150px] font-mono font-bold -mb-16 leading-[1] select-none pointer-events-none whitespace-nowrap bg-gradient-to-b from-def-300 to-def-100 bg-clip-text text-transparent">Oh no!</div>- <h1 className="text-6xl font-bold">Maintenance</h1>- <p className="text-xl text-muted-foreground">+ <h1 className="text-5xl sm:text-6xl font-bold">Maintenance</h1>+ <p className="text-xl text-muted-foreground leading-normal">We're doing a planned maintenance. Please check back later.</p></div>diff --git a/apps/dashboard/src/middleware.ts b/apps/dashboard/src/middleware.tsindex 29e289229..df684b001 100644--- a/apps/dashboard/src/middleware.ts+++ b/apps/dashboard/src/middleware.ts@@ -28,9 +28,18 @@ const isPublicRoute = createRouteMatcher(['/reset-password(.*)?','/sso-callback(.*)?','/onboarding',+ '/maintenance',]);export default (request: NextRequest) => {+ // Check for maintenance mode+ if (+ process.env.MAINTENANCE === 'true' &&+ !request.nextUrl.pathname.startsWith('/maintenance')+ ) {+ return NextResponse.redirect(new URL('/maintenance', request.url));+ }+if (request.method === 'GET') {const response = NextResponse.next();const token = request.cookies.get('session')?.value ?? null;