fix(app): hide account progress when idle; screenshot uses selected browse_type

This commit is contained in:
2025-12-14 00:56:12 +08:00
parent 757de96fd9
commit b4c7a3eac9
16 changed files with 66 additions and 44 deletions

10
app.py
View File

@@ -3212,6 +3212,9 @@ def take_screenshot_for_account(user_id, account_id, browse_type="应读", sourc
return
account = user_accounts[user_id][account_id]
# 以本次调用的 browse_type 为准(避免 last_browse_type 被刷新/重载导致截图页面不一致)
if browse_type:
account.last_browse_type = browse_type
# 标记账号正在截图(防止重复提交截图任务)
account.is_running = True
@@ -3265,7 +3268,6 @@ def take_screenshot_for_account(user_id, account_id, browse_type="应读", sourc
log_to_client(f"❌ 截图失败: 登录失败", user_id, account_id)
return {'success': False, 'error': '登录失败'}
browse_type = account.last_browse_type
log_to_client(f"导航到 '{browse_type}' 页面...", user_id, account_id)
# 导航到指定页面
@@ -3434,7 +3436,11 @@ def manual_screenshot(account_id):
account.last_browse_type = browse_type
threading.Thread(target=take_screenshot_for_account, args=(user_id, account_id), daemon=True).start()
threading.Thread(
target=take_screenshot_for_account,
args=(user_id, account_id, browse_type, 'manual_screenshot'),
daemon=True,
).start()
log_to_client(f"手动截图: {account.username} - {browse_type}", user_id)
return jsonify({"success": True})