From 9a9843dcbcec2e85e45904961252c72ee557ea0a Mon Sep 17 00:00:00 2001 From: Jonson Petard <41122242+greenhat616@users.noreply.github.com> Date: Wed, 7 Feb 2024 15:37:53 +0800 Subject: [PATCH 1/2] fix(portable): mihomo-alpha is missing --- package.json | 1 - pnpm-lock.yaml | 3 --- scripts/portable.ts | 1 + 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/package.json b/package.json index 663d740a0f..e25ef25bda 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,6 @@ "@tauri-apps/cli": "1.5.9", "@types/fs-extra": "11.0.4", "@types/js-cookie": "3.0.6", - "@types/lodash": "4.14.202", "@types/lodash-es": "4.17.12", "@types/react": "18.2.55", "@types/react-dom": "18.2.18", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 94795a46ec..e0b5e4166f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -112,9 +112,6 @@ devDependencies: '@types/js-cookie': specifier: 3.0.6 version: 3.0.6 - '@types/lodash': - specifier: 4.14.202 - version: 4.14.202 '@types/lodash-es': specifier: 4.17.12 version: 4.17.12 diff --git a/scripts/portable.ts b/scripts/portable.ts index 51cb8b97e2..6aa51f4240 100644 --- a/scripts/portable.ts +++ b/scripts/portable.ts @@ -25,6 +25,7 @@ async function resolvePortable() { zip.addLocalFile(path.join(releaseDir, "Clash Nyanpasu.exe")); zip.addLocalFile(path.join(releaseDir, "clash.exe")); zip.addLocalFile(path.join(releaseDir, "mihomo.exe")); + zip.addLocalFile(path.join(releaseDir, "mihomo-alpha.exe")); zip.addLocalFile(path.join(releaseDir, "clash-rs.exe")); zip.addLocalFolder(path.join(releaseDir, "resources"), "resources"); zip.addLocalFolder(configDir, ".config"); From 9c36da79357e27db96139ea13196db5d7a81b1a6 Mon Sep 17 00:00:00 2001 From: Jonson Petard <41122242+greenhat616@users.noreply.github.com> Date: Wed, 7 Feb 2024 15:58:54 +0800 Subject: [PATCH 2/2] feat(portable): disable auto update --- src/components/setting/mods/update-viewer.tsx | 10 ++++++++++ src/locales/en.json | 17 ++--------------- src/locales/ru.json | 4 +++- src/locales/zh.json | 4 +++- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/components/setting/mods/update-viewer.tsx b/src/components/setting/mods/update-viewer.tsx index e4caf369e9..e70baaec70 100644 --- a/src/components/setting/mods/update-viewer.tsx +++ b/src/components/setting/mods/update-viewer.tsx @@ -1,5 +1,6 @@ import { BaseDialog, DialogRef } from "@/components/base"; import { NotificationType, useNotification } from "@/hooks/use-notification"; +import { isPortable } from "@/services/cmds"; import { atomUpdateState } from "@/services/states"; import { Box, styled } from "@mui/material"; import { relaunch } from "@tauri-apps/api/process"; @@ -41,6 +42,15 @@ export const UpdateViewer = forwardRef((props, ref) => { }, [updateInfo]); const onUpdate = useLockFn(async () => { + const portable = await isPortable(); + if (portable) { + useNotification({ + type: NotificationType.Error, + title: t("Error"), + body: t("Portable Update Error"), + }); + return; + } if (updateState) return; setUpdateState(true); diff --git a/src/locales/en.json b/src/locales/en.json index a5f8ce9a61..7de427cee3 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -5,7 +5,6 @@ "Label-Logs": "Logs", "Label-Rules": "Rules", "Label-Settings": "Settings", - "Connections": "Connections", "Upload Total": "Upload Total", "Download Total": "Download Total", @@ -18,7 +17,6 @@ "global": "global", "direct": "direct", "script": "script", - "Profiles": "Profiles", "Profile URL": "Profile URL", "Import": "Import", @@ -41,7 +39,6 @@ "Update All Profiles": "Update All Profiles", "View Runtime Config": "View Runtime Config", "Reactivate Profiles": "Reactivate Profiles", - "Location": "Location", "Delay check": "Delay check", "Sort by default": "Sort by default", @@ -52,7 +49,6 @@ "Filter": "Filter", "Filter conditions": "Filter conditions", "Refresh profiles": "Refresh profiles", - "Type": "Type", "Name": "Name", "Descriptions": "Descriptions", @@ -60,7 +56,6 @@ "Update Interval": "Update Interval", "Use System Proxy": "Use System Proxy", "Use Clash Proxy": "Use Clash Proxy", - "Settings": "Settings", "Clash Setting": "Clash Setting", "System Setting": "System Setting", @@ -97,7 +92,6 @@ "Page Transition Animation Blur": "Blur", "Page Transition Animation Transparent": "Transparent", "Page Transition Animation None": "None", - "Language": "Language", "Open App Dir": "Open App Dir", "Open Core Dir": "Open Core Dir", @@ -112,7 +106,6 @@ "ReadOnly": "ReadOnly", "Check Updates": "Check Updates", "Restart": "Restart", - "Tasks": "Tasks", "Auto Log Clean": "Auto Log Clean", "Never Clean": "Never", @@ -120,17 +113,13 @@ "Retain 7 Days": "Retain 7 Days", "Retain 30 Days": "Retain 30 Days", "Retain 90 Days": "Retain 90 Days", - "Collect Logs": "Collect Logs", - "Back": "Back", "Save": "Save", "Cancel": "Cancel", - "Default": "Default", "Download Speed": "Download Speed", "Upload Speed": "Upload Speed", - "open_or_close_dashboard": "Open or Close Dashboard", "clash_mode_rule": "Rule Mode", "clash_mode_global": "Global Mode", @@ -142,21 +131,19 @@ "toggle_tun_mode": "Toggle Tun Mode", "enable_tun_mode": "Enable Tun Mode", "disable_tun_mode": "Disable Tun Mode", - "App Log Level": "App Log Level", "Auto Close Connections": "Auto Close Connections", "Enable Clash Fields Filter": "Enable Clash Fields Filter", "Enable Builtin Enhanced": "Enable Builtin Enhanced", "Proxy Layout Column": "Proxy Layout Column", "Default Latency Test": "Default Latency Test", - "Error": "Error", "Success": "Success", - "Providers": "Providers", "Rules Providers": "Rules Providers", "Update Rules Providers All": "Update Rules Providers All", "Rule Set rules": "{{rule}} rules", "Last Update": "Last Updated: {{fromNow}}", - "Update Rules Providers Success": "Update Rules Providers Success" + "Update Rules Providers Success": "Update Rules Providers Success", + "Portable Update Error": "Portable Update is not supported, please download the latest version from the official website." } diff --git a/src/locales/ru.json b/src/locales/ru.json index 7cf3e1cb29..93d48715c0 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -136,5 +136,7 @@ "Update Rules Providers All": "Обновить все провайдеры правил", "Rule Set rules": "{{rule}} правила", "Last Update": "Последнее обновление {{fromNow}}", - "Update Rules Providers Success": "Провайдеры правил успешно обновлены" + "Update Rules Providers Success": "Провайдеры правил успешно обновлены", + + "Portable Update Error": "Обновление портативной версии не поддерживается" } diff --git a/src/locales/zh.json b/src/locales/zh.json index 0058ac9f8c..b5b445ca6c 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -158,5 +158,7 @@ "Update Rules Providers All": "全部更新", "Rule Set rules": "{{rule}} 条规则", "Last Update": "{{fromNow}}更新", - "Update Rules Providers Success": "更新规则集成功" + "Update Rules Providers Success": "更新规则集成功", + + "Portable Update Error": "便携版无法自动更新,请到 Github 下载最新版本" }