forked from FOSS/Steam-Panel
v3.0.6
This commit is contained in:
+18
-7
@@ -3,9 +3,9 @@ import asyncio
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from loguru import logger
|
||||
|
||||
from app.database import get_db
|
||||
from app.config import read_validation_settings
|
||||
from app.core.task_manager import task_manager
|
||||
from app.database import get_db
|
||||
|
||||
router = APIRouter(prefix="/api", tags=["browser"])
|
||||
|
||||
@@ -20,8 +20,7 @@ async def open_browser(account_id: int):
|
||||
|
||||
account = dict(row)
|
||||
|
||||
from app.services.steam_auth import check_cookies_alive, _resolve_proxy
|
||||
from app.config import read_validation_settings
|
||||
from app.services.steam_auth import _resolve_proxy, check_cookies_alive
|
||||
|
||||
# If account isn't validated or has no cookies — auto-revalidate if enabled
|
||||
if account["status"] != "valid" or not account.get("session_cookies"):
|
||||
@@ -32,8 +31,14 @@ async def open_browser(account_id: int):
|
||||
accounts=[account],
|
||||
params={},
|
||||
)
|
||||
logger.info(f"Account {account['login']} not valid/no cookies, auto-revalidating → task {task_id}")
|
||||
return {"status": "revalidating", "message": "Cookies expired. Re-validating...", "task_id": task_id}
|
||||
logger.info(
|
||||
f"Account {account['login']} not valid/no cookies, auto-revalidating → task {task_id}"
|
||||
)
|
||||
return {
|
||||
"status": "revalidating",
|
||||
"message": "Cookies expired. Re-validating...",
|
||||
"task_id": task_id,
|
||||
}
|
||||
if account["status"] != "valid":
|
||||
raise HTTPException(400, "Account is not validated")
|
||||
raise HTTPException(400, "No session cookies. Validate the account first.")
|
||||
@@ -48,8 +53,14 @@ async def open_browser(account_id: int):
|
||||
accounts=[account],
|
||||
params={},
|
||||
)
|
||||
logger.info(f"Cookies dead for {account['login']}, auto-revalidating → task {task_id}")
|
||||
return {"status": "revalidating", "message": "Cookies expired. Re-validating...", "task_id": task_id}
|
||||
logger.info(
|
||||
f"Cookies dead for {account['login']}, auto-revalidating → task {task_id}"
|
||||
)
|
||||
return {
|
||||
"status": "revalidating",
|
||||
"message": "Cookies expired. Re-validating...",
|
||||
"task_id": task_id,
|
||||
}
|
||||
raise HTTPException(400, "Session cookies expired. Re-validate the account.")
|
||||
|
||||
from app.services.browser_login import open_browser_with_cookies
|
||||
|
||||
Reference in New Issue
Block a user