From bc2f367951a244986153c0f40b4329592ff26281 Mon Sep 17 00:00:00 2001 From: SBCrumb Date: Wed, 22 Oct 2025 12:02:49 -0400 Subject: [PATCH] fix: web routes --- api/web_routes.py | 36 +++++++++++++++++++++++++++++------- start_web.py | 7 +++++-- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/api/web_routes.py b/api/web_routes.py index decdd65..a109281 100644 --- a/api/web_routes.py +++ b/api/web_routes.py @@ -1219,7 +1219,11 @@ async def get_episode_date_options(dependencies: dict, imdb_id: str, season: int def register_web_routes(app, dependencies): """Register all web API routes with FastAPI app""" - # Dashboard and stats endpoints + # Dashboard and stats endpoints + @app.get("/api/dashboard") + async def api_dashboard(): + return await get_dashboard_stats(dependencies) + @app.get("/api/dashboard/stats") async def api_dashboard_stats(): return await get_dashboard_stats(dependencies) @@ -1232,11 +1236,15 @@ def register_web_routes(app, dependencies): @app.post("/api/movies/{imdb_id}/update-date") async def api_update_movie_date(imdb_id: str, dateadded: str = None, source: str = "manual"): - return await update_movie_date(dependencies, imdb_id, dateadded, source) + return {"error": "Updates not available in web container. Use core container on port 8085."} + + @app.put("/api/movies/{imdb_id}") + async def api_update_movie(imdb_id: str, dateadded: str = None, source: str = "manual"): + return {"error": "Updates not available in web container. Use core container on port 8085."} @app.get("/api/movies/{imdb_id}/date-options") async def api_movie_date_options(imdb_id: str): - return await get_movie_date_options(dependencies, imdb_id) + return {"options": [], "message": "Date options not available in web container. Use core container on port 8085."} # TV series endpoints @app.get("/api/series") @@ -1260,18 +1268,32 @@ def register_web_routes(app, dependencies): @app.post("/api/episodes/{imdb_id}/{season}/{episode}/update-date") async def api_update_episode_date(imdb_id: str, season: int, episode: int, dateadded: str = None, source: str = "manual"): - return await update_episode_date(dependencies, imdb_id, season, episode, dateadded, source) + return {"error": "Updates not available in web container. Use core container on port 8085."} + + @app.put("/api/episodes/{imdb_id}/{season}/{episode}") + async def api_update_episode(imdb_id: str, season: int, episode: int, + dateadded: str = None, source: str = "manual"): + return {"error": "Updates not available in web container. Use core container on port 8085."} @app.get("/api/episodes/{imdb_id}/{season}/{episode}/date-options") async def api_episode_date_options(imdb_id: str, season: int, episode: int): - return await get_episode_date_options(dependencies, imdb_id, season, episode) + return {"options": [], "message": "Date options not available in web container. Use core container on port 8085."} # Bulk operations @app.post("/api/bulk/update-source") async def api_bulk_update_source(media_type: str, old_source: str, new_source: str): - return await bulk_update_source(dependencies, media_type, old_source, new_source) + return {"error": "Bulk operations not available in web container. Use core container on port 8085."} # Reports @app.get("/api/reports/missing-dates") async def api_missing_dates_report(): - return await get_missing_dates_report(dependencies) \ No newline at end of file + return await get_missing_dates_report(dependencies) + + # Authentication endpoints (for web interface compatibility) + @app.get("/api/auth/status") + async def api_auth_status(): + return {"authenticated": False, "username": None} # Simplified for now + + @app.post("/api/auth/logout") + async def api_auth_logout(): + return {"status": "success", "message": "Logged out"} \ No newline at end of file diff --git a/start_web.py b/start_web.py index da87922..57ddd5b 100644 --- a/start_web.py +++ b/start_web.py @@ -75,10 +75,13 @@ def main(): print(f"❌ Failed to connect to database: {e}") sys.exit(1) - # Create dependencies for dependency injection + # Create dependencies for dependency injection (simplified for web-only) dependencies = { "db": db, - "config": config + "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 } # Setup static files and routes