Compare commits
7 Commits
207c3c604e
...
v3.3.9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10523de040 | ||
|
|
dd0a307ff4 | ||
|
|
b5cbf0779b | ||
|
|
d81244c7e4 | ||
|
|
e3b5820d8b | ||
|
|
4ee3ac066e | ||
|
|
30aab5f9b2 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -17,4 +17,6 @@ venv/
|
|||||||
env/
|
env/
|
||||||
|
|
||||||
# Local development settings
|
# Local development settings
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
testversion.txt
|
||||||
@@ -165,14 +165,41 @@ class AccountSwitcher:
|
|||||||
"code": code
|
"code": code
|
||||||
}
|
}
|
||||||
|
|
||||||
response = requests.post(
|
# 禁用SSL警告
|
||||||
self.config.get_api_url("activate"),
|
import urllib3
|
||||||
json=data,
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||||
headers={"Content-Type": "application/json"},
|
|
||||||
timeout=10
|
# 设置请求参数
|
||||||
)
|
request_kwargs = {
|
||||||
|
"json": data,
|
||||||
|
"headers": {"Content-Type": "application/json"},
|
||||||
|
"timeout": 5, # 减少超时时间从10秒到5秒
|
||||||
|
"verify": False # 禁用SSL验证
|
||||||
|
}
|
||||||
|
|
||||||
|
# 尝试发送请求
|
||||||
|
try:
|
||||||
|
response = requests.post(
|
||||||
|
self.config.get_api_url("activate"),
|
||||||
|
**request_kwargs
|
||||||
|
)
|
||||||
|
except requests.exceptions.SSLError:
|
||||||
|
# 如果发生SSL错误,创建自定义SSL上下文
|
||||||
|
import ssl
|
||||||
|
ssl_context = ssl.create_default_context()
|
||||||
|
ssl_context.check_hostname = False
|
||||||
|
ssl_context.verify_mode = ssl.CERT_NONE
|
||||||
|
|
||||||
|
# 使用自定义SSL上下文重试请求
|
||||||
|
session = requests.Session()
|
||||||
|
session.verify = False
|
||||||
|
response = session.post(
|
||||||
|
self.config.get_api_url("activate"),
|
||||||
|
**request_kwargs
|
||||||
|
)
|
||||||
|
|
||||||
result = response.json()
|
result = response.json()
|
||||||
|
# 激活成功
|
||||||
if result["code"] == 200:
|
if result["code"] == 200:
|
||||||
api_data = result["data"]
|
api_data = result["data"]
|
||||||
# 构造标准的返回数据结构
|
# 构造标准的返回数据结构
|
||||||
@@ -184,29 +211,35 @@ class AccountSwitcher:
|
|||||||
"device_info": self.get_device_info()
|
"device_info": self.get_device_info()
|
||||||
}
|
}
|
||||||
return True, result["msg"], account_info
|
return True, result["msg"], account_info
|
||||||
return False, result["msg"], {
|
# 激活码无效或已被使用
|
||||||
"status": "inactive",
|
elif result["code"] == 400:
|
||||||
"expire_time": "",
|
logging.warning(f"激活码无效或已被使用: {result.get('msg', '未知错误')}")
|
||||||
"total_days": 0,
|
return False, result.get("msg", "激活码无效或已被使用"), None
|
||||||
"days_left": 0,
|
# 其他错误情况
|
||||||
"device_info": self.get_device_info()
|
else:
|
||||||
}
|
logging.error(f"激活失败: {result.get('msg', '未知错误')}")
|
||||||
|
return False, result["msg"], None # 返回 None 而不是空的账号信息
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return False, f"激活失败: {str(e)}", {
|
logging.error(f"激活失败: {str(e)}")
|
||||||
"status": "inactive",
|
return False, f"激活失败: {str(e)}", None # 返回 None 而不是空的账号信息
|
||||||
"expire_time": "",
|
|
||||||
"total_days": 0,
|
|
||||||
"days_left": 0,
|
|
||||||
"device_info": self.get_device_info()
|
|
||||||
}
|
|
||||||
|
|
||||||
def reset_machine_id(self) -> bool:
|
def reset_machine_id(self) -> bool:
|
||||||
"""重置机器码"""
|
"""重置机器码"""
|
||||||
try:
|
try:
|
||||||
# 1. 先关闭所有Cursor进程
|
# 1. 先关闭所有Cursor进程
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
os.system("taskkill /f /im Cursor.exe >nul 2>&1")
|
# 创建startupinfo对象来隐藏命令行窗口
|
||||||
|
startupinfo = subprocess.STARTUPINFO()
|
||||||
|
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||||
|
startupinfo.wShowWindow = subprocess.SW_HIDE
|
||||||
|
|
||||||
|
# 使用subprocess.run来执行命令,并隐藏窗口
|
||||||
|
subprocess.run(
|
||||||
|
"taskkill /f /im Cursor.exe >nul 2>&1",
|
||||||
|
startupinfo=startupinfo,
|
||||||
|
shell=True
|
||||||
|
)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
# 2. 清理注册表(包括更新系统 MachineGuid)
|
# 2. 清理注册表(包括更新系统 MachineGuid)
|
||||||
@@ -261,7 +294,17 @@ class AccountSwitcher:
|
|||||||
try:
|
try:
|
||||||
# 1. 先关闭所有Cursor进程
|
# 1. 先关闭所有Cursor进程
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
os.system("taskkill /f /im Cursor.exe >nul 2>&1")
|
# 创建startupinfo对象来隐藏命令行窗口
|
||||||
|
startupinfo = subprocess.STARTUPINFO()
|
||||||
|
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||||
|
startupinfo.wShowWindow = subprocess.SW_HIDE
|
||||||
|
|
||||||
|
# 关闭Cursor
|
||||||
|
subprocess.run(
|
||||||
|
"taskkill /f /im Cursor.exe >nul 2>&1",
|
||||||
|
startupinfo=startupinfo,
|
||||||
|
shell=True
|
||||||
|
)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
# 2. 重置机器码
|
# 2. 重置机器码
|
||||||
@@ -310,28 +353,38 @@ class AccountSwitcher:
|
|||||||
|
|
||||||
api_url = self.config.get_api_url("status")
|
api_url = self.config.get_api_url("status")
|
||||||
logging.info(f"正在检查会员状态...")
|
logging.info(f"正在检查会员状态...")
|
||||||
logging.info(f"API URL: {api_url}")
|
|
||||||
logging.info(f"请求数据: {data}")
|
|
||||||
|
|
||||||
response = requests.post(
|
# 设置请求参数
|
||||||
api_url,
|
request_kwargs = {
|
||||||
json=data,
|
"json": data,
|
||||||
headers={"Content-Type": "application/json"},
|
"headers": {"Content-Type": "application/json"},
|
||||||
timeout=10
|
"timeout": 2, # 减少超时时间到2秒
|
||||||
)
|
"verify": False
|
||||||
|
}
|
||||||
|
|
||||||
|
# 使用session来复用连接
|
||||||
|
session = requests.Session()
|
||||||
|
session.verify = False
|
||||||
|
|
||||||
|
# 尝试发送请求
|
||||||
|
try:
|
||||||
|
response = session.post(api_url, **request_kwargs)
|
||||||
|
except requests.exceptions.Timeout:
|
||||||
|
# 超时后快速重试一次
|
||||||
|
logging.warning("首次请求超时,正在重试...")
|
||||||
|
response = session.post(api_url, **request_kwargs)
|
||||||
|
|
||||||
result = response.json()
|
result = response.json()
|
||||||
logging.info(f"状态检查响应: {result}")
|
logging.info(f"状态检查响应: {result}")
|
||||||
|
|
||||||
if result.get("code") in [1, 200]: # 兼容两种响应码
|
if result.get("code") in [1, 200]:
|
||||||
api_data = result.get("data", {})
|
api_data = result.get("data", {})
|
||||||
# 构造标准的返回数据结构
|
|
||||||
return {
|
return {
|
||||||
"status": api_data.get("status", "inactive"),
|
"status": api_data.get("status", "inactive"),
|
||||||
"expire_time": api_data.get("expire_time", ""),
|
"expire_time": api_data.get("expire_time", ""),
|
||||||
"total_days": api_data.get("total_days", 0),
|
"total_days": api_data.get("total_days", 0),
|
||||||
"days_left": api_data.get("days_left", 0),
|
"days_left": api_data.get("days_left", 0),
|
||||||
"device_info": self.get_device_info() # 添加设备信息
|
"device_info": self.get_device_info()
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
error_msg = result.get("msg", "未知错误")
|
error_msg = result.get("msg", "未知错误")
|
||||||
@@ -373,9 +426,19 @@ class AccountSwitcher:
|
|||||||
logging.info("正在重启Cursor...")
|
logging.info("正在重启Cursor...")
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
# Windows系统
|
# Windows系统
|
||||||
|
# 创建startupinfo对象来隐藏命令行窗口
|
||||||
|
startupinfo = subprocess.STARTUPINFO()
|
||||||
|
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||||
|
startupinfo.wShowWindow = subprocess.SW_HIDE
|
||||||
|
|
||||||
# 关闭Cursor
|
# 关闭Cursor
|
||||||
os.system("taskkill /f /im Cursor.exe 2>nul")
|
subprocess.run(
|
||||||
|
"taskkill /f /im Cursor.exe 2>nul",
|
||||||
|
startupinfo=startupinfo,
|
||||||
|
shell=True
|
||||||
|
)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
# 获取Cursor安装路径
|
# 获取Cursor安装路径
|
||||||
cursor_exe = self.cursor_path / "Cursor.exe"
|
cursor_exe = self.cursor_path / "Cursor.exe"
|
||||||
if cursor_exe.exists():
|
if cursor_exe.exists():
|
||||||
@@ -388,16 +451,16 @@ class AccountSwitcher:
|
|||||||
return False
|
return False
|
||||||
elif sys.platform == "darwin":
|
elif sys.platform == "darwin":
|
||||||
# macOS系统
|
# macOS系统
|
||||||
os.system("killall Cursor 2>/dev/null")
|
subprocess.run("killall Cursor 2>/dev/null", shell=True)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
os.system("open -a Cursor")
|
subprocess.run("open -a Cursor", shell=True)
|
||||||
logging.info("Cursor重启成功")
|
logging.info("Cursor重启成功")
|
||||||
return True
|
return True
|
||||||
elif sys.platform == "linux":
|
elif sys.platform == "linux":
|
||||||
# Linux系统
|
# Linux系统
|
||||||
os.system("pkill -f cursor")
|
subprocess.run("pkill -f cursor", shell=True)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
os.system("cursor &")
|
subprocess.run("cursor &", shell=True)
|
||||||
logging.info("Cursor重启成功")
|
logging.info("Cursor重启成功")
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
@@ -414,12 +477,7 @@ class AccountSwitcher:
|
|||||||
Tuple[bool, str]: (是否成功, 提示消息)
|
Tuple[bool, str]: (是否成功, 提示消息)
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
# 1. 先关闭所有Cursor进程
|
# 1. 获取未使用的账号
|
||||||
if sys.platform == "win32":
|
|
||||||
os.system("taskkill /f /im Cursor.exe >nul 2>&1")
|
|
||||||
time.sleep(2)
|
|
||||||
|
|
||||||
# 2. 获取未使用的账号
|
|
||||||
endpoint = "https://cursorapi.nosqli.com/admin/api.account/getUnused"
|
endpoint = "https://cursorapi.nosqli.com/admin/api.account/getUnused"
|
||||||
data = {
|
data = {
|
||||||
"machine_id": self.hardware_id
|
"machine_id": self.hardware_id
|
||||||
@@ -428,17 +486,33 @@ class AccountSwitcher:
|
|||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 禁用SSL警告
|
||||||
|
import urllib3
|
||||||
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||||
|
|
||||||
|
# 设置请求参数
|
||||||
|
request_kwargs = {
|
||||||
|
"json": data,
|
||||||
|
"headers": headers,
|
||||||
|
"timeout": 30, # 增加超时时间
|
||||||
|
"verify": False # 禁用SSL验证
|
||||||
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# 添加SSL验证选项和超时设置
|
# 尝试发送请求
|
||||||
response = requests.post(
|
try:
|
||||||
endpoint,
|
response = requests.post(endpoint, **request_kwargs)
|
||||||
json=data,
|
except requests.exceptions.SSLError:
|
||||||
headers=headers,
|
# 如果发生SSL错误,创建自定义SSL上下文
|
||||||
timeout=30, # 增加超时时间
|
import ssl
|
||||||
verify=False, # 禁用SSL验证
|
ssl_context = ssl.create_default_context()
|
||||||
)
|
ssl_context.check_hostname = False
|
||||||
# 禁用SSL警告
|
ssl_context.verify_mode = ssl.CERT_NONE
|
||||||
requests.packages.urllib3.disable_warnings()
|
|
||||||
|
# 使用自定义SSL上下文重试请求
|
||||||
|
session = requests.Session()
|
||||||
|
session.verify = False
|
||||||
|
response = session.post(endpoint, **request_kwargs)
|
||||||
|
|
||||||
response_data = response.json()
|
response_data = response.json()
|
||||||
|
|
||||||
@@ -455,11 +529,26 @@ class AccountSwitcher:
|
|||||||
if not all([email, access_token, refresh_token]):
|
if not all([email, access_token, refresh_token]):
|
||||||
return False, "获取账号信息不完整"
|
return False, "获取账号信息不完整"
|
||||||
|
|
||||||
|
# 2. 先关闭Cursor进程
|
||||||
|
if sys.platform == "win32":
|
||||||
|
# 创建startupinfo对象来隐藏命令行窗口
|
||||||
|
startupinfo = subprocess.STARTUPINFO()
|
||||||
|
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||||
|
startupinfo.wShowWindow = subprocess.SW_HIDE
|
||||||
|
|
||||||
|
# 使用subprocess.run来执行命令,并隐藏窗口
|
||||||
|
subprocess.run(
|
||||||
|
"taskkill /f /im Cursor.exe >nul 2>&1",
|
||||||
|
startupinfo=startupinfo,
|
||||||
|
shell=True
|
||||||
|
)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
# 3. 更新Cursor认证信息
|
# 3. 更新Cursor认证信息
|
||||||
if not self.auth_manager.update_auth(email, access_token, refresh_token):
|
if not self.auth_manager.update_auth(email, access_token, refresh_token):
|
||||||
return False, "更新Cursor认证信息失败"
|
return False, "更新Cursor认证信息失败"
|
||||||
|
|
||||||
# 4. 重置机器码(包含了清理注册表、文件和重启操作)
|
# 4. 重置机器码(使用现有的reset_machine_id方法)
|
||||||
if not self.reset_machine_id():
|
if not self.reset_machine_id():
|
||||||
return False, "重置机器码失败"
|
return False, "重置机器码失败"
|
||||||
|
|
||||||
@@ -497,7 +586,17 @@ class AccountSwitcher:
|
|||||||
try:
|
try:
|
||||||
# 1. 先关闭所有Cursor进程
|
# 1. 先关闭所有Cursor进程
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
os.system("taskkill /f /im Cursor.exe >nul 2>&1")
|
# 创建startupinfo对象来隐藏命令行窗口
|
||||||
|
startupinfo = subprocess.STARTUPINFO()
|
||||||
|
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||||
|
startupinfo.wShowWindow = subprocess.SW_HIDE
|
||||||
|
|
||||||
|
# 关闭Cursor
|
||||||
|
subprocess.run(
|
||||||
|
"taskkill /f /im Cursor.exe >nul 2>&1",
|
||||||
|
startupinfo=startupinfo,
|
||||||
|
shell=True
|
||||||
|
)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
# 2. 删除updater目录并创建同名文件以阻止更新
|
# 2. 删除updater目录并创建同名文件以阻止更新
|
||||||
|
|||||||
BIN
banbenjietu.png
Normal file
BIN
banbenjietu.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
53
build.bat
53
build.bat
@@ -5,8 +5,61 @@ echo 开始打包流程...
|
|||||||
:: 更新版本号
|
:: 更新版本号
|
||||||
python update_version.py
|
python update_version.py
|
||||||
|
|
||||||
|
:: 读取版本号
|
||||||
|
set /p VERSION=<version.txt
|
||||||
|
echo 当前版本: %VERSION%
|
||||||
|
|
||||||
|
:: 提取主版本号和次版本号 (3.4.4 -> 3.4)
|
||||||
|
for /f "tokens=1,2 delims=." %%a in ("%VERSION%") do (
|
||||||
|
set MAJOR_VERSION=%%a.%%b
|
||||||
|
)
|
||||||
|
echo 主版本目录: %MAJOR_VERSION%
|
||||||
|
|
||||||
|
:: 创建版本目录
|
||||||
|
set VERSION_DIR=dist\%MAJOR_VERSION%
|
||||||
|
if not exist "%VERSION_DIR%" (
|
||||||
|
mkdir "%VERSION_DIR%"
|
||||||
|
echo 创建目录: %VERSION_DIR%
|
||||||
|
)
|
||||||
|
|
||||||
:: 使用新的spec文件进行打包
|
:: 使用新的spec文件进行打包
|
||||||
pyinstaller --noconfirm build_nezha.spec
|
pyinstaller --noconfirm build_nezha.spec
|
||||||
|
|
||||||
|
:: 检查源文件是否存在
|
||||||
|
echo 检查文件: dist\听泉cursor助手%VERSION%.exe
|
||||||
|
if not exist "dist\听泉cursor助手%VERSION%.exe" (
|
||||||
|
echo 错误: 打包后的文件不存在
|
||||||
|
echo 预期文件路径: dist\听泉cursor助手%VERSION%.exe
|
||||||
|
dir /b dist
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
:: 检查目标目录是否存在
|
||||||
|
echo 检查目标目录: %VERSION_DIR%
|
||||||
|
if not exist "%VERSION_DIR%" (
|
||||||
|
echo 错误: 目标目录不存在
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
:: 移动文件到版本目录
|
||||||
|
echo 移动文件:
|
||||||
|
echo 源文件: dist\听泉cursor助手%VERSION%.exe
|
||||||
|
echo 目标文件: %VERSION_DIR%\听泉cursor助手v%VERSION%.exe
|
||||||
|
move "dist\听泉cursor助手%VERSION%.exe" "%VERSION_DIR%\听泉cursor助手v%VERSION%.exe"
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo 移动文件失败,请检查:
|
||||||
|
echo 1. 源文件是否存在: dist\听泉cursor助手%VERSION%.exe
|
||||||
|
echo 2. 目标目录是否可写: %VERSION_DIR%
|
||||||
|
echo 3. 目标文件是否已存在: %VERSION_DIR%\听泉cursor助手v%VERSION%.exe
|
||||||
|
dir /b dist
|
||||||
|
dir /b "%VERSION_DIR%"
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
echo.
|
||||||
echo 打包完成!
|
echo 打包完成!
|
||||||
|
echo 文件保存在: %VERSION_DIR%\听泉cursor助手v%VERSION%.exe
|
||||||
pause
|
pause
|
||||||
@@ -5,6 +5,7 @@ import time
|
|||||||
import logging
|
import logging
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import subprocess
|
||||||
|
|
||||||
class CursorAuthManager:
|
class CursorAuthManager:
|
||||||
"""Cursor认证信息管理器"""
|
"""Cursor认证信息管理器"""
|
||||||
@@ -99,9 +100,19 @@ class CursorAuthManager:
|
|||||||
logging.info("正在重启Cursor...")
|
logging.info("正在重启Cursor...")
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
# Windows系统
|
# Windows系统
|
||||||
|
# 创建startupinfo对象来隐藏命令行窗口
|
||||||
|
startupinfo = subprocess.STARTUPINFO()
|
||||||
|
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||||
|
startupinfo.wShowWindow = subprocess.SW_HIDE
|
||||||
|
|
||||||
# 关闭Cursor
|
# 关闭Cursor
|
||||||
os.system("taskkill /f /im Cursor.exe 2>nul")
|
subprocess.run(
|
||||||
|
"taskkill /f /im Cursor.exe 2>nul",
|
||||||
|
startupinfo=startupinfo,
|
||||||
|
shell=True
|
||||||
|
)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
# 获取Cursor安装路径
|
# 获取Cursor安装路径
|
||||||
cursor_exe = self.cursor_path / "Cursor.exe"
|
cursor_exe = self.cursor_path / "Cursor.exe"
|
||||||
if cursor_exe.exists():
|
if cursor_exe.exists():
|
||||||
@@ -114,16 +125,16 @@ class CursorAuthManager:
|
|||||||
return False
|
return False
|
||||||
elif sys.platform == "darwin":
|
elif sys.platform == "darwin":
|
||||||
# macOS系统
|
# macOS系统
|
||||||
os.system("killall Cursor 2>/dev/null")
|
subprocess.run("killall Cursor 2>/dev/null", shell=True)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
os.system("open -a Cursor")
|
subprocess.run("open -a Cursor", shell=True)
|
||||||
logging.info("Cursor重启成功")
|
logging.info("Cursor重启成功")
|
||||||
return True
|
return True
|
||||||
elif sys.platform == "linux":
|
elif sys.platform == "linux":
|
||||||
# Linux系统
|
# Linux系统
|
||||||
os.system("pkill -f cursor")
|
subprocess.run("pkill -f cursor", shell=True)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
os.system("cursor &")
|
subprocess.run("cursor &", shell=True)
|
||||||
logging.info("Cursor重启成功")
|
logging.info("Cursor重启成功")
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
|||||||
1066
gui/main_window.py
1066
gui/main_window.py
File diff suppressed because it is too large
Load Diff
21
main.py
21
main.py
@@ -5,12 +5,17 @@ import os
|
|||||||
import atexit
|
import atexit
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import urllib3
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from PyQt5.QtWidgets import QApplication, QMessageBox, QSystemTrayIcon, QMenu
|
from PyQt5.QtWidgets import QApplication, QMessageBox, QSystemTrayIcon, QMenu
|
||||||
from PyQt5.QtGui import QIcon
|
from PyQt5.QtGui import QIcon
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
from gui.main_window import MainWindow
|
from gui.main_window import MainWindow
|
||||||
|
|
||||||
|
# 禁用所有 SSL 相关警告
|
||||||
|
urllib3.disable_warnings()
|
||||||
|
logging.getLogger('urllib3').setLevel(logging.ERROR)
|
||||||
|
|
||||||
def cleanup_temp():
|
def cleanup_temp():
|
||||||
"""清理临时文件"""
|
"""清理临时文件"""
|
||||||
try:
|
try:
|
||||||
@@ -55,6 +60,15 @@ def main():
|
|||||||
# 创建QApplication实例
|
# 创建QApplication实例
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
|
|
||||||
|
# 检查系统托盘是否可用
|
||||||
|
if not QSystemTrayIcon.isSystemTrayAvailable():
|
||||||
|
logging.error("系统托盘不可用")
|
||||||
|
QMessageBox.critical(None, "错误", "系统托盘不可用,程序无法正常运行。")
|
||||||
|
return 1
|
||||||
|
|
||||||
|
# 设置应用程序不会在最后一个窗口关闭时退出
|
||||||
|
app.setQuitOnLastWindowClosed(False)
|
||||||
|
|
||||||
setup_logging()
|
setup_logging()
|
||||||
|
|
||||||
# 检查Python版本
|
# 检查Python版本
|
||||||
@@ -98,7 +112,8 @@ def main():
|
|||||||
|
|
||||||
logging.info("正在启动主窗口...")
|
logging.info("正在启动主窗口...")
|
||||||
window.show()
|
window.show()
|
||||||
sys.exit(app.exec_())
|
|
||||||
|
return app.exec_()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_msg = f"程序运行出错: {str(e)}\n{traceback.format_exc()}"
|
error_msg = f"程序运行出错: {str(e)}\n{traceback.format_exc()}"
|
||||||
@@ -107,7 +122,7 @@ def main():
|
|||||||
if QApplication.instance() is None:
|
if QApplication.instance() is None:
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
QMessageBox.critical(None, "错误", error_msg)
|
QMessageBox.critical(None, "错误", error_msg)
|
||||||
sys.exit(1)
|
return 1
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
sys.exit(main())
|
||||||
@@ -7,4 +7,5 @@ altgraph>=0.17.4
|
|||||||
pyinstaller==6.3.0
|
pyinstaller==6.3.0
|
||||||
pillow==10.2.0
|
pillow==10.2.0
|
||||||
PyQt5==5.15.10
|
PyQt5==5.15.10
|
||||||
pywin32==306
|
pywin32==306
|
||||||
|
packaging>=23.2
|
||||||
63
test_version_manager.py
Normal file
63
test_version_manager.py
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
import logging
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
from utils.version_manager import VersionManager
|
||||||
|
|
||||||
|
# 配置日志
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s',
|
||||||
|
handlers=[
|
||||||
|
logging.StreamHandler(sys.stdout),
|
||||||
|
logging.FileHandler('version_check.log')
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_version_manager():
|
||||||
|
"""测试版本管理器功能"""
|
||||||
|
try:
|
||||||
|
vm = VersionManager()
|
||||||
|
logging.info(f"当前版本: {vm.current_version}")
|
||||||
|
logging.info(f"当前平台: {vm.platform}")
|
||||||
|
|
||||||
|
# 测试获取最新版本
|
||||||
|
logging.info("\n=== 测试获取最新版本 ===")
|
||||||
|
latest = vm.get_latest_version()
|
||||||
|
logging.info(f"最新版本信息: {latest}")
|
||||||
|
|
||||||
|
# 测试检查更新
|
||||||
|
logging.info("\n=== 测试检查更新 ===")
|
||||||
|
update_info = vm.check_update()
|
||||||
|
logging.info(f"更新检查结果: {update_info}")
|
||||||
|
|
||||||
|
# 测试是否需要更新
|
||||||
|
logging.info("\n=== 测试是否需要更新 ===")
|
||||||
|
has_update, is_force, version_info = vm.needs_update()
|
||||||
|
logging.info(f"是否有更新: {has_update}")
|
||||||
|
logging.info(f"是否强制更新: {is_force}")
|
||||||
|
logging.info(f"版本信息: {version_info}")
|
||||||
|
|
||||||
|
# 如果有更新,测试下载功能
|
||||||
|
if has_update and version_info:
|
||||||
|
logging.info("\n=== 测试下载更新 ===")
|
||||||
|
download_url = version_info.get('download_url')
|
||||||
|
if download_url:
|
||||||
|
save_path = Path.home() / "Downloads" / "CursorHelper" / "test_update.exe"
|
||||||
|
save_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
logging.info(f"下载地址: {download_url}")
|
||||||
|
logging.info(f"保存路径: {save_path}")
|
||||||
|
|
||||||
|
success = vm.download_update(download_url, str(save_path))
|
||||||
|
logging.info(f"下载结果: {'成功' if success else '失败'}")
|
||||||
|
|
||||||
|
if success:
|
||||||
|
logging.info(f"文件大小: {save_path.stat().st_size} 字节")
|
||||||
|
else:
|
||||||
|
logging.warning("未找到下载地址")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"测试过程中发生错误: {str(e)}", exc_info=True)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
test_version_manager()
|
||||||
84
testbuild.bat
Normal file
84
testbuild.bat
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
@echo off
|
||||||
|
chcp 65001 >nul
|
||||||
|
setlocal EnableDelayedExpansion
|
||||||
|
|
||||||
|
REM 激活虚拟环境
|
||||||
|
call venv\Scripts\activate.bat
|
||||||
|
|
||||||
|
REM 确保安装了必要的包
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
REM 读取当前版本号
|
||||||
|
set /p VERSION=<version.txt
|
||||||
|
echo 当前正式版本: %VERSION%
|
||||||
|
|
||||||
|
REM 提取主版本号和次版本号 (3.4.4 -> 3.4)
|
||||||
|
for /f "tokens=1,2 delims=." %%a in ("%VERSION%") do (
|
||||||
|
set MAJOR_VERSION=%%a.%%b
|
||||||
|
)
|
||||||
|
echo 主版本目录: %MAJOR_VERSION%
|
||||||
|
|
||||||
|
REM 读取测试版本号(如果存在)
|
||||||
|
if exist testversion.txt (
|
||||||
|
set /p TEST_VERSION=<testversion.txt
|
||||||
|
) else (
|
||||||
|
set TEST_VERSION=0
|
||||||
|
)
|
||||||
|
|
||||||
|
REM 增加测试版本号
|
||||||
|
set /a TEST_VERSION+=1
|
||||||
|
echo !TEST_VERSION!>testversion.txt
|
||||||
|
echo 测试版本号: !TEST_VERSION!
|
||||||
|
|
||||||
|
REM 组合完整版本号
|
||||||
|
set FULL_VERSION=%VERSION%.!TEST_VERSION!
|
||||||
|
echo 完整版本号: !FULL_VERSION!
|
||||||
|
|
||||||
|
REM 创建测试版本输出目录
|
||||||
|
set TEST_DIR=dist\test\%MAJOR_VERSION%
|
||||||
|
if not exist "!TEST_DIR!" (
|
||||||
|
mkdir "!TEST_DIR!"
|
||||||
|
echo 创建目录: !TEST_DIR!
|
||||||
|
)
|
||||||
|
|
||||||
|
REM 清理旧文件
|
||||||
|
if exist "dist\听泉cursor助手%VERSION%.exe" del "dist\听泉cursor助手%VERSION%.exe"
|
||||||
|
if exist "build" rmdir /s /q "build"
|
||||||
|
|
||||||
|
REM 执行打包
|
||||||
|
venv\Scripts\python.exe -m PyInstaller build_nezha.spec --clean
|
||||||
|
|
||||||
|
REM 检查源文件是否存在
|
||||||
|
echo 检查文件: dist\听泉cursor助手%VERSION%.exe
|
||||||
|
if not exist "dist\听泉cursor助手%VERSION%.exe" (
|
||||||
|
echo 错误: 打包后的文件不存在
|
||||||
|
echo 预期文件路径: dist\听泉cursor助手%VERSION%.exe
|
||||||
|
dir /b dist
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
REM 移动并重命名文件
|
||||||
|
echo 移动文件:
|
||||||
|
echo 源文件: dist\听泉cursor助手%VERSION%.exe
|
||||||
|
echo 目标文件: !TEST_DIR!\听泉cursor助手v!FULL_VERSION!.exe
|
||||||
|
move "dist\听泉cursor助手%VERSION%.exe" "!TEST_DIR!\听泉cursor助手v!FULL_VERSION!.exe"
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo 移动文件失败,请检查:
|
||||||
|
echo 1. 源文件是否存在: dist\听泉cursor助手%VERSION%.exe
|
||||||
|
echo 2. 目标目录是否可写: !TEST_DIR!
|
||||||
|
echo 3. 目标文件是否已存在: !TEST_DIR!\听泉cursor助手v!FULL_VERSION!.exe
|
||||||
|
dir /b dist
|
||||||
|
dir /b "!TEST_DIR!"
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo 测试版本构建完成!
|
||||||
|
echo 版本号: v!FULL_VERSION!
|
||||||
|
echo 文件位置: !TEST_DIR!\听泉cursor助手v!FULL_VERSION!.exe
|
||||||
|
|
||||||
|
REM 退出虚拟环境
|
||||||
|
deactivate
|
||||||
|
pause
|
||||||
303
utils/version_manager.py
Normal file
303
utils/version_manager.py
Normal file
@@ -0,0 +1,303 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import requests
|
||||||
|
from packaging import version
|
||||||
|
from typing import Optional, Dict, Any
|
||||||
|
import json
|
||||||
|
import logging
|
||||||
|
from urllib.parse import quote, unquote
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
class VersionManager:
|
||||||
|
"""版本管理器
|
||||||
|
|
||||||
|
错误码说明:
|
||||||
|
- 0: 成功
|
||||||
|
- 1: 一般性错误
|
||||||
|
- 401: 未授权或授权失败
|
||||||
|
- 404: 请求的资源不存在
|
||||||
|
- 500: 服务器内部错误
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.base_url = "https://cursorapi.nosqli.com"
|
||||||
|
# 获取项目根目录路径
|
||||||
|
self.root_path = Path(__file__).parent.parent
|
||||||
|
self.current_version = self._get_current_version()
|
||||||
|
self.platform = "windows" if sys.platform.startswith("win") else "mac" if sys.platform.startswith("darwin") else "linux"
|
||||||
|
|
||||||
|
def _get_current_version(self) -> str:
|
||||||
|
"""获取当前版本号"""
|
||||||
|
try:
|
||||||
|
version_file = self.root_path / "version.txt"
|
||||||
|
if not version_file.exists():
|
||||||
|
logging.error(f"版本文件不存在: {version_file}")
|
||||||
|
return "0.0.0"
|
||||||
|
|
||||||
|
with open(version_file, "r", encoding="utf-8") as f:
|
||||||
|
version = f.read().strip()
|
||||||
|
logging.info(f"当前版本: {version}")
|
||||||
|
return version
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"读取版本号失败: {str(e)}")
|
||||||
|
return "0.0.0"
|
||||||
|
|
||||||
|
def _handle_response(self, response: requests.Response) -> Dict[str, Any]:
|
||||||
|
"""处理API响应
|
||||||
|
|
||||||
|
Args:
|
||||||
|
response: API响应对象
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Dict[str, Any]: 处理后的响应数据
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
Exception: API调用失败时抛出异常
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
data = response.json()
|
||||||
|
code = data.get("code")
|
||||||
|
msg = data.get("msg") or data.get("info", "未知错误") # 兼容 info 字段
|
||||||
|
|
||||||
|
if code == 0 or code == 1: # 兼容 code=1 的情况
|
||||||
|
# 处理空数据情况
|
||||||
|
if not data.get("data"):
|
||||||
|
logging.warning("API返回空数据")
|
||||||
|
return {
|
||||||
|
"code": 0,
|
||||||
|
"msg": msg,
|
||||||
|
"data": {
|
||||||
|
"has_update": False,
|
||||||
|
"is_force": False,
|
||||||
|
"version_info": None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
"code": 0, # 统一返回 code=0
|
||||||
|
"msg": msg,
|
||||||
|
"data": data.get("data")
|
||||||
|
}
|
||||||
|
elif code == 401:
|
||||||
|
raise Exception("未授权或授权失败")
|
||||||
|
elif code == 404:
|
||||||
|
raise Exception("请求的资源不存在")
|
||||||
|
elif code == 500:
|
||||||
|
raise Exception("服务器内部错误")
|
||||||
|
else:
|
||||||
|
raise Exception(msg)
|
||||||
|
|
||||||
|
except requests.exceptions.JSONDecodeError:
|
||||||
|
raise Exception("服务器响应格式错误")
|
||||||
|
|
||||||
|
def check_update(self) -> Dict[str, Any]:
|
||||||
|
"""检查是否有更新"""
|
||||||
|
try:
|
||||||
|
url = f"{self.base_url}/admin/api.version/check"
|
||||||
|
current_version = self.current_version.lstrip('v') # 移除可能存在的v前缀
|
||||||
|
|
||||||
|
params = {
|
||||||
|
"version": current_version,
|
||||||
|
"platform": self.platform
|
||||||
|
}
|
||||||
|
logging.info(f"正在请求: {url}")
|
||||||
|
logging.info(f"参数: {params}")
|
||||||
|
|
||||||
|
response = requests.get(
|
||||||
|
url,
|
||||||
|
params=params,
|
||||||
|
timeout=10
|
||||||
|
)
|
||||||
|
|
||||||
|
logging.info(f"状态码: {response.status_code}")
|
||||||
|
logging.info(f"响应头: {dict(response.headers)}")
|
||||||
|
logging.info(f"响应内容: {response.text}")
|
||||||
|
|
||||||
|
result = self._handle_response(response)
|
||||||
|
|
||||||
|
# 确保返回的数据包含版本信息
|
||||||
|
if result["code"] == 0 and result.get("data"):
|
||||||
|
data = result["data"]
|
||||||
|
if "version_info" in data:
|
||||||
|
version_info = data["version_info"]
|
||||||
|
# 确保版本号格式一致
|
||||||
|
if "version_no" in version_info:
|
||||||
|
version_info["version_no"] = version_info["version_no"].lstrip('v')
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
except requests.exceptions.Timeout:
|
||||||
|
logging.error("检查更新超时")
|
||||||
|
return {"code": -1, "msg": "请求超时,请检查网络连接", "data": None}
|
||||||
|
except requests.exceptions.ConnectionError as e:
|
||||||
|
logging.error(f"检查更新连接失败: {str(e)}")
|
||||||
|
return {"code": -1, "msg": "连接服务器失败,请检查网络连接", "data": None}
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"检查更新失败: {str(e)}")
|
||||||
|
return {"code": -1, "msg": str(e), "data": None}
|
||||||
|
|
||||||
|
def get_latest_version(self) -> Dict[str, Any]:
|
||||||
|
"""获取最新版本信息"""
|
||||||
|
try:
|
||||||
|
url = f"{self.base_url}/admin/api.version/latest"
|
||||||
|
params = {"platform": self.platform}
|
||||||
|
logging.info(f"正在请求: {url}")
|
||||||
|
logging.info(f"参数: {params}")
|
||||||
|
|
||||||
|
response = requests.get(
|
||||||
|
url,
|
||||||
|
params=params,
|
||||||
|
timeout=10
|
||||||
|
)
|
||||||
|
|
||||||
|
logging.info(f"状态码: {response.status_code}")
|
||||||
|
logging.info(f"响应头: {dict(response.headers)}")
|
||||||
|
logging.info(f"响应内容: {response.text}")
|
||||||
|
|
||||||
|
return self._handle_response(response)
|
||||||
|
except requests.exceptions.Timeout:
|
||||||
|
logging.error("获取最新版本超时")
|
||||||
|
return {"code": -1, "msg": "请求超时,请检查网络连接", "data": None}
|
||||||
|
except requests.exceptions.ConnectionError as e:
|
||||||
|
logging.error(f"获取最新版本连接失败: {str(e)}")
|
||||||
|
return {"code": -1, "msg": "连接服务器失败,请检查网络连接", "data": None}
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"获取最新版本失败: {str(e)}")
|
||||||
|
return {"code": -1, "msg": str(e), "data": None}
|
||||||
|
|
||||||
|
def needs_update(self) -> tuple[bool, bool, Optional[Dict[str, Any]]]:
|
||||||
|
"""检查是否需要更新
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
tuple: (是否有更新, 是否强制更新, 版本信息)
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
result = self.check_update()
|
||||||
|
if result["code"] == 0 and result["data"]:
|
||||||
|
data = result["data"]
|
||||||
|
version_info = data.get("version_info", {})
|
||||||
|
|
||||||
|
# 比较版本号(移除v前缀)
|
||||||
|
current = self.current_version.lstrip('v')
|
||||||
|
latest = version_info.get("version_no", "0.0.0").lstrip('v')
|
||||||
|
|
||||||
|
# 使用packaging.version进行版本比较
|
||||||
|
has_update = version.parse(latest) > version.parse(current)
|
||||||
|
|
||||||
|
return (
|
||||||
|
has_update,
|
||||||
|
bool(data.get("is_force")),
|
||||||
|
version_info
|
||||||
|
)
|
||||||
|
return False, False, None
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"检查更新失败: {str(e)}")
|
||||||
|
return False, False, None
|
||||||
|
|
||||||
|
def download_update(self, download_url: str, save_path: str) -> tuple[bool, str]:
|
||||||
|
"""下载更新文件
|
||||||
|
|
||||||
|
Args:
|
||||||
|
download_url: 下载地址
|
||||||
|
save_path: 保存路径
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
tuple[bool, str]: (是否下载成功, 错误信息)
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
if not download_url:
|
||||||
|
error_msg = "下载地址为空,请联系管理员"
|
||||||
|
logging.error(error_msg)
|
||||||
|
return False, error_msg
|
||||||
|
|
||||||
|
# 处理下载地址中的中文字符
|
||||||
|
url_parts = download_url.split('/')
|
||||||
|
# 只对最后一部分(文件名)进行编码
|
||||||
|
url_parts[-1] = quote(url_parts[-1])
|
||||||
|
encoded_url = '/'.join(url_parts)
|
||||||
|
|
||||||
|
logging.info(f"原始下载地址: {download_url}")
|
||||||
|
logging.info(f"编码后的地址: {encoded_url}")
|
||||||
|
|
||||||
|
# 设置请求头,模拟浏览器行为
|
||||||
|
headers = {
|
||||||
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36',
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Connection': 'keep-alive'
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.get(
|
||||||
|
encoded_url,
|
||||||
|
stream=True,
|
||||||
|
headers=headers,
|
||||||
|
timeout=30 # 增加下载超时时间
|
||||||
|
)
|
||||||
|
|
||||||
|
# 检查响应状态
|
||||||
|
if response.status_code == 404:
|
||||||
|
error_msg = "下载地址无效,请联系管理员更新下载地址"
|
||||||
|
logging.error(error_msg)
|
||||||
|
return False, error_msg
|
||||||
|
|
||||||
|
response.raise_for_status()
|
||||||
|
|
||||||
|
total_size = int(response.headers.get('content-length', 0))
|
||||||
|
if total_size == 0:
|
||||||
|
error_msg = "无法获取文件大小,下载地址可能无效,请联系管理员"
|
||||||
|
logging.error(error_msg)
|
||||||
|
return False, error_msg
|
||||||
|
|
||||||
|
block_size = 8192
|
||||||
|
downloaded_size = 0
|
||||||
|
|
||||||
|
logging.info(f"开始下载文件,总大小: {total_size} 字节")
|
||||||
|
|
||||||
|
with open(save_path, 'wb') as f:
|
||||||
|
for chunk in response.iter_content(chunk_size=block_size):
|
||||||
|
if chunk:
|
||||||
|
f.write(chunk)
|
||||||
|
downloaded_size += len(chunk)
|
||||||
|
# 打印下载进度
|
||||||
|
if total_size > 0:
|
||||||
|
progress = (downloaded_size / total_size) * 100
|
||||||
|
logging.info(f"下载进度: {progress:.2f}%")
|
||||||
|
|
||||||
|
# 验证文件大小
|
||||||
|
actual_size = os.path.getsize(save_path)
|
||||||
|
if actual_size != total_size:
|
||||||
|
error_msg = f"文件下载不完整: 预期{total_size}字节,实际{actual_size}字节,请重试或联系管理员"
|
||||||
|
logging.error(error_msg)
|
||||||
|
# 删除不完整文件
|
||||||
|
try:
|
||||||
|
os.remove(save_path)
|
||||||
|
logging.info(f"已删除不完整的下载文件: {save_path}")
|
||||||
|
except Exception as clean_e:
|
||||||
|
logging.error(f"清理不完整文件失败: {str(clean_e)}")
|
||||||
|
return False, error_msg
|
||||||
|
|
||||||
|
logging.info(f"文件下载完成: {save_path}")
|
||||||
|
return True, "下载成功"
|
||||||
|
|
||||||
|
except requests.exceptions.Timeout:
|
||||||
|
error_msg = "下载超时,请检查网络连接后重试"
|
||||||
|
logging.error(error_msg)
|
||||||
|
return False, error_msg
|
||||||
|
except requests.exceptions.ConnectionError as e:
|
||||||
|
error_msg = "下载连接失败,请检查网络连接后重试"
|
||||||
|
logging.error(f"{error_msg}: {str(e)}")
|
||||||
|
return False, error_msg
|
||||||
|
except requests.exceptions.HTTPError as e:
|
||||||
|
error_msg = f"下载地址无效或服务器错误,请联系管理员 (HTTP {e.response.status_code})"
|
||||||
|
logging.error(error_msg)
|
||||||
|
return False, error_msg
|
||||||
|
except Exception as e:
|
||||||
|
error_msg = f"下载失败,请联系管理员: {str(e)}"
|
||||||
|
logging.error(error_msg)
|
||||||
|
# 如果下载失败,删除可能存在的不完整文件
|
||||||
|
try:
|
||||||
|
if os.path.exists(save_path):
|
||||||
|
os.remove(save_path)
|
||||||
|
logging.info(f"已删除不完整的下载文件: {save_path}")
|
||||||
|
except Exception as clean_e:
|
||||||
|
logging.error(f"清理不完整文件失败: {str(clean_e)}")
|
||||||
|
return False, error_msg
|
||||||
@@ -1 +1 @@
|
|||||||
3.3.9
|
3.4.5
|
||||||
127
version_check.log
Normal file
127
version_check.log
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
2025-02-13 13:30:48,255 - INFO - <20><>ǰ<EFBFBD>汾: 3.4.1
|
||||||
|
2025-02-13 13:30:48,255 - INFO - <20><>ǰƽ̨: windows
|
||||||
|
2025-02-13 13:30:48,255 - INFO -
|
||||||
|
=== <20><><EFBFBD>Ի<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>°汾 ===
|
||||||
|
2025-02-13 13:30:49,989 - INFO - <20><><EFBFBD>°汾<C2B0><E6B1BE>Ϣ: {'code': 0, 'info': '<27><><EFBFBD>ް汾<DEB0><E6B1BE>Ϣ', 'data': {}}
|
||||||
|
2025-02-13 13:30:49,989 - INFO -
|
||||||
|
=== <20><><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ===
|
||||||
|
2025-02-13 13:30:51,712 - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>: δ֪<CEB4><D6AA><EFBFBD><EFBFBD>
|
||||||
|
2025-02-13 13:30:51,713 - INFO - <20><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: {'code': -1, 'msg': 'δ֪<CEB4><D6AA><EFBFBD><EFBFBD>', 'data': None}
|
||||||
|
2025-02-13 13:30:51,713 - INFO -
|
||||||
|
=== <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD> ===
|
||||||
|
2025-02-13 13:30:53,394 - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>: δ֪<CEB4><D6AA><EFBFBD><EFBFBD>
|
||||||
|
2025-02-13 13:30:53,395 - INFO - <20>Ƿ<EFBFBD><C7B7>и<EFBFBD><D0B8><EFBFBD>: False
|
||||||
|
2025-02-13 13:30:53,395 - INFO - <20>Ƿ<EFBFBD>ǿ<EFBFBD>Ƹ<EFBFBD><C6B8><EFBFBD>: False
|
||||||
|
2025-02-13 13:30:53,395 - INFO - <20>汾<EFBFBD><E6B1BE>Ϣ: None
|
||||||
|
2025-02-13 13:49:13,952 - INFO - <20><>ǰ<EFBFBD>汾: 3.4.1
|
||||||
|
2025-02-13 13:49:13,952 - INFO - <20><>ǰƽ̨: windows
|
||||||
|
2025-02-13 13:49:13,952 - INFO -
|
||||||
|
=== <20><><EFBFBD>Ի<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>°汾 ===
|
||||||
|
2025-02-13 13:49:15,718 - ERROR - <20><>ȡ<EFBFBD><C8A1><EFBFBD>°汾ʧ<E6B1BE><CAA7>: δ֪<CEB4><D6AA><EFBFBD><EFBFBD>
|
||||||
|
2025-02-13 13:49:15,720 - INFO - <20><><EFBFBD>°汾<C2B0><E6B1BE>Ϣ: {'code': -1, 'msg': 'δ֪<CEB4><D6AA><EFBFBD><EFBFBD>', 'data': None}
|
||||||
|
2025-02-13 13:49:15,720 - INFO -
|
||||||
|
=== <20><><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ===
|
||||||
|
2025-02-13 13:49:17,452 - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>: δ֪<CEB4><D6AA><EFBFBD><EFBFBD>
|
||||||
|
2025-02-13 13:49:17,454 - INFO - <20><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: {'code': -1, 'msg': 'δ֪<CEB4><D6AA><EFBFBD><EFBFBD>', 'data': None}
|
||||||
|
2025-02-13 13:49:17,454 - INFO -
|
||||||
|
=== <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD> ===
|
||||||
|
2025-02-13 13:49:19,277 - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>: δ֪<CEB4><D6AA><EFBFBD><EFBFBD>
|
||||||
|
2025-02-13 13:49:19,278 - INFO - <20>Ƿ<EFBFBD><C7B7>и<EFBFBD><D0B8><EFBFBD>: False
|
||||||
|
2025-02-13 13:49:19,278 - INFO - <20>Ƿ<EFBFBD>ǿ<EFBFBD>Ƹ<EFBFBD><C6B8><EFBFBD>: False
|
||||||
|
2025-02-13 13:49:19,278 - INFO - <20>汾<EFBFBD><E6B1BE>Ϣ: None
|
||||||
|
2025-02-13 13:53:02,577 - INFO - <20><>ǰ<EFBFBD>汾: 3.4.1
|
||||||
|
2025-02-13 13:53:02,577 - INFO - <20><>ǰƽ̨: windows
|
||||||
|
2025-02-13 13:53:02,577 - INFO -
|
||||||
|
=== <20><><EFBFBD>Ի<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>°汾 ===
|
||||||
|
2025-02-13 13:53:02,578 - INFO - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: https://cursorapi.nosqli.com/admin/api.version/latest
|
||||||
|
2025-02-13 13:53:02,578 - INFO - <20><><EFBFBD><EFBFBD>: {'platform': 'windows'}
|
||||||
|
2025-02-13 13:53:04,292 - INFO - ״̬<D7B4><CCAC>: 200
|
||||||
|
2025-02-13 13:53:04,292 - INFO - <20><>Ӧͷ: {'Server': 'nginx', 'Date': 'Thu, 13 Feb 2025 05:53:02 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Vary': 'Accept-Encoding', 'X-Frame-Options': 'sameorigin', 'Set-Cookie': 'ssid=c6053c5e6170796bf1c5dde92415b981; path=/; secure; HttpOnly, lang=zh-cn; path=/; secure; HttpOnly', 'Strict-Transport-Security': 'max-age=31536000', 'Alt-Svc': 'quic=":443"; h3=":443"; h3-29=":443"; h3-27=":443";h3-25=":443"; h3-T050=":443"; h3-Q050=":443";h3-Q049=":443";h3-Q048=":443"; h3-Q046=":443"; h3-Q043=":443"', 'Content-Encoding': 'gzip'}
|
||||||
|
2025-02-13 13:53:04,292 - INFO - <20><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>: {"code":1,"info":"<22><>ȡ<EFBFBD>ɹ<EFBFBD>","data":{"id":1,"version_no":"3.4.1.4","version_name":"cursor<6F><72><EFBFBD><EFBFBD>","download_url":"https:\/\/cursorapi.nosqli.com\/upload\/<2F><>Ȫcursor<6F><72><EFBFBD><EFBFBD>v3.4.1.4.exe","is_force":0,"min_version":"","platform":"all","status":1,"description":"","create_time":"2025-02-13 13:32:35","update_time":"2025-02-13 13:32:35"}}
|
||||||
|
2025-02-13 13:53:04,292 - ERROR - <20><>ȡ<EFBFBD><C8A1><EFBFBD>°汾ʧ<E6B1BE><CAA7>: δ֪<CEB4><D6AA><EFBFBD><EFBFBD>
|
||||||
|
2025-02-13 13:53:04,294 - INFO - <20><><EFBFBD>°汾<C2B0><E6B1BE>Ϣ: {'code': -1, 'msg': 'δ֪<CEB4><D6AA><EFBFBD><EFBFBD>', 'data': None}
|
||||||
|
2025-02-13 13:53:04,294 - INFO -
|
||||||
|
=== <20><><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ===
|
||||||
|
2025-02-13 13:53:04,294 - INFO - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: https://cursorapi.nosqli.com/admin/api.version/check
|
||||||
|
2025-02-13 13:53:04,294 - INFO - <20><><EFBFBD><EFBFBD>: {'version': '3.4.1', 'platform': 'windows'}
|
||||||
|
2025-02-13 13:53:06,028 - INFO - ״̬<D7B4><CCAC>: 200
|
||||||
|
2025-02-13 13:53:06,028 - INFO - <20><>Ӧͷ: {'Server': 'nginx', 'Date': 'Thu, 13 Feb 2025 05:53:04 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Vary': 'Accept-Encoding', 'X-Frame-Options': 'sameorigin', 'Set-Cookie': 'ssid=cbb7943860ca50662d842719c53e7c73; path=/; secure; HttpOnly, lang=zh-cn; path=/; secure; HttpOnly', 'Strict-Transport-Security': 'max-age=31536000', 'Alt-Svc': 'quic=":443"; h3=":443"; h3-29=":443"; h3-27=":443";h3-25=":443"; h3-T050=":443"; h3-Q050=":443";h3-Q049=":443";h3-Q048=":443"; h3-Q046=":443"; h3-Q043=":443"', 'Content-Encoding': 'gzip'}
|
||||||
|
2025-02-13 13:53:06,028 - INFO - <20><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>: {"code":1,"info":"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>","data":{"has_update":true,"is_force":0,"version_info":{"id":1,"version_no":"3.4.1.4","version_name":"cursor<6F><72><EFBFBD><EFBFBD>","download_url":"https:\/\/cursorapi.nosqli.com\/upload\/<2F><>Ȫcursor<6F><72><EFBFBD><EFBFBD>v3.4.1.4.exe","is_force":0,"min_version":"","platform":"all","status":1,"description":"","create_time":"2025-02-13 13:32:35","update_time":"2025-02-13 13:32:35"}}}
|
||||||
|
2025-02-13 13:53:06,028 - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>: δ֪<CEB4><D6AA><EFBFBD><EFBFBD>
|
||||||
|
2025-02-13 13:53:06,029 - INFO - <20><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: {'code': -1, 'msg': 'δ֪<CEB4><D6AA><EFBFBD><EFBFBD>', 'data': None}
|
||||||
|
2025-02-13 13:53:06,029 - INFO -
|
||||||
|
=== <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD> ===
|
||||||
|
2025-02-13 13:53:06,029 - INFO - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: https://cursorapi.nosqli.com/admin/api.version/check
|
||||||
|
2025-02-13 13:53:06,029 - INFO - <20><><EFBFBD><EFBFBD>: {'version': '3.4.1', 'platform': 'windows'}
|
||||||
|
2025-02-13 13:53:07,770 - INFO - ״̬<D7B4><CCAC>: 200
|
||||||
|
2025-02-13 13:53:07,770 - INFO - <20><>Ӧͷ: {'Server': 'nginx', 'Date': 'Thu, 13 Feb 2025 05:53:05 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Vary': 'Accept-Encoding', 'X-Frame-Options': 'sameorigin', 'Set-Cookie': 'ssid=c8004bac4b2d4c5054b69dca0311d6f7; path=/; secure; HttpOnly, lang=zh-cn; path=/; secure; HttpOnly', 'Strict-Transport-Security': 'max-age=31536000', 'Alt-Svc': 'quic=":443"; h3=":443"; h3-29=":443"; h3-27=":443";h3-25=":443"; h3-T050=":443"; h3-Q050=":443";h3-Q049=":443";h3-Q048=":443"; h3-Q046=":443"; h3-Q043=":443"', 'Content-Encoding': 'gzip'}
|
||||||
|
2025-02-13 13:53:07,770 - INFO - <20><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>: {"code":1,"info":"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>","data":{"has_update":true,"is_force":0,"version_info":{"id":1,"version_no":"3.4.1.4","version_name":"cursor<6F><72><EFBFBD><EFBFBD>","download_url":"https:\/\/cursorapi.nosqli.com\/upload\/<2F><>Ȫcursor<6F><72><EFBFBD><EFBFBD>v3.4.1.4.exe","is_force":0,"min_version":"","platform":"all","status":1,"description":"","create_time":"2025-02-13 13:32:35","update_time":"2025-02-13 13:32:35"}}}
|
||||||
|
2025-02-13 13:53:07,771 - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>: δ֪<CEB4><D6AA><EFBFBD><EFBFBD>
|
||||||
|
2025-02-13 13:53:07,774 - INFO - <20>Ƿ<EFBFBD><C7B7>и<EFBFBD><D0B8><EFBFBD>: False
|
||||||
|
2025-02-13 13:53:07,774 - INFO - <20>Ƿ<EFBFBD>ǿ<EFBFBD>Ƹ<EFBFBD><C6B8><EFBFBD>: False
|
||||||
|
2025-02-13 13:53:07,774 - INFO - <20>汾<EFBFBD><E6B1BE>Ϣ: None
|
||||||
|
2025-02-13 13:53:33,800 - INFO - <20><>ǰ<EFBFBD>汾: 3.4.1
|
||||||
|
2025-02-13 13:53:33,801 - INFO - <20><>ǰƽ̨: windows
|
||||||
|
2025-02-13 13:53:33,801 - INFO -
|
||||||
|
=== <20><><EFBFBD>Ի<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>°汾 ===
|
||||||
|
2025-02-13 13:53:33,801 - INFO - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: https://cursorapi.nosqli.com/admin/api.version/latest
|
||||||
|
2025-02-13 13:53:33,801 - INFO - <20><><EFBFBD><EFBFBD>: {'platform': 'windows'}
|
||||||
|
2025-02-13 13:53:35,509 - INFO - ״̬<D7B4><CCAC>: 200
|
||||||
|
2025-02-13 13:53:35,510 - INFO - <20><>Ӧͷ: {'Server': 'nginx', 'Date': 'Thu, 13 Feb 2025 05:53:33 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Vary': 'Accept-Encoding', 'X-Frame-Options': 'sameorigin', 'Set-Cookie': 'ssid=16d07427624c6aaf6c89254d173fe273; path=/; secure; HttpOnly, lang=zh-cn; path=/; secure; HttpOnly', 'Strict-Transport-Security': 'max-age=31536000', 'Alt-Svc': 'quic=":443"; h3=":443"; h3-29=":443"; h3-27=":443";h3-25=":443"; h3-T050=":443"; h3-Q050=":443";h3-Q049=":443";h3-Q048=":443"; h3-Q046=":443"; h3-Q043=":443"', 'Content-Encoding': 'gzip'}
|
||||||
|
2025-02-13 13:53:35,510 - INFO - <20><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>: {"code":1,"info":"<22><>ȡ<EFBFBD>ɹ<EFBFBD>","data":{"id":1,"version_no":"3.4.1.4","version_name":"cursor<6F><72><EFBFBD><EFBFBD>","download_url":"https:\/\/cursorapi.nosqli.com\/upload\/<2F><>Ȫcursor<6F><72><EFBFBD><EFBFBD>v3.4.1.4.exe","is_force":0,"min_version":"","platform":"all","status":1,"description":"","create_time":"2025-02-13 13:32:35","update_time":"2025-02-13 13:32:35"}}
|
||||||
|
2025-02-13 13:53:35,510 - ERROR - <20><>ȡ<EFBFBD><C8A1><EFBFBD>°汾ʧ<E6B1BE><CAA7>: δ֪<CEB4><D6AA><EFBFBD><EFBFBD>
|
||||||
|
2025-02-13 13:53:35,513 - INFO - <20><><EFBFBD>°汾<C2B0><E6B1BE>Ϣ: {'code': -1, 'msg': 'δ֪<CEB4><D6AA><EFBFBD><EFBFBD>', 'data': None}
|
||||||
|
2025-02-13 13:53:35,513 - INFO -
|
||||||
|
=== <20><><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ===
|
||||||
|
2025-02-13 13:53:35,513 - INFO - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: https://cursorapi.nosqli.com/admin/api.version/check
|
||||||
|
2025-02-13 13:53:35,513 - INFO - <20><><EFBFBD><EFBFBD>: {'version': '3.4.1', 'platform': 'windows'}
|
||||||
|
2025-02-13 13:53:37,280 - INFO - ״̬<D7B4><CCAC>: 200
|
||||||
|
2025-02-13 13:53:37,281 - INFO - <20><>Ӧͷ: {'Server': 'nginx', 'Date': 'Thu, 13 Feb 2025 05:53:35 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Vary': 'Accept-Encoding', 'X-Frame-Options': 'sameorigin', 'Set-Cookie': 'ssid=489a85b5766d7a30c4ba9dccda6f4967; path=/; secure; HttpOnly, lang=zh-cn; path=/; secure; HttpOnly', 'Strict-Transport-Security': 'max-age=31536000', 'Alt-Svc': 'quic=":443"; h3=":443"; h3-29=":443"; h3-27=":443";h3-25=":443"; h3-T050=":443"; h3-Q050=":443";h3-Q049=":443";h3-Q048=":443"; h3-Q046=":443"; h3-Q043=":443"', 'Content-Encoding': 'gzip'}
|
||||||
|
2025-02-13 13:53:37,281 - INFO - <20><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>: {"code":1,"info":"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>","data":{"has_update":true,"is_force":0,"version_info":{"id":1,"version_no":"3.4.1.4","version_name":"cursor<6F><72><EFBFBD><EFBFBD>","download_url":"https:\/\/cursorapi.nosqli.com\/upload\/<2F><>Ȫcursor<6F><72><EFBFBD><EFBFBD>v3.4.1.4.exe","is_force":0,"min_version":"","platform":"all","status":1,"description":"","create_time":"2025-02-13 13:32:35","update_time":"2025-02-13 13:32:35"}}}
|
||||||
|
2025-02-13 13:53:37,281 - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>: δ֪<CEB4><D6AA><EFBFBD><EFBFBD>
|
||||||
|
2025-02-13 13:53:37,283 - INFO - <20><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: {'code': -1, 'msg': 'δ֪<CEB4><D6AA><EFBFBD><EFBFBD>', 'data': None}
|
||||||
|
2025-02-13 13:53:37,283 - INFO -
|
||||||
|
=== <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD> ===
|
||||||
|
2025-02-13 13:53:37,283 - INFO - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: https://cursorapi.nosqli.com/admin/api.version/check
|
||||||
|
2025-02-13 13:53:37,284 - INFO - <20><><EFBFBD><EFBFBD>: {'version': '3.4.1', 'platform': 'windows'}
|
||||||
|
2025-02-13 13:53:39,003 - INFO - ״̬<D7B4><CCAC>: 200
|
||||||
|
2025-02-13 13:53:39,003 - INFO - <20><>Ӧͷ: {'Server': 'nginx', 'Date': 'Thu, 13 Feb 2025 05:53:37 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Vary': 'Accept-Encoding', 'X-Frame-Options': 'sameorigin', 'Set-Cookie': 'ssid=b3619976145458f7ffd03d0438958a73; path=/; secure; HttpOnly, lang=zh-cn; path=/; secure; HttpOnly', 'Strict-Transport-Security': 'max-age=31536000', 'Alt-Svc': 'quic=":443"; h3=":443"; h3-29=":443"; h3-27=":443";h3-25=":443"; h3-T050=":443"; h3-Q050=":443";h3-Q049=":443";h3-Q048=":443"; h3-Q046=":443"; h3-Q043=":443"', 'Content-Encoding': 'gzip'}
|
||||||
|
2025-02-13 13:53:39,004 - INFO - <20><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>: {"code":1,"info":"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>","data":{"has_update":true,"is_force":0,"version_info":{"id":1,"version_no":"3.4.1.4","version_name":"cursor<6F><72><EFBFBD><EFBFBD>","download_url":"https:\/\/cursorapi.nosqli.com\/upload\/<2F><>Ȫcursor<6F><72><EFBFBD><EFBFBD>v3.4.1.4.exe","is_force":0,"min_version":"","platform":"all","status":1,"description":"","create_time":"2025-02-13 13:32:35","update_time":"2025-02-13 13:32:35"}}}
|
||||||
|
2025-02-13 13:53:39,004 - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>: δ֪<CEB4><D6AA><EFBFBD><EFBFBD>
|
||||||
|
2025-02-13 13:53:39,005 - INFO - <20>Ƿ<EFBFBD><C7B7>и<EFBFBD><D0B8><EFBFBD>: False
|
||||||
|
2025-02-13 13:53:39,005 - INFO - <20>Ƿ<EFBFBD>ǿ<EFBFBD>Ƹ<EFBFBD><C6B8><EFBFBD>: False
|
||||||
|
2025-02-13 13:53:39,005 - INFO - <20>汾<EFBFBD><E6B1BE>Ϣ: None
|
||||||
|
2025-02-13 13:54:24,914 - INFO - <20><>ǰ<EFBFBD>汾: 3.4.1
|
||||||
|
2025-02-13 13:54:24,915 - INFO - <20><>ǰƽ̨: windows
|
||||||
|
2025-02-13 13:54:24,915 - INFO -
|
||||||
|
=== <20><><EFBFBD>Ի<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>°汾 ===
|
||||||
|
2025-02-13 13:54:24,915 - INFO - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: https://cursorapi.nosqli.com/admin/api.version/latest
|
||||||
|
2025-02-13 13:54:24,915 - INFO - <20><><EFBFBD><EFBFBD>: {'platform': 'windows'}
|
||||||
|
2025-02-13 13:54:26,652 - INFO - ״̬<D7B4><CCAC>: 200
|
||||||
|
2025-02-13 13:54:26,652 - INFO - <20><>Ӧͷ: {'Server': 'nginx', 'Date': 'Thu, 13 Feb 2025 05:54:24 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Vary': 'Accept-Encoding', 'X-Frame-Options': 'sameorigin', 'Set-Cookie': 'ssid=fc779e7ca81172e81a4d03cab86876a1; path=/; secure; HttpOnly, lang=zh-cn; path=/; secure; HttpOnly', 'Strict-Transport-Security': 'max-age=31536000', 'Alt-Svc': 'quic=":443"; h3=":443"; h3-29=":443"; h3-27=":443";h3-25=":443"; h3-T050=":443"; h3-Q050=":443";h3-Q049=":443";h3-Q048=":443"; h3-Q046=":443"; h3-Q043=":443"', 'Content-Encoding': 'gzip'}
|
||||||
|
2025-02-13 13:54:26,652 - INFO - <20><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>: {"code":1,"info":"<22><>ȡ<EFBFBD>ɹ<EFBFBD>","data":{"id":1,"version_no":"3.4.1.4","version_name":"cursor<6F><72><EFBFBD><EFBFBD>","download_url":"https:\/\/cursorapi.nosqli.com\/upload\/<2F><>Ȫcursor<6F><72><EFBFBD><EFBFBD>v3.4.1.4.exe","is_force":0,"min_version":"","platform":"all","status":1,"description":"","create_time":"2025-02-13 13:32:35","update_time":"2025-02-13 13:32:35"}}
|
||||||
|
2025-02-13 13:54:26,654 - INFO - <20><><EFBFBD>°汾<C2B0><E6B1BE>Ϣ: {'code': 0, 'msg': '<27><>ȡ<EFBFBD>ɹ<EFBFBD>', 'data': {'id': 1, 'version_no': '3.4.1.4', 'version_name': 'cursor<6F><72><EFBFBD><EFBFBD>', 'download_url': 'https://cursorapi.nosqli.com/upload/<2F><>Ȫcursor<6F><72><EFBFBD><EFBFBD>v3.4.1.4.exe', 'is_force': 0, 'min_version': '', 'platform': 'all', 'status': 1, 'description': '', 'create_time': '2025-02-13 13:32:35', 'update_time': '2025-02-13 13:32:35'}}
|
||||||
|
2025-02-13 13:54:26,654 - INFO -
|
||||||
|
=== <20><><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ===
|
||||||
|
2025-02-13 13:54:26,654 - INFO - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: https://cursorapi.nosqli.com/admin/api.version/check
|
||||||
|
2025-02-13 13:54:26,654 - INFO - <20><><EFBFBD><EFBFBD>: {'version': '3.4.1', 'platform': 'windows'}
|
||||||
|
2025-02-13 13:54:28,445 - INFO - ״̬<D7B4><CCAC>: 200
|
||||||
|
2025-02-13 13:54:28,445 - INFO - <20><>Ӧͷ: {'Server': 'nginx', 'Date': 'Thu, 13 Feb 2025 05:54:26 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Vary': 'Accept-Encoding', 'X-Frame-Options': 'sameorigin', 'Set-Cookie': 'ssid=f8a3f46919c8aaa4d8f34d361ea3386a; path=/; secure; HttpOnly, lang=zh-cn; path=/; secure; HttpOnly', 'Strict-Transport-Security': 'max-age=31536000', 'Alt-Svc': 'quic=":443"; h3=":443"; h3-29=":443"; h3-27=":443";h3-25=":443"; h3-T050=":443"; h3-Q050=":443";h3-Q049=":443";h3-Q048=":443"; h3-Q046=":443"; h3-Q043=":443"', 'Content-Encoding': 'gzip'}
|
||||||
|
2025-02-13 13:54:28,445 - INFO - <20><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>: {"code":1,"info":"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>","data":{"has_update":true,"is_force":0,"version_info":{"id":1,"version_no":"3.4.1.4","version_name":"cursor<6F><72><EFBFBD><EFBFBD>","download_url":"https:\/\/cursorapi.nosqli.com\/upload\/<2F><>Ȫcursor<6F><72><EFBFBD><EFBFBD>v3.4.1.4.exe","is_force":0,"min_version":"","platform":"all","status":1,"description":"","create_time":"2025-02-13 13:32:35","update_time":"2025-02-13 13:32:35"}}}
|
||||||
|
2025-02-13 13:54:28,447 - INFO - <20><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: {'code': 0, 'msg': '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', 'data': {'has_update': True, 'is_force': 0, 'version_info': {'id': 1, 'version_no': '3.4.1.4', 'version_name': 'cursor<6F><72><EFBFBD><EFBFBD>', 'download_url': 'https://cursorapi.nosqli.com/upload/<2F><>Ȫcursor<6F><72><EFBFBD><EFBFBD>v3.4.1.4.exe', 'is_force': 0, 'min_version': '', 'platform': 'all', 'status': 1, 'description': '', 'create_time': '2025-02-13 13:32:35', 'update_time': '2025-02-13 13:32:35'}}}
|
||||||
|
2025-02-13 13:54:28,447 - INFO -
|
||||||
|
=== <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD> ===
|
||||||
|
2025-02-13 13:54:28,447 - INFO - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: https://cursorapi.nosqli.com/admin/api.version/check
|
||||||
|
2025-02-13 13:54:28,447 - INFO - <20><><EFBFBD><EFBFBD>: {'version': '3.4.1', 'platform': 'windows'}
|
||||||
|
2025-02-13 13:54:30,144 - INFO - ״̬<D7B4><CCAC>: 200
|
||||||
|
2025-02-13 13:54:30,145 - INFO - <20><>Ӧͷ: {'Server': 'nginx', 'Date': 'Thu, 13 Feb 2025 05:54:28 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Vary': 'Accept-Encoding', 'X-Frame-Options': 'sameorigin', 'Set-Cookie': 'ssid=169a8bdefde9a16f0e9f3e32da4d8ba5; path=/; secure; HttpOnly, lang=zh-cn; path=/; secure; HttpOnly', 'Strict-Transport-Security': 'max-age=31536000', 'Alt-Svc': 'quic=":443"; h3=":443"; h3-29=":443"; h3-27=":443";h3-25=":443"; h3-T050=":443"; h3-Q050=":443";h3-Q049=":443";h3-Q048=":443"; h3-Q046=":443"; h3-Q043=":443"', 'Content-Encoding': 'gzip'}
|
||||||
|
2025-02-13 13:54:30,145 - INFO - <20><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>: {"code":1,"info":"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>","data":{"has_update":true,"is_force":0,"version_info":{"id":1,"version_no":"3.4.1.4","version_name":"cursor<6F><72><EFBFBD><EFBFBD>","download_url":"https:\/\/cursorapi.nosqli.com\/upload\/<2F><>Ȫcursor<6F><72><EFBFBD><EFBFBD>v3.4.1.4.exe","is_force":0,"min_version":"","platform":"all","status":1,"description":"","create_time":"2025-02-13 13:32:35","update_time":"2025-02-13 13:32:35"}}}
|
||||||
|
2025-02-13 13:54:30,146 - INFO - <20>Ƿ<EFBFBD><C7B7>и<EFBFBD><D0B8><EFBFBD>: True
|
||||||
|
2025-02-13 13:54:30,146 - INFO - <20>Ƿ<EFBFBD>ǿ<EFBFBD>Ƹ<EFBFBD><C6B8><EFBFBD>: False
|
||||||
|
2025-02-13 13:54:30,146 - INFO - <20>汾<EFBFBD><E6B1BE>Ϣ: {'id': 1, 'version_no': '3.4.1.4', 'version_name': 'cursor<6F><72><EFBFBD><EFBFBD>', 'download_url': 'https://cursorapi.nosqli.com/upload/<2F><>Ȫcursor<6F><72><EFBFBD><EFBFBD>v3.4.1.4.exe', 'is_force': 0, 'min_version': '', 'platform': 'all', 'status': 1, 'description': '', 'create_time': '2025-02-13 13:32:35', 'update_time': '2025-02-13 13:32:35'}
|
||||||
|
2025-02-13 13:54:30,146 - INFO -
|
||||||
|
=== <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD> ===
|
||||||
|
2025-02-13 13:54:30,148 - INFO - <20><><EFBFBD>ص<EFBFBD>ַ: https://cursorapi.nosqli.com/upload/<2F><>Ȫcursor<6F><72><EFBFBD><EFBFBD>v3.4.1.4.exe
|
||||||
|
2025-02-13 13:54:30,148 - INFO - <20><><EFBFBD><EFBFBD>·<EFBFBD><C2B7>: C:\Users\huangzhen\Downloads\CursorHelper\test_update.exe
|
||||||
|
2025-02-13 13:54:31,822 - ERROR - <20><><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>ʧ<EFBFBD><CAA7>: 404 Client Error: Not Found for url: https://cursorapi.nosqli.com/upload/%E5%90%AC%E6%B3%89cursor%E5%8A%A9%E6%89%8Bv3.4.1.4.exe
|
||||||
|
2025-02-13 13:54:31,823 - INFO - <20><><EFBFBD>ؽ<EFBFBD><D8BD><EFBFBD>: ʧ<><CAA7>
|
||||||
70
versioncheck.doc
Normal file
70
versioncheck.doc
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
版本更新API文档
|
||||||
|
域名
|
||||||
|
base_url: https://cursorapi.nosqli.com
|
||||||
|
# 版本更新API文档
|
||||||
|
|
||||||
|
#
|
||||||
|
* 公共返回参数:
|
||||||
|
* - code: 错误码,0表示成功,非0表示失败
|
||||||
|
* - msg: 提示信息
|
||||||
|
* - data: 返回的数据,请求失败时可能为空
|
||||||
|
*
|
||||||
|
* 错误码说明:
|
||||||
|
* - 0: 成功
|
||||||
|
* - 1: 一般性错误(具体错误信息见msg)
|
||||||
|
* - 401: 未授权或授权失败
|
||||||
|
* - 404: 请求的资源不存在
|
||||||
|
* - 500: 服务器内部错误
|
||||||
|
*
|
||||||
|
* 版本号格式:x.x.x (例如: 3.4.1)
|
||||||
|
* 平台类型:
|
||||||
|
* - all: 全平台
|
||||||
|
* - windows: Windows平台
|
||||||
|
* - mac: Mac平台
|
||||||
|
* - linux: Linux平台
|
||||||
|
* ====================================================
|
||||||
|
*
|
||||||
|
* 1. 获取最新版本 [GET] /admin/api.version/latest
|
||||||
|
* 请求参数:
|
||||||
|
* - platform: 平台类型(all|windows|mac|linux), 默认为all
|
||||||
|
* 返回数据:
|
||||||
|
* {
|
||||||
|
* "code": 0,
|
||||||
|
* "msg": "获取成功",
|
||||||
|
* "data": {
|
||||||
|
* "id": "1",
|
||||||
|
* "version_no": "3.4.1.4",
|
||||||
|
* "version_name": "听泉cursor助手",
|
||||||
|
* "download_url": "http://domain/upload/xxx.exe",
|
||||||
|
* "is_force": 1, // 是否强制更新(1是,0否)
|
||||||
|
* "min_version": "3.4.0.0", // 最低要求版本
|
||||||
|
* "platform": "all", // 平台类型
|
||||||
|
* "description": "版本描述", // 版本描述
|
||||||
|
* "status": 1, // 状态(1启用,0禁用)
|
||||||
|
* "create_time": "2024-03-20 10:00:00"
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* 2. 检查版本更新 [GET] /admin/api.version/check
|
||||||
|
* 请求参数:
|
||||||
|
* - version: 当前版本号(必填)
|
||||||
|
* - platform: 平台类型(all|windows|mac|linux), 默认为all
|
||||||
|
* 返回数据:
|
||||||
|
* {
|
||||||
|
* "code": 0,
|
||||||
|
* "msg": "检查完成",
|
||||||
|
* "data": {
|
||||||
|
* "has_update": true, // 是否有更新
|
||||||
|
* "is_force": 1, // 是否强制更新
|
||||||
|
* "version_info": { // 新版本信息(has_update为true时返回)
|
||||||
|
* // 同上面的版本信息
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* 错误返回示例:
|
||||||
|
* {
|
||||||
|
* "code": 1,
|
||||||
|
* "msg": "请提供当前版本号",
|
||||||
|
* "data": null
|
||||||
|
* }
|
||||||
Reference in New Issue
Block a user