mirror of
https://github.com/hyb-oyqq/FRAISEMOE-Addons-Installer-NEXT.git
synced 2026-04-05 21:32:49 +00:00
feat(core): 增强离线模式支持和版本管理
- 在主窗口中添加离线模式管理器,支持自动切换到离线模式。 - 更新下载管理器以处理离线模式下的下载逻辑,确保用户体验流畅。 - 添加版本警告机制,提示用户在版本过低时的操作选项。 - 优化配置管理器,确保在离线模式下仍可使用相关功能。 - 更新UI管理器以反映当前工作模式,提升用户界面友好性。
This commit is contained in:
@@ -18,7 +18,8 @@ class ConfigFetchThread(QThread):
|
||||
try:
|
||||
if self.debug_mode:
|
||||
print("--- Starting to fetch cloud config ---")
|
||||
print(f"DEBUG: Requesting URL: {self.url}")
|
||||
# 完全隐藏URL
|
||||
print(f"DEBUG: Requesting URL: ***URL protection***")
|
||||
print(f"DEBUG: Using Headers: {self.headers}")
|
||||
|
||||
response = requests.get(self.url, headers=self.headers, timeout=10)
|
||||
@@ -26,7 +27,18 @@ class ConfigFetchThread(QThread):
|
||||
if self.debug_mode:
|
||||
print(f"DEBUG: Response Status Code: {response.status_code}")
|
||||
print(f"DEBUG: Response Headers: {response.headers}")
|
||||
print(f"DEBUG: Response Text: {response.text}")
|
||||
|
||||
# 解析并隐藏响应中的敏感URL
|
||||
try:
|
||||
response_data = response.json()
|
||||
# 创建安全版本用于日志输出
|
||||
safe_response = self._create_safe_config_for_logging(response_data)
|
||||
print(f"DEBUG: Response Text: {json.dumps(safe_response, indent=2)}")
|
||||
except:
|
||||
# 如果不是JSON,直接打印文本
|
||||
from utils.helpers import censor_url
|
||||
censored_text = censor_url(response.text)
|
||||
print(f"DEBUG: Response Text: {censored_text}")
|
||||
|
||||
response.raise_for_status()
|
||||
|
||||
@@ -62,4 +74,28 @@ class ConfigFetchThread(QThread):
|
||||
self.finished.emit(None, error_msg)
|
||||
finally:
|
||||
if self.debug_mode:
|
||||
print("--- Finished fetching cloud config ---")
|
||||
print("--- Finished fetching cloud config ---")
|
||||
|
||||
def _create_safe_config_for_logging(self, config_data):
|
||||
"""创建用于日志记录的安全配置副本,隐藏敏感URL
|
||||
|
||||
Args:
|
||||
config_data: 原始配置数据
|
||||
|
||||
Returns:
|
||||
dict: 安全的配置数据副本
|
||||
"""
|
||||
if not config_data or not isinstance(config_data, dict):
|
||||
return config_data
|
||||
|
||||
# 创建深拷贝,避免修改原始数据
|
||||
import copy
|
||||
safe_config = copy.deepcopy(config_data)
|
||||
|
||||
# 隐藏敏感URL
|
||||
for key in safe_config:
|
||||
if isinstance(safe_config[key], dict) and "url" in safe_config[key]:
|
||||
# 完全隐藏URL
|
||||
safe_config[key]["url"] = "***URL protection***"
|
||||
|
||||
return safe_config
|
||||
Reference in New Issue
Block a user