fixes: web

This commit is contained in:
2025-10-22 13:05:34 -04:00
committed by sbcrumb
parent c61c35ebad
commit 78813b9189
2 changed files with 51 additions and 5 deletions
+22 -1
View File
@@ -19,6 +19,9 @@ from core.database import NFOGuardDatabase
# Import web routes from existing system
from api.web_routes import register_web_routes
# Import authentication system
from api.auth import SimpleAuthMiddleware, AuthSession
def create_web_app() -> FastAPI:
"""Create FastAPI web application"""
@@ -84,18 +87,36 @@ def main():
print(f"❌ Failed to connect to database: {e}")
sys.exit(1)
# Setup authentication if enabled
auth_enabled = getattr(config, 'web_auth_enabled', False)
session_manager = None
if auth_enabled:
session_timeout = getattr(config, 'web_auth_session_timeout', 3600)
session_manager = AuthSession(timeout_seconds=session_timeout)
print(f"🔐 Web authentication enabled (session timeout: {session_timeout}s)")
else:
print("🌐 Web authentication disabled")
# Create dependencies for dependency injection (simplified for web-only)
dependencies = {
"db": db,
"config": config,
"nfo_manager": None, # Not needed for read-only web interface
"movie_processor": None, # Not needed for read-only web interface
"tv_processor": None # Not needed for read-only web interface
"tv_processor": None, # Not needed for read-only web interface
"auth_enabled": auth_enabled,
"session_manager": session_manager
}
# Setup static files and routes
setup_static_files(app)
# Add authentication middleware if enabled
if auth_enabled:
app.add_middleware(SimpleAuthMiddleware, dependencies=dependencies)
print("🔐 Authentication middleware added to web interface")
# Register web routes
register_web_routes(app, dependencies)