Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: portable issues #395

Merged
merged 2 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions scripts/portable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
10 changes: 10 additions & 0 deletions src/components/setting/mods/update-viewer.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -41,6 +42,15 @@ export const UpdateViewer = forwardRef<DialogRef>((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);

Expand Down
17 changes: 2 additions & 15 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"Label-Logs": "Logs",
"Label-Rules": "Rules",
"Label-Settings": "Settings",

"Connections": "Connections",
"Upload Total": "Upload Total",
"Download Total": "Download Total",
Expand All @@ -18,7 +17,6 @@
"global": "global",
"direct": "direct",
"script": "script",

"Profiles": "Profiles",
"Profile URL": "Profile URL",
"Import": "Import",
Expand All @@ -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",
Expand All @@ -52,15 +49,13 @@
"Filter": "Filter",
"Filter conditions": "Filter conditions",
"Refresh profiles": "Refresh profiles",

"Type": "Type",
"Name": "Name",
"Descriptions": "Descriptions",
"Subscription URL": "Subscription URL",
"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",
Expand Down Expand Up @@ -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",
Expand All @@ -112,25 +106,20 @@
"ReadOnly": "ReadOnly",
"Check Updates": "Check Updates",
"Restart": "Restart",

"Tasks": "Tasks",
"Auto Log Clean": "Auto Log Clean",
"Never Clean": "Never",
"Retain 3 Days": "Retain 3 Days",
"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",
Expand All @@ -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."
}
4 changes: 3 additions & 1 deletion src/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "Обновление портативной версии не поддерживается"
}
4 changes: 3 additions & 1 deletion src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 下载最新版本"
}
Loading