mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 05:03:45 +08:00
chore: disable admin mode autolaunch limitation
This commit is contained in:
parent
2b1d02f0cc
commit
c718ef3058
@ -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 = () => {
|
||||
</Typography>
|
||||
<Stack direction="row" spacing={1} alignItems="center">
|
||||
{isAdminMode && (
|
||||
<Tooltip title={t("Administrator mode does not support auto launch")}>
|
||||
<Tooltip title={t("Administrator mode may not support auto launch")}>
|
||||
<WarningOutlined sx={{ color: "warning.main", fontSize: 20 }} />
|
||||
</Tooltip>
|
||||
)}
|
||||
@ -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" }}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
@ -194,7 +194,7 @@ const SettingSystem = ({ onError }: Props) => {
|
||||
label={t("Auto Launch")}
|
||||
extra={
|
||||
isAdminMode && (
|
||||
<Tooltip title={t("Administrator mode does not support auto launch")}>
|
||||
<Tooltip title={t("Administrator mode may not support auto launch")}>
|
||||
<WarningRounded sx={{ color: "warning.main", mr: 1 }} />
|
||||
</Tooltip>
|
||||
)
|
||||
@ -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) => {
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Switch edge="end" disabled={isAdminMode} />
|
||||
<Switch edge="end" />
|
||||
</GuardState>
|
||||
</SettingItem>
|
||||
|
||||
|
@ -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",
|
||||
|
@ -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 频道",
|
||||
|
Loading…
x
Reference in New Issue
Block a user