Update server.tsx
This commit is contained in:
parent
d6b845e6d2
commit
b758f66c69
|
|
@ -91,10 +91,7 @@ const requireAuth = (handler: (req: Request) => Response | Promise<Response>) =>
|
|||
return handler(req)
|
||||
}
|
||||
|
||||
const auth = req.headers.get("authorization")
|
||||
const correctAuth = `Basic ${btoa("spike:888")}`
|
||||
|
||||
if (auth === correctAuth) {
|
||||
if (validAuth(req)) {
|
||||
const response = await handler(req)
|
||||
const newHeaders = new Headers(response.headers)
|
||||
|
||||
|
|
@ -121,3 +118,9 @@ const requireAuth = (handler: (req: Request) => Response | Promise<Response>) =>
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
const validAuth = (req: Request): boolean => {
|
||||
const logins = ["spike:888", "defunkt:888", "probablycorey:888"]
|
||||
const auth = req.headers.get("authorization")
|
||||
return logins.some((login) => `Basic ${btoa(login)}` === auth)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user