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

This commit is contained in:
2025-10-25 15:43:53 -04:00
parent cb62ddb187
commit 98da1a07f0
3 changed files with 44 additions and 23 deletions
+38
View File
@@ -1280,6 +1280,44 @@ def register_web_routes(app, dependencies):
async def api_episode_date_options(imdb_id: str, season: int, episode: int): async def api_episode_date_options(imdb_id: str, season: int, episode: int):
return {"options": [], "message": "Date options not available in web container. Use core container on port 8085."} return {"options": [], "message": "Date options not available in web container. Use core container on port 8085."}
@app.delete("/api/episodes/{imdb_id}/{season}/{episode}")
async def api_delete_episode(imdb_id: str, season: int, episode: int):
"""Delete an episode from the database"""
db = dependencies["db"]
try:
# Check if episode exists
with db.get_connection() as conn:
cursor = conn.cursor()
cursor.execute(
"SELECT season, episode, dateadded, source FROM episodes WHERE imdb_id = %s AND season = %s AND episode = %s",
(imdb_id, season, episode)
)
episode_data = cursor.fetchone()
if not episode_data:
raise HTTPException(status_code=404, detail="Episode not found")
# Delete the episode
cursor.execute(
"DELETE FROM episodes WHERE imdb_id = %s AND season = %s AND episode = %s",
(imdb_id, season, episode)
)
conn.commit()
return {
"success": True,
"status": "success",
"message": f"Deleted episode {imdb_id} S{season:02d}E{episode:02d}",
"imdb_id": imdb_id,
"season": season,
"episode": episode
}
except Exception as e:
print(f"❌ Error deleting episode: {e}")
raise HTTPException(status_code=500, detail=f"Failed to delete episode: {str(e)}")
# Bulk operations # Bulk operations
@app.post("/api/bulk/update-source") @app.post("/api/bulk/update-source")
async def api_bulk_update_source(media_type: str, old_source: str, new_source: str): async def api_bulk_update_source(media_type: str, old_source: str, new_source: str):
+1 -1
View File
@@ -457,6 +457,6 @@
<!-- Toast Notifications --> <!-- Toast Notifications -->
<div class="toast-container" id="toast-container"></div> <div class="toast-container" id="toast-container"></div>
<script src="/static/js/app.js?v=2.8.2-20241025-final"></script> <script src="/static/js/app.js?v=2.8.2-20241025-delete-fix"></script>
</body> </body>
</html> </html>
+4 -21
View File
@@ -17,21 +17,8 @@ from config.settings import config
# Import existing database and components # Import existing database and components
from core.database import NFOGuardDatabase from core.database import NFOGuardDatabase
# Add web interface path for routes only # Import web routes from existing system (now includes DELETE route)
web_path = os.path.join(os.path.dirname(__file__), "nfoguard-web") from api.web_routes import register_web_routes
if web_path not in sys.path:
sys.path.append(web_path)
# Import web routes from separated system
try:
from api.web_routes import register_web_routes as register_separated_web_routes
use_separated_routes = True
print("✅ Using separated web routes with DELETE /api/episodes/ support")
except ImportError:
# Fallback to old routes if separated routes not available
from api.web_routes import register_web_routes
use_separated_routes = False
print("⚠️ Using legacy web routes - DELETE functionality may be limited")
# Import authentication system # Import authentication system
from api.auth import SimpleAuthMiddleware, AuthSession from api.auth import SimpleAuthMiddleware, AuthSession
@@ -165,13 +152,9 @@ def main():
# Setup static files and routes # Setup static files and routes
setup_static_files(app) setup_static_files(app)
# Register web routes (prefer separated routes if available) # Register web routes (now includes DELETE /api/episodes/ route)
if use_separated_routes:
register_separated_web_routes(app, dependencies)
print("✅ Registered separated web routes with full /api/episodes/ support")
else:
register_web_routes(app, dependencies) register_web_routes(app, dependencies)
print("⚠️ Using legacy web routes") print("✅ Registered web routes with DELETE /api/episodes/ support")
print(f"🚀 Starting web server on {web_host}:{web_port}") print(f"🚀 Starting web server on {web_host}:{web_port}")