mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-22 19:52:14 +08:00
refactor: windows autostart (#5941)
* refactor(windows-autostart): switch to scheduled tasks with user/admin split * fix(schtasks): decode stdout/stderr using Windows OEM/ANSI code pages * refactor(ui): remove admin auto-launch warning and clean i18n * feat(windows): user-level auto-launch via task XML * docs: Changelog.md
This commit is contained in:
@@ -1,19 +1,11 @@
|
||||
import {
|
||||
InfoOutlined,
|
||||
SettingsOutlined,
|
||||
WarningOutlined,
|
||||
AdminPanelSettingsOutlined,
|
||||
DnsOutlined,
|
||||
ExtensionOutlined,
|
||||
} from "@mui/icons-material";
|
||||
import {
|
||||
Typography,
|
||||
Stack,
|
||||
Divider,
|
||||
Chip,
|
||||
IconButton,
|
||||
Tooltip,
|
||||
} from "@mui/material";
|
||||
import { Typography, Stack, Divider, Chip, IconButton } from "@mui/material";
|
||||
import { useLockFn } from "ahooks";
|
||||
import { useCallback, useEffect, useMemo, useReducer } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -303,13 +295,6 @@ export const SystemInfoCard = () => {
|
||||
{t("home.components.systemInfo.fields.autoLaunch")}
|
||||
</Typography>
|
||||
<Stack direction="row" spacing={1} alignItems="center">
|
||||
{isAdminMode && (
|
||||
<Tooltip
|
||||
title={t("home.components.systemInfo.tooltips.autoLaunchAdmin")}
|
||||
>
|
||||
<WarningOutlined sx={{ color: "warning.main", fontSize: 20 }} />
|
||||
</Tooltip>
|
||||
)}
|
||||
<Chip
|
||||
size="small"
|
||||
label={
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { WarningRounded } from "@mui/icons-material";
|
||||
import { Tooltip } from "@mui/material";
|
||||
import React, { useRef } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { mutate } from "swr";
|
||||
@@ -7,9 +5,7 @@ import { mutate } from "swr";
|
||||
import { DialogRef, Switch } from "@/components/base";
|
||||
import { TooltipIcon } from "@/components/base/base-tooltip-icon";
|
||||
import ProxyControlSwitches from "@/components/shared/proxy-control-switches";
|
||||
import { useSystemState } from "@/hooks/use-system-state";
|
||||
import { useVerge } from "@/hooks/use-verge";
|
||||
import { showNotice } from "@/services/notice-service";
|
||||
|
||||
import { GuardState } from "./mods/guard-state";
|
||||
import { SettingList, SettingItem } from "./mods/setting-comp";
|
||||
@@ -25,8 +21,6 @@ const SettingSystem = ({ onError }: Props) => {
|
||||
|
||||
const { verge, mutateVerge, patchVerge } = useVerge();
|
||||
|
||||
const { isAdminMode } = useSystemState();
|
||||
|
||||
const { enable_auto_launch, enable_silent_start } = verge ?? {};
|
||||
|
||||
const sysproxyRef = useRef<DialogRef>(null);
|
||||
@@ -55,34 +49,16 @@ const SettingSystem = ({ onError }: Props) => {
|
||||
onError={onError}
|
||||
/>
|
||||
|
||||
<SettingItem
|
||||
label={t("settings.sections.system.fields.autoLaunch")}
|
||||
extra={
|
||||
isAdminMode && (
|
||||
<Tooltip
|
||||
title={t("settings.sections.system.tooltips.autoLaunchAdmin")}
|
||||
>
|
||||
<WarningRounded sx={{ color: "warning.main", mr: 1 }} />
|
||||
</Tooltip>
|
||||
)
|
||||
}
|
||||
>
|
||||
<SettingItem label={t("settings.sections.system.fields.autoLaunch")}>
|
||||
<GuardState
|
||||
value={enable_auto_launch ?? false}
|
||||
valueProps="checked"
|
||||
onCatch={onError}
|
||||
onFormat={onSwitchFormat}
|
||||
onChange={(e) => {
|
||||
// 移除管理员模式检查提示
|
||||
onChangeData({ enable_auto_launch: e });
|
||||
}}
|
||||
onGuard={async (e) => {
|
||||
if (isAdminMode) {
|
||||
showNotice.info(
|
||||
"settings.sections.system.tooltips.autoLaunchAdmin",
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
// 先触发UI更新立即看到反馈
|
||||
onChangeData({ enable_auto_launch: e });
|
||||
|
||||
Reference in New Issue
Block a user