diff --git a/src/ltProxyAuth.ts b/src/ltProxyAuth.ts index b4b0340..bea1631 100644 --- a/src/ltProxyAuth.ts +++ b/src/ltProxyAuth.ts @@ -8,9 +8,17 @@ import { Env } from './env.ts'; export const authMiddleware: Middleware = async (ctx, next) => { const key = ctx.query.apiKey; + if (Env.verbose) { + console.debug('API key:', key); + } + // Support both ?apiKey=... and form body with apiKey=... const extractedKey = Array.isArray(key) ? key[0] : key; + if (Env.verbose) { + console.debug('Extracted API key:', extractedKey); + } + if (!extractedKey || !Env.apiKeys.includes(extractedKey)) { return new Response('Forbidden – Invalid API key', { status: 403 }); }