重构Cookie监控系统:添加Web管理后台、Vue3前端界面、Cookie Cloud参数支持、5秒倒计时自动刷新、专业UI配色

This commit is contained in:
bwstudio
2026-04-17 22:37:28 +08:00
parent ed95ce5b23
commit 70802b9b50
44 changed files with 2923 additions and 3654 deletions
+55
View File
@@ -0,0 +1,55 @@
"""
更新用户Cookie Cloud参数
"""
import json
import sqlite3
import os
DB_PATH = os.path.join(os.path.dirname(__file__), 'backend', 'instance', 'cookie_monitor.db')
def update_user_cookie_cloud():
"""更新用户Cookie Cloud参数"""
with open('config.json', 'r', encoding='utf-8') as f:
config = json.load(f)
conn = sqlite3.connect(DB_PATH)
cursor = conn.cursor()
# 添加新列(如果不存在)
columns_to_add = [
('cookie_cloud_uuid', 'VARCHAR(255)'),
('cookie_cloud_password', 'VARCHAR(255)'),
('cookie_cloud_api_url', 'VARCHAR(255)')
]
for col_name, col_type in columns_to_add:
try:
cursor.execute(f"ALTER TABLE users ADD COLUMN {col_name} {col_type}")
print(f"添加列: {col_name}")
except sqlite3.OperationalError as e:
if 'duplicate column name' in str(e).lower():
print(f"列已存在: {col_name}")
else:
raise
for user_config in config['users']:
user_name = user_config['name']
cc = user_config.get('cookie_cloud', {})
cursor.execute(
"UPDATE users SET cookie_cloud_uuid = ?, cookie_cloud_password = ?, cookie_cloud_api_url = ? WHERE name = ?",
(
cc.get('uuid', ''),
cc.get('password', ''),
cc.get('api_url', ''),
user_name
)
)
print(f"更新用户 {user_name}: UUID={cc.get('uuid', '')}, API={cc.get('api_url', '')}")
conn.commit()
conn.close()
print("\n更新完成!")
if __name__ == '__main__':
update_user_cookie_cloud()