Show scan overlay after page reload
- Add is_scanning state tracking in AnimeService - Add get_scan_status method to AnimeService - Add /api/anime/scan/status endpoint to check scan state - Add checkActiveScanStatus in JS to restore overlay on reconnect - All 1024 tests passing
This commit is contained in:
@@ -366,6 +366,31 @@ async def trigger_rescan(
|
||||
) from exc
|
||||
|
||||
|
||||
@router.get("/scan/status")
|
||||
async def get_scan_status(
|
||||
_auth: dict = Depends(require_auth),
|
||||
anime_service: AnimeService = Depends(get_anime_service),
|
||||
) -> dict:
|
||||
"""Get the current scan status.
|
||||
|
||||
Returns the current state of any ongoing library scan,
|
||||
useful for restoring UI state after page reload.
|
||||
|
||||
Args:
|
||||
_auth: Ensures the caller is authenticated (value unused)
|
||||
anime_service: AnimeService instance provided via dependency.
|
||||
|
||||
Returns:
|
||||
Dict[str, Any]: Current scan status including:
|
||||
- is_scanning: Whether a scan is in progress
|
||||
- total_items: Total items to scan
|
||||
- directories_scanned: Items scanned so far
|
||||
- current_directory: Current item being scanned
|
||||
- directory: Root scan directory
|
||||
"""
|
||||
return anime_service.get_scan_status()
|
||||
|
||||
|
||||
class AddSeriesRequest(BaseModel):
|
||||
"""Request model for adding a new series."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user