From c718ef3058cf51d69fb50845b233d2a5e96b446a Mon Sep 17 00:00:00 2001 From: wonfen Date: Sat, 19 Apr 2025 12:37:01 +0800 Subject: [PATCH] chore: disable admin mode autolaunch limitation --- src/components/home/system-info-card.tsx | 9 ++++----- src/components/setting/setting-system.tsx | 10 ++++------ src/locales/en.json | 2 +- src/locales/zh.json | 2 +- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/components/home/system-info-card.tsx b/src/components/home/system-info-card.tsx index f3d6a8b5..b68a2368 100644 --- a/src/components/home/system-info-card.tsx +++ b/src/components/home/system-info-card.tsx @@ -106,13 +106,13 @@ export const SystemInfoCard = () => { // 切换自启动状态 const toggleAutoLaunch = useCallback(async () => { - if (!verge || isAdminMode) return; + if (!verge) return; try { await patchVerge({ enable_auto_launch: !verge.enable_auto_launch }); } catch (err) { console.error("切换开机自启动状态失败:", err); } - }, [verge, patchVerge, isAdminMode]); + }, [verge, patchVerge]); // 安装系统服务 const onInstallService = useLockFn(async () => { @@ -258,7 +258,7 @@ export const SystemInfoCard = () => { {isAdminMode && ( - + )} @@ -268,8 +268,7 @@ export const SystemInfoCard = () => { color={autoLaunchEnabled ? "success" : "default"} variant={autoLaunchEnabled ? "filled" : "outlined"} onClick={toggleAutoLaunch} - disabled={isAdminMode} - sx={{ cursor: isAdminMode ? "not-allowed" : "pointer" }} + sx={{ cursor: "pointer" }} /> diff --git a/src/components/setting/setting-system.tsx b/src/components/setting/setting-system.tsx index ef5ee59a..72ffc112 100644 --- a/src/components/setting/setting-system.tsx +++ b/src/components/setting/setting-system.tsx @@ -194,7 +194,7 @@ const SettingSystem = ({ onError }: Props) => { label={t("Auto Launch")} extra={ isAdminMode && ( - + ) @@ -206,14 +206,12 @@ const SettingSystem = ({ onError }: Props) => { onCatch={onError} onFormat={onSwitchFormat} onChange={(e) => { - // 在管理员模式下禁用更改 - if (isAdminMode) return; + // 移除管理员模式检查提示 onChangeData({ enable_auto_launch: e }); }} onGuard={async (e) => { if (isAdminMode) { - Notice.error(t("Administrator mode does not support auto launch"), 2000); - return Promise.reject(new Error(t("Administrator mode does not support auto launch"))); + Notice.info(t("Administrator mode may not support auto launch"), 2000); } try { @@ -230,7 +228,7 @@ const SettingSystem = ({ onError }: Props) => { } }} > - + diff --git a/src/locales/en.json b/src/locales/en.json index ea699e99..ddc89207 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -258,7 +258,7 @@ "PAC Script Content": "PAC Script Content", "PAC URL": "PAC URL: ", "Auto Launch": "Auto Launch", - "Administrator mode does not support auto launch": "Administrator mode does not support auto launch", + "Administrator mode may not support auto launch": "Administrator mode may not support auto launch", "Silent Start": "Silent Start", "Silent Start Info": "Start the program in background mode without displaying the panel", "TG Channel": "Telegram Channel", diff --git a/src/locales/zh.json b/src/locales/zh.json index f2ba304b..1833d0a4 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -258,7 +258,7 @@ "PAC Script Content": "PAC 脚本内容", "PAC URL": "PAC 地址:", "Auto Launch": "开机自启", - "Administrator mode does not support auto launch": "管理员模式不支持开机自启", + "Administrator mode may not support auto launch": "管理员模式可能不支持开机自启", "Silent Start": "静默启动", "Silent Start Info": "程序启动时以后台模式运行,不显示程序面板", "TG Channel": "Telegram 频道",