Update main.ts
Browse files
main.ts
CHANGED
|
@@ -392,10 +392,8 @@ function verifyApiKey(request: Request) {
|
|
| 392 |
});
|
| 393 |
}
|
| 394 |
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
console.log("----")
|
| 398 |
-
console.log(VALID_API_KEY)
|
| 399 |
return new Response(JSON.stringify({ error: 'Invalid API key' }), {
|
| 400 |
status: 401,
|
| 401 |
headers: {
|
|
|
|
| 392 |
});
|
| 393 |
}
|
| 394 |
|
| 395 |
+
const apiKey = authorization.replace('Bearer ', '').trim();
|
| 396 |
+
if (apiKey !== VALID_API_KEY) {
|
|
|
|
|
|
|
| 397 |
return new Response(JSON.stringify({ error: 'Invalid API key' }), {
|
| 398 |
status: 401,
|
| 399 |
headers: {
|