update
This commit is contained in:
@@ -16,7 +16,7 @@ app.include_router(download.router)
|
||||
app.include_router(system.router)
|
||||
|
||||
@app.get("/", response_class=HTMLResponse)
|
||||
async def index(request: Request):
|
||||
def index(request: Request):
|
||||
wrapper = TidalWrapper()
|
||||
if not wrapper.is_authenticated():
|
||||
return templates.TemplateResponse("login.html", {"request": request})
|
||||
|
||||
@@ -83,7 +83,7 @@ class DownloadManager:
|
||||
return task
|
||||
|
||||
def get_queue(self):
|
||||
return list(self.active_downloads.values()) + self.history
|
||||
return list(self.active_downloads.values()) + self.history[-10:]
|
||||
|
||||
def _worker(self):
|
||||
while True:
|
||||
|
||||
@@ -27,7 +27,26 @@ class TidalWrapper:
|
||||
self.auth_status = {"status": "idle", "message": "", "link": "", "code": ""}
|
||||
|
||||
def is_authenticated(self) -> bool:
|
||||
return self.session.check_login()
|
||||
max_retries = 5
|
||||
retry_delay = 5
|
||||
|
||||
for attempt in range(max_retries):
|
||||
try:
|
||||
return self.session.check_login()
|
||||
except Exception as e:
|
||||
error_str = str(e)
|
||||
# Check for connection-related errors
|
||||
if "Connection" in error_str or "RemoteDisconnected" in error_str or "Network" in error_str:
|
||||
logger.warning(f"Connection error checking authentication (Attempt {attempt + 1}/{max_retries}): {e}")
|
||||
if attempt < max_retries - 1:
|
||||
logger.info(f"Waiting {retry_delay} seconds for network/gluetun to recover...")
|
||||
time.sleep(retry_delay)
|
||||
continue
|
||||
|
||||
# If it's not a connection error, or we've run out of retries
|
||||
logger.error(f"Error checking authentication status: {e}")
|
||||
return False
|
||||
return False
|
||||
|
||||
def start_device_login(self) -> Dict[str, str]:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user