web: remove old one
Local Docker Build (Dev) / build-dev (push) Successful in 4s

This commit is contained in:
2025-10-22 12:13:49 -04:00
parent bc2f367951
commit 6f5341cbc6
+25 -128
View File
@@ -15,11 +15,7 @@ from api.models import (
SonarrWebhook, RadarrWebhook, HealthResponse, TVSeasonRequest, TVEpisodeRequest,
MovieUpdateRequest, EpisodeUpdateRequest, BulkUpdateRequest
)
from api.web_routes import (
get_movies_list, get_tv_series_list, get_series_episodes, get_series_sources, get_missing_dates_report,
get_dashboard_stats, update_movie_date, update_episode_date, bulk_update_source,
get_movie_date_options, get_episode_date_options, debug_series_date_distribution
)
# Web routes removed - handled by separate web container
# ---------------------------
@@ -1859,131 +1855,32 @@ def register_routes(app, dependencies: dict):
app.include_router(monitoring_router)
# ---------------------------
# Web Interface API Routes
# Web Interface Moved to Separate Container
# ---------------------------
@app.get("/api/dashboard")
async def _dashboard_stats():
"""Get dashboard statistics"""
return await get_dashboard_stats(dependencies)
@app.get("/api/movies")
async def _movies_list(skip: int = 0, limit: int = 100, has_date: Optional[bool] = None,
source_filter: Optional[str] = None, search: Optional[str] = None,
imdb_search: Optional[str] = None):
"""Get paginated movies list with filtering"""
return await get_movies_list(dependencies, skip, limit, has_date, source_filter, search, imdb_search)
@app.get("/api/series")
async def _series_list(skip: int = 0, limit: int = 50, search: Optional[str] = None,
imdb_search: Optional[str] = None, date_filter: Optional[str] = None,
source_filter: Optional[str] = None):
"""Get paginated TV series list with filtering"""
return await get_tv_series_list(dependencies, skip, limit, search, imdb_search, date_filter, source_filter)
@app.get("/api/series/{imdb_id}/episodes")
async def _series_episodes(imdb_id: str):
"""Get episodes for a specific series"""
return await get_series_episodes(dependencies, imdb_id)
@app.get("/api/series/sources")
async def _series_sources():
"""Get list of available episode sources for filtering"""
return await get_series_sources(dependencies)
@app.get("/api/debug/series-date-distribution")
async def _debug_series_dates():
"""Debug endpoint showing TV series date distribution"""
return await debug_series_date_distribution(dependencies)
@app.get("/api/reports/missing-dates")
async def _missing_dates_report():
"""Get report of content missing dateadded"""
return await get_missing_dates_report(dependencies)
@app.put("/api/movies/{imdb_id}")
async def _update_movie(imdb_id: str, request: MovieUpdateRequest):
"""Update movie dateadded"""
return await update_movie_date(dependencies, imdb_id, request.dateadded, request.source)
@app.put("/api/episodes/{imdb_id}/{season}/{episode}")
async def _update_episode(imdb_id: str, season: int, episode: int, request: EpisodeUpdateRequest):
"""Update episode dateadded"""
return await update_episode_date(dependencies, imdb_id, season, episode, request.dateadded, request.source)
@app.post("/api/auth/logout")
async def _logout(request: Request, response: Response):
"""Logout endpoint - clears session"""
session_manager = dependencies.get("session_manager")
if session_manager:
session_token = request.cookies.get("nfoguard_session")
if session_token:
session_manager.delete_session(session_token)
response.delete_cookie("nfoguard_session")
return {"status": "logged_out", "message": "Session cleared"}
@app.get("/api/auth/status")
async def _auth_status(request: Request):
"""Check authentication status"""
auth_enabled = dependencies.get("auth_enabled", False)
if not auth_enabled:
return {"authenticated": True, "auth_enabled": False, "message": "Authentication disabled"}
session_manager = dependencies.get("session_manager")
if not session_manager:
return {"authenticated": False, "auth_enabled": True, "message": "Session manager not available"}
session_token = request.cookies.get("nfoguard_session")
if session_token:
username = session_manager.get_session_user(session_token)
if username:
return {"authenticated": True, "auth_enabled": True, "username": username}
return {"authenticated": False, "auth_enabled": True, "message": "Not authenticated"}
@app.post("/api/bulk/update-source")
async def _bulk_update_source(request: BulkUpdateRequest):
"""Bulk update source for movies or episodes"""
return await bulk_update_source(dependencies, request.media_type, request.old_source, request.new_source)
@app.get("/api/movies/{imdb_id}/date-options")
async def _movie_date_options(imdb_id: str):
"""Get available date options for a movie"""
return await get_movie_date_options(dependencies, imdb_id)
@app.get("/api/episodes/{imdb_id}/{season}/{episode}/date-options")
async def _episode_date_options(imdb_id: str, season: int, episode: int):
"""Get available date options for an episode"""
return await get_episode_date_options(dependencies, imdb_id, season, episode)
@app.get("/api/debug/movie/{imdb_id}/raw")
async def _debug_movie_raw(imdb_id: str):
"""Debug endpoint to see raw movie database data"""
db = dependencies["db"]
movie = db.get_movie_dates(imdb_id)
if not movie:
raise HTTPException(status_code=404, detail="Movie not found")
return {"raw_data": dict(movie), "imdb_id": imdb_id}
# Web interface routes have been moved to the nfoguard-web container
# for performance isolation. The core container only handles:
# - Webhooks (/webhook/*)
# - Manual scans (/manual/*)
# - Database operations (/database/*)
# - Health checks (/health)
#
# Web interface available on separate container port 8081
# ---------------------------
# Static Web Interface
# Core API - No Web Interface
# ---------------------------
from fastapi.staticfiles import StaticFiles
from fastapi.responses import FileResponse
import os
# Serve static files for web interface
static_dir = os.path.join(os.path.dirname(__file__), "..", "static")
if os.path.exists(static_dir):
app.mount("/static", StaticFiles(directory=static_dir), name="static")
@app.get("/")
async def _serve_index():
"""Serve web interface index page"""
index_path = os.path.join(static_dir, "index.html")
if os.path.exists(index_path):
return FileResponse(index_path)
else:
return {"message": "NFOGuard Web Interface - API endpoints available at /api/", "api_docs": "/docs"}
async def _core_info():
"""Core container API information - Web interface on separate container"""
return {
"service": "NFOGuard Core Processing Engine",
"version": "2.7.0",
"message": "Web interface available on separate container (port 8081)",
"api_endpoints": {
"health": "/health",
"webhooks": "/webhook/*",
"manual_scans": "/manual/*",
"database": "/database/*",
"api_docs": "/docs"
}
}