feat: make authentication optional — no tokens = no auth
Lint & Test / test (push) Successful in 10s

When no api_tokens are configured (the new default), all endpoints
are accessible without authentication. The frontend detects this
via /api/health's auth_required field and skips the login form.

- Backend: auth.py skips verification when api_tokens is empty
- Frontend: shared getAuthHeaders()/hasCredentials() helpers replace
  scattered token logic across all JS modules
- Health endpoint exposes auth_required for frontend discovery
- config.example.yaml ships with tokens commented out
- CLI --show-token and startup log reflect disabled state

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-23 13:59:55 +03:00
parent f80f6e9299
commit 4d1bb78c83
14 changed files with 175 additions and 190 deletions
+3
View File
@@ -5,6 +5,8 @@ from typing import Any
from fastapi import APIRouter
from ..auth import auth_enabled
router = APIRouter(prefix="/api", tags=["health"])
@@ -19,4 +21,5 @@ async def health_check() -> dict[str, Any]:
"status": "healthy",
"platform": platform.system(),
"version": "1.0.0",
"auth_required": auth_enabled(),
}