版本管理,优化

This commit is contained in:
zhongluofeng
2026-08-11 17:19:36 +08:00
parent 2f20161010
commit 6c7897bf47
33 changed files with 1361 additions and 39 deletions
+32
View File
@@ -4,6 +4,19 @@ import { invoke as __TAURI_INVOKE } from "@tauri-apps/api/core";
/** Commands */
export const commands = {
/** 获取当前应用版本 */
appVersion: () => __TAURI_INVOKE<string>("app_version"),
/** 检查 Gitea 最新 release,返回版本对比与可用资产 */
updateCheck: () => __TAURI_INVOKE<UpdateCheckResult>("update_check"),
/**
* 更新应用本体。
* 便携版:下载 thing_{v}_x64.exe → update.bat 覆盖重启;
* 安装版:下载 thing_{v}_x64-setup.exe → 提权静默安装 /S。
* 下载进度通过 UPDATE_PROGRESS 事件上报,调用方返回前会触发应用退出。
*/
updateInstall: () => __TAURI_INVOKE<null>("update_install"),
/** 更新 ThingHK 内核:下载 thing-hk_{v}.zip → 停止监控内核 → 覆盖内核文件 */
updateThinghk: () => __TAURI_INVOKE<null>("update_thinghk"),
proxyActivateProfile: (id: string) => __TAURI_INVOKE<null>("proxy_activate_profile", { id }),
proxyCheckKernelUpdate: () => __TAURI_INVOKE<KernelUpdateInfo>("proxy_check_kernel_update"),
proxyClearSystemProxy: () => __TAURI_INVOKE<null>("proxy_clear_system_proxy"),
@@ -480,6 +493,25 @@ export type TaskStatus =
/** 错误 */
"error";
/** release 中的一个资产 */
export type UpdateAsset = {
name: string,
size: number,
browserDownloadUrl: string,
};
/** 检查更新的结果 */
export type UpdateCheckResult = {
currentVersion: string,
latestVersion: string,
hasUpdate: boolean,
/** portable | installed */
installType: string,
releaseName: string,
releaseBody: string,
assets: UpdateAsset[],
};
/** 窗口信息(窗口拾取 / 枚举) */
export type WindowInfo = {
hwnd: number,