修复所有bug并添加新功能
- 修复添加账号按钮无反应问题
- 添加账号备注字段(可选)
- 添加账号设置按钮(修改密码/备注)
- 修复用户反馈���能
- 添加定时任务执行日志
- 修复容器重启后账号加载问题
- 修复所有JavaScript语法错误
- 优化账号加载机制(4层保障)
🤖 Generated with Claude Code
This commit is contained in:
43
fix_quick_login2.py
Executable file
43
fix_quick_login2.py
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""修复quick_login - 使用池中浏览器时直接登录"""
|
||||
|
||||
with open('/www/wwwroot/zsglpt/playwright_automation.py', 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
# 找到quick_login方法并替换
|
||||
old = ''' def quick_login(self, username: str, password: str, remember: bool = True):
|
||||
"""快速登录 - 优先使用cookies,失败则正常登录"""
|
||||
# 尝试使用cookies
|
||||
if self.load_cookies(username):'''
|
||||
|
||||
new = ''' def quick_login(self, username: str, password: str, remember: bool = True):
|
||||
"""快速登录 - 使用池中浏览器时直接登录,否则尝试cookies"""
|
||||
# 如果已有浏览器实例(从池中获取),直接使用该浏览器登录
|
||||
# 不尝试加载cookies,因为load_cookies会创建新浏览器覆盖池中的
|
||||
if self.browser and self.browser.is_connected():
|
||||
self.log("使用池中浏览器,直接登录")
|
||||
result = self.login(username, password, remember)
|
||||
if result.get('success'):
|
||||
self.save_cookies(username)
|
||||
result['used_cookies'] = False
|
||||
return result
|
||||
|
||||
# 无现有浏览器时,尝试使用cookies
|
||||
if self.load_cookies(username):'''
|
||||
|
||||
if old in content:
|
||||
content = content.replace(old, new)
|
||||
print("OK - quick_login已修复")
|
||||
else:
|
||||
print("WARNING - 未找到匹配内容,显示实际内容进行对比")
|
||||
import re
|
||||
match = re.search(r'def quick_login.*?(?=\n def |\n\nclass |\Z)', content, re.DOTALL)
|
||||
if match:
|
||||
print("实际内容前200字符:")
|
||||
print(repr(match.group(0)[:200]))
|
||||
|
||||
with open('/www/wwwroot/zsglpt/playwright_automation.py', 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
|
||||
print("完成")
|
||||
Reference in New Issue
Block a user