Skip to content

Commit

Permalink
works
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Nov 22, 2023
1 parent d180f64 commit 69f6c80
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions ui/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,12 @@ import type {NextRequest} from 'next/server';

import {NextResponse} from 'next/server'

export default function middleware(request: NextRequest) {
console.log(request);
export default function middleware(req: NextRequest) {
if (req.nextUrl.pathname !== '/' &&
!req.nextUrl.pathname.startsWith("/_next/static/") &&
process.env.PEERDB_PASSWORD &&
req.cookies.get('password')?.value !== process.env.PEERDB_PASSWORD) {
console.log('REJECT');
return new Response('{}', {status : 401});
}
return NextResponse.next()
}

/*
export function middleware(req: NextRequest) {
console.log(req);
console.log(req.nextUrl);
}*/

0 comments on commit 69f6c80

Please sign in to comment.