mirror of
https://github.com/Mzdyl/LiteLoaderQQNT_Install.git
synced 2026-10-17 05:21:19 +08:00
1.18 (#155)
* 修改连通性 连通性测试改为对提供的 URL 测试而不是单纯的 GitHub * 简化 插件查看 的下载判读逻辑 * 更新版本号
This commit is contained in:
+15
-19
@@ -19,7 +19,7 @@ from tkinter import filedialog
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
|
||||
# 当前版本号
|
||||
current_version = "1.17"
|
||||
current_version = "1.18"
|
||||
|
||||
|
||||
# 存储反代服务器的URL
|
||||
@@ -247,9 +247,9 @@ def get_document_path() -> str:
|
||||
return path
|
||||
|
||||
|
||||
def can_connect_to_github():
|
||||
def can_connect(url, timeout=2):
|
||||
try:
|
||||
response = requests.head("https://github.com", timeout=5)
|
||||
response = requests.head(url, timeout=timeout)
|
||||
return response.status_code == 200
|
||||
except requests.exceptions.RequestException:
|
||||
return False
|
||||
@@ -528,26 +528,22 @@ def install_plugin_store(file_path):
|
||||
|
||||
temp_dir = tempfile.gettempdir()
|
||||
|
||||
if not os.path.exists(existing_destination_path):
|
||||
if not os.path.exists(existing_destination_path) or not os.path.exists(os.path.join(existing_destination_path, 'main', 'index.js')):
|
||||
if not os.path.exists(existing_destination_path):
|
||||
os.makedirs(plugin_path, exist_ok=True)
|
||||
else:
|
||||
print("检测到已安装插件商店可能存在问题,即将重装")
|
||||
shutil.rmtree(existing_destination_path)
|
||||
print("更新和安装插件请使用 release 版本")
|
||||
print("非 release 版本可能导致 QQ 无法正常启动")
|
||||
|
||||
# 下载并解压插件
|
||||
download_and_extract_form_release("ltxhhz/LL-plugin-list-viewer")
|
||||
os.makedirs(plugin_path, exist_ok=True)
|
||||
print(f"移动自: {os.path.join(temp_dir, 'list-viewer')}")
|
||||
print(f"移动到: {existing_destination_path}")
|
||||
shutil.move(os.path.join(temp_dir, "list-viewer"), plugin_path)
|
||||
else:
|
||||
download_and_extract_form_release("ltxhhz/LL-plugin-list-viewer")
|
||||
index_js_path = os.path.join(existing_destination_path, 'main', 'index.js')
|
||||
if not os.path.exists(index_js_path):
|
||||
print("检测到已安装插件商店可能存在问题,即将重装")
|
||||
print("更新和安装插件请使用 release 版本")
|
||||
print("非 release 版本可能导致 QQ 无法正常启动")
|
||||
shutil.rmtree(existing_destination_path)
|
||||
os.makedirs(existing_destination_path, exist_ok=True)
|
||||
print(f"移动自: {os.path.join(temp_dir, 'list-viewer')}")
|
||||
print(f"移动到: {existing_destination_path}")
|
||||
shutil.move(os.path.join(temp_dir, "list-viewer"), existing_destination_path)
|
||||
else:
|
||||
print("检测到已安装插件商店,不在重新安装")
|
||||
print("检测到已安装插件商店,不再重新安装")
|
||||
|
||||
except Exception as e:
|
||||
print(f"安装插件商店发生错误: {e}\n请尝试手动安装")
|
||||
@@ -583,7 +579,7 @@ def download_file(url_or_path: str, filepath: str, timeout: int = 10):
|
||||
shutil.copy(url_or_path, filepath)
|
||||
return
|
||||
elif url_or_path.startswith(('http://', 'https://')):
|
||||
download_url = url_or_path if can_connect_to_github() else f"{get_working_proxy()}/{url_or_path}"
|
||||
download_url = url_or_path if can_connect(url_or_path) else f"{get_working_proxy()}/{url_or_path}"
|
||||
print(f"当前使用的下载链接: {download_url}")
|
||||
|
||||
# 尝试下载文件
|
||||
|
||||
Reference in New Issue
Block a user