feat(core): 增强离线模式支持和版本管理

- 在主窗口中添加离线模式管理器,支持自动切换到离线模式。
- 更新下载管理器以处理离线模式下的下载逻辑,确保用户体验流畅。
- 添加版本警告机制,提示用户在版本过低时的操作选项。
- 优化配置管理器,确保在离线模式下仍可使用相关功能。
- 更新UI管理器以反映当前工作模式,提升用户界面友好性。
This commit is contained in:
hyb-oyqq
2025-08-06 15:22:44 +08:00
parent b18f4a276c
commit 7befe19f30
17 changed files with 1707 additions and 148 deletions

View File

@@ -200,7 +200,15 @@ class DownloadThread(QThread):
command.append(self.url)
print(f"即将执行的 Aria2c 命令: {' '.join(command)}")
# 创建一个安全的命令副本隐藏URL
safe_command = command.copy()
if len(safe_command) > 0:
# 替换最后一个参数URL为安全版本
url = safe_command[-1]
if isinstance(url, str) and url.startswith("http"):
safe_command[-1] = "***URL protection***"
print(f"即将执行的 Aria2c 命令: {' '.join(safe_command)}")
creation_flags = subprocess.CREATE_NO_WINDOW if sys.platform == 'win32' else 0
self.process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, encoding='utf-8', errors='replace', creationflags=creation_flags)
@@ -220,8 +228,11 @@ class DownloadThread(QThread):
else:
break
full_output.append(line)
print(line.strip())
# 处理输出行隐藏可能包含的URL
from utils.helpers import censor_url
censored_line = censor_url(line)
full_output.append(censored_line)
print(censored_line.strip())
match = progress_pattern.search(line)
if match: