-
Notifications
You must be signed in to change notification settings - Fork 13
chore: enable maintenance on all pages #1233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bade4ae
3bceb07
e11ca8f
6d13946
f99d9fd
c9d2109
b1cde7a
c105812
ec9a98b
29f6d1d
f7976af
38c7c5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,30 @@ | ||
| import Layout from '@/components/Global/Layout' | ||
| 'use client' | ||
| import chillPeanutAnim from '@/animations/GIF_ALPHA_BACKGORUND/512X512_ALPHA_GIF_konradurban_01.gif' | ||
| import { Button } from '@/components/0_Bruddle' | ||
| import Image from 'next/image' | ||
| import { useRouter } from 'next/navigation' | ||
|
|
||
| export default function MaintenancePage() { | ||
| const MaintenancePage = () => { | ||
| const router = useRouter() | ||
| return ( | ||
| <Layout> | ||
| <div className="flex min-h-screen flex-col items-center justify-center"> | ||
| <h1 className="mb-4 text-4xl font-bold">Under Maintenance</h1> | ||
| <p className="text-xl"> | ||
| This feature is currently undergoing maintenance. We apologize for the inconvenience. | ||
| </p> | ||
| </div> | ||
| </Layout> | ||
| <div className="flex h-screen flex-col items-center justify-center gap-4 p-6"> | ||
| <Image src={chillPeanutAnim.src} alt="Maintenance" width={250} height={250} /> | ||
| <h1 className="text-3xl font-bold text-black">Under Maintenance</h1> | ||
| <p className="text-center text-lg text-gray-1"> | ||
| We are currently going through maintenance. We should be back online shortly. Sorry for the | ||
| inconvenience. | ||
| </p> | ||
| <p className="text-center text-gray-1">Thank you for your patience.</p> | ||
|
|
||
| <Button | ||
| variant="transparent" | ||
| onClick={() => router.push('/support')} | ||
| className="h-5 w-fit p-0 underline underline-offset-2" | ||
| > | ||
| Contact Support? | ||
| </Button> | ||
| </div> | ||
| ) | ||
| } | ||
|
|
||
| export default MaintenancePage |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,6 +3,24 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { NextResponse } from 'next/server' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export function middleware(request: NextRequest) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { pathname } = request.nextUrl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const maintenanceMode = true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (maintenanceMode) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const allowedPaths = ['/', '/maintenance', '/apple-app-site-association'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| !allowedPaths.includes(pathname) && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| !pathname.startsWith('/api/') && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| !pathname.startsWith('/_next/') && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| !pathname.startsWith('/.well-known/') && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| !pathname.match( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /.*\.(jpg|jpeg|png|gif|svg|ico|ttf|woff|woff2|eot|css|js|json|xml|txt|mp3|mp4|webm|ogg|wav|flac|aac)$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return NextResponse.redirect(new URL('/maintenance', request.url)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+6
to
+22
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hard-coded maintenance mode will lock users out Shipping with Apply this diff: - const { pathname } = request.nextUrl
- const maintenanceMode = true
+ const { pathname } = request.nextUrl
+ const maintenanceMode =
+ (process.env.NEXT_PUBLIC_MAINTENANCE_MODE || process.env.MAINTENANCE_MODE) === 'true'
@@
- const allowedPaths = ['/', '/maintenance', '/apple-app-site-association']
+ const allowedPaths = ['/', '/maintenance', '/support', '/apple-app-site-association']📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Check: CodeQL[failure] 16-18: Polynomial regular expression used on uncontrolled data |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const url = request.nextUrl.clone() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const promoList: { [key: string]: string } = JSON.parse(process.env.PROMO_LIST ?? '{}') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -46,5 +64,23 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Updated matcher to include root path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const config = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| matcher: ['/', '/claim/:path*', '/api/:path*'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| matcher: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/home', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/claim/:path*', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/api/:path*', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/home/:path*', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/profile/:path*', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/send/:path*', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/request/:path*', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/settings/:path*', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/setup/:path*', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/share/:path*', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/history/:path*', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/raffle/:path*', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/c/:path*', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/pay/:path*', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/p/:path*', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '/link/:path*', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.