forked from kenzuya/unshackle
fix(serve): allow remote-only mode without output_template and fix CORS/auth for Cloudflare
Move output_template validation from config init to dl command so serve, search, and other non-download commands work without it configured. Fix CORS header to use X-Secret-Key (matching actual auth header). Exempt /api/health from auth for Cloudflare tunnel health checks.
This commit is contained in:
@@ -130,6 +130,8 @@ def serve(
|
||||
@web.middleware
|
||||
async def api_key_authentication(request: web.Request, handler) -> web.Response:
|
||||
"""Authenticate API requests using X-Secret-Key header."""
|
||||
if request.path == "/api/health":
|
||||
return await handler(request)
|
||||
secret_key = request.headers.get("X-Secret-Key")
|
||||
if not secret_key:
|
||||
return web.json_response({"status": 401, "message": "Secret Key is Empty."}, status=401)
|
||||
|
||||
Reference in New Issue
Block a user