diff --git a/README.md b/README.md index db213e4..5a9d5a7 100755 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@
您似乎是首次运行 Aikari, 基于 Aikari PLS 模块的实现原理, 我们需要修改 Hosts 文件并重启 SeewoCore 进程以开始拦截流量。
+重启 SeewoCore 进程会导致管家前端页面在重启完成后自动发生刷新, 因此稍后请留意此变更。
`, + true, + false, + null + ); + return true; + } + } + }, + refreshAikariStatus: async (init = false) => { const isDetachedRet = await ipcRenderer.invoke( `${IPC_METHOD_BASE}.aikariLifecycleQuery`, @@ -636,7 +669,7 @@ if (!global.__HUGO_AURA_UI_REACTIVES__.subConfig) } }, - downloadAikariBin: async (retrieveMode = false) => { + downloadAndInstallAikariBin: async (retrieveMode = false) => { const GLOBAL_FUNCTIONS = global.__HUGO_AURA_UI_FUNCTIONS__.subConfig.aikariStatus; const CUR_CHANNEL = `${IPC_METHOD_BASE}.post.reportAikariInstallStep`; @@ -671,25 +704,50 @@ if (!global.__HUGO_AURA_UI_REACTIVES__.subConfig) const callbackFn = (_evt, info) => { switch (info.status) { case "failed": - GLOBAL_FUNCTIONS.updateToast( - "error", - "下载失败", - `${ - info.message ? info.message : "检查日志以获取错误信息" - }
- ${info.errorObj ? info.errorObj : ""} -
`, - true, - true, - 5000 - ); + if (info.id !== "INSTALL_STAGE") { + GLOBAL_FUNCTIONS.updateToast( + "error", + "下载失败", + `${ + info.message ? info.message : "检查日志以获取错误信息" + }
+ ${info.errorObj ? info.errorObj : ""} +
`, + true, + true, + 5000 + ); + + GLOBAL_FUNCTIONS.updatePBarStatus( + 100, + "下载时发生错误", + "danger", + false + ); + } else { + GLOBAL_FUNCTIONS.updateToast( + "error", + "安装失败", + `${ + info.message + ? info.message + : "检查 HugoAura 日志或安装器日志 (%TEMP%/Aikari-Install-Temp) 以获取错误信息" + }
+ ${info.errorObj ? info.errorObj : ""} +
`, + true, + true, + 15000 + ); + + GLOBAL_FUNCTIONS.updatePBarStatus( + 100, + `发生错误: ${info.message}`, + "danger", + false + ); + } - GLOBAL_FUNCTIONS.updatePBarStatus( - 100, - "下载时发生错误", - "danger", - false - ); setTimeout(() => { GLOBAL_FUNCTIONS.switchPBarShowStatus(false); }, 1000); @@ -703,66 +761,102 @@ if (!global.__HUGO_AURA_UI_REACTIVES__.subConfig) ); break; case "done": - GLOBAL_FUNCTIONS.updateToast( - "success", - "下载成功", - null, - true, - true, - 2500 - ); + if (info.id !== "INSTALL_STAGE") { + GLOBAL_FUNCTIONS.updateToast( + "success", + "下载成功", + null, + true, + true, + 2500 + ); - GLOBAL_FUNCTIONS.updatePBarStatus( - 100, - "下载成功", - "success", - false - ); - setTimeout(() => { - GLOBAL_FUNCTIONS.switchPBarShowStatus(false); - }, 1000); + GLOBAL_FUNCTIONS.updatePBarStatus( + 100, + "下载成功", + "success", + false + ); + break; + } else { + GLOBAL_FUNCTIONS.updateToast( + "success", + "安装成功", + null, + true, + true, + 2500 + ); - ipcRenderer.off(CUR_CHANNEL, callbackFn); - GLOBAL_FUNCTIONS.updateOperationBtnStatus("Refresh", false); - GLOBAL_FUNCTIONS.updateOperationBtnStatus( - "Install", - true, - "下载应用" - ); - lifecycleStatus.installed = true; - global.__HUGO_AURA__.aikariStats.installed = true; - ipcRenderer.invoke( - `${IPC_METHOD_BASE}.updateAikariStatus`, - global.__HUGO_AURA__.aikariStats - ); - GLOBAL_FUNCTIONS.updateStatusContent(); - break; + GLOBAL_FUNCTIONS.updatePBarStatus( + 100, + "Aikari 安装成功", + "success", + false + ); + + setTimeout(() => { + GLOBAL_FUNCTIONS.switchPBarShowStatus(false); + }, 1000); + + ipcRenderer.off(CUR_CHANNEL, callbackFn); + GLOBAL_FUNCTIONS.updateOperationBtnStatus("Refresh", false); + GLOBAL_FUNCTIONS.updateOperationBtnStatus( + "Install", + true, + "下载应用" + ); + lifecycleStatus.installed = true; + global.__HUGO_AURA__.aikariStats.installed = true; + setTimeout(() => { + ipcRenderer.invoke( + `${IPC_METHOD_BASE}.updateAikariStatus`, + global.__HUGO_AURA__.aikariStats + ); + GLOBAL_FUNCTIONS.updateStatusContent(); + }, 500); + break; + } case "waiting": - GLOBAL_FUNCTIONS.updatePBarStatus(0, "正在连接", "normal"); + GLOBAL_FUNCTIONS.updatePBarStatus( + 0, + info.message ? info.message : "正在连接", + "normal" + ); if ( - !global.__HUGO_AURA_UI_REACTIVES__.subConfig.aikariStatus + (!global.__HUGO_AURA_UI_REACTIVES__.subConfig.aikariStatus .curDlTaskId || - global.__HUGO_AURA_UI_REACTIVES__.subConfig.aikariStatus - .curDlTaskId !== info.id + global.__HUGO_AURA_UI_REACTIVES__.subConfig.aikariStatus + .curDlTaskId !== info.id) && + info.id !== "INSTALL_STAGE" ) { global.__HUGO_AURA_UI_REACTIVES__.subConfig.aikariStatus.curDlTaskId = info.id; } break; case "progressing": - const roundProgress = Math.round(info.progress); - GLOBAL_FUNCTIONS.updatePBarStatus( - roundProgress, - `正在下载中... ${roundProgress}% (${( - info.curBytes / - 1024 / - 1024 - ).toFixed(2)}MB / ${(info.totalBytes / 1024 / 1024).toFixed( - 2 - )}MB)`, // POWERED BY PRETTIER - "normal", - true - ); + if (info.id !== "INSTALL_STAGE") { + const roundProgress = Math.round(info.progress); + GLOBAL_FUNCTIONS.updatePBarStatus( + roundProgress, + `正在下载中... ${roundProgress}% (${( + info.curBytes / + 1024 / + 1024 + ).toFixed(2)}MB / ${(info.totalBytes / 1024 / 1024).toFixed( + 2 + )}MB)`, // POWERED BY PRETTIER + "normal", + true + ); + } else { + GLOBAL_FUNCTIONS.updatePBarStatus( + info.progress, + `正在安装 Aikari...`, + "normal", + false + ); + } break; case "struggling": GLOBAL_FUNCTIONS.updatePBarStatus(100, info.message, "warning"); diff --git a/src/core/hook.js b/src/core/hook.js index 32206e4..a2484e0 100755 --- a/src/core/hook.js +++ b/src/core/hook.js @@ -27,7 +27,7 @@ if (!global.__HUGO_AURA_API__) { "https://api-aura-projekts.minorice.moe", "https://api.aura.vim.moe", ], - aikariUpdate: "/api/getPLSLatestVersion", + aikariUpdate: "/api/getAikariLatestVersion", auraUpdate: "/api/getAuraLatestVersion", }; global.__HUGO_AURA_API__ = __HUGO_AURA_API__; diff --git a/src/core/preload.js b/src/core/preload.js index 3ba7e28..a6a420c 100755 --- a/src/core/preload.js +++ b/src/core/preload.js @@ -1,6 +1,6 @@ // @ts-check -const __AURA_VERSION__ = "0.1.1-beta-patch-1"; +const __AURA_VERSION__ = "0.2.0-rc1"; (() => { if (require.main) return; // 如果只是导入 Aura Version, 不运行闭包逻辑