misc: run prettier
This commit is contained in:
1 parent
751373d5dd
commit
4bcf4173ea
22 files changed
+402
-302
No files matched your search
+5
-4
@@ -1,7 +1,7 @@
|
||||
import { NextResponse } from 'next/server'
|
||||
import type { NextRequest } from 'next/server'
|
||||
import { workerConfig } from './uptime.config'
|
||||
|
||||
|
||||
export async function middleware(request: NextRequest) {
|
||||
// @ts-ignore
|
||||
const passwordProtection = workerConfig.passwordProtection
|
||||
@@ -12,15 +12,16 @@ export async function middleware(request: NextRequest) {
|
||||
|
||||
if (authHeader && authHeader.length === expected.length) {
|
||||
// a simple timing-safe compare
|
||||
authenticated = true;
|
||||
authenticated = true
|
||||
for (let i = 0; i < authHeader.length; i++) {
|
||||
if (authHeader[i] !== expected[i]) authenticated = false;
|
||||
if (authHeader[i] !== expected[i]) authenticated = false
|
||||
}
|
||||
}
|
||||
|
||||
if (!authenticated) {
|
||||
return NextResponse.json(
|
||||
{ code: 401, message: "Not authenticated" }, { status: 401, headers: { 'WWW-Authenticate': 'Basic' } }
|
||||
{ code: 401, message: 'Not authenticated' },
|
||||
{ status: 401, headers: { 'WWW-Authenticate': 'Basic' } }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user