🔧 fix lint errors and bumb version

This commit is contained in:
Thomas Camlong
2022-11-12 08:12:54 +09:00
parent 7414f02667
commit dfdb8678b7
21 changed files with 82 additions and 87 deletions

View File

@@ -4,19 +4,15 @@ import { NextFetchEvent, NextRequest, NextResponse } from 'next/server';
export function middleware(req: NextRequest, ev: NextFetchEvent) {
const isCorrectPassword = req.cookies.get('password') === process.env.PASSWORD;
const url = req.nextUrl.clone();
const skipURL = url.pathname && (
url.pathname.includes('login') || url.pathname === ('/api/configs/tryPassword') || (
url.pathname.includes('/_next/') && !url.pathname.includes('/pages/')
) ||
const skipURL =
url.pathname &&
(url.pathname.includes('login') ||
url.pathname === '/api/configs/tryPassword' ||
(url.pathname.includes('/_next/') && !url.pathname.includes('/pages/')) ||
url.pathname === '/favicon.ico' ||
url.pathname === '/404' ||
url.pathname.includes('pages/_app')
);
if (
!skipURL &&
!isCorrectPassword &&
process.env.PASSWORD
) {
url.pathname.includes('pages/_app'));
if (!skipURL && !isCorrectPassword && process.env.PASSWORD) {
url.pathname = '/login';
return NextResponse.rewrite(url);
}