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:
Sline
2025-12-26 14:42:21 +08:00
committed by GitHub
parent a67abda72d
commit 65b4d8713d
36 changed files with 438 additions and 273 deletions
+1 -16
View File
@@ -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 -25
View File
@@ -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 });
-3
View File
@@ -62,9 +62,6 @@
"actions": {
"settings": "الإعدادات"
},
"tooltips": {
"autoLaunchAdmin": "Administrator mode may not support auto launch"
},
"badges": {
"adminMode": "Administrator Mode",
"serviceMode": "وضع الخدمة",
-1
View File
@@ -15,7 +15,6 @@
"systemProxy": "وكيل النظام"
},
"tooltips": {
"autoLaunchAdmin": "Administrator mode may not support auto launch",
"silentStart": "بدء البرنامج في الخلفية دون عرض الواجهة"
},
"fields": {
-3
View File
@@ -62,9 +62,6 @@
"actions": {
"settings": "Einstellungen"
},
"tooltips": {
"autoLaunchAdmin": "Der Administrator-Modus unterstützt möglicherweise keine automatische Startfunktion."
},
"badges": {
"adminMode": "Administrator-Modus",
"serviceMode": "Service-Modus",
-1
View File
@@ -15,7 +15,6 @@
"systemProxy": "Systemproxy"
},
"tooltips": {
"autoLaunchAdmin": "Der Administrator-Modus unterstützt möglicherweise keine automatische Startfunktion.",
"silentStart": "Die Anwendung wird im Hintergrund gestartet, ohne dass das Programmfenster angezeigt wird."
},
"fields": {
-3
View File
@@ -62,9 +62,6 @@
"actions": {
"settings": "Settings"
},
"tooltips": {
"autoLaunchAdmin": "Administrator mode may not support auto launch"
},
"badges": {
"adminMode": "Administrator Mode",
"serviceMode": "Service Mode",
-1
View File
@@ -15,7 +15,6 @@
"systemProxy": "System Proxy"
},
"tooltips": {
"autoLaunchAdmin": "Administrator mode may not support auto launch",
"silentStart": "Start the program in background mode without displaying the panel"
},
"fields": {
-3
View File
@@ -62,9 +62,6 @@
"actions": {
"settings": "Ajustes"
},
"tooltips": {
"autoLaunchAdmin": "El modo de administrador puede no admitir el inicio automático."
},
"badges": {
"adminMode": "Modo de administrador",
"serviceMode": "Modo de servicio",
-1
View File
@@ -15,7 +15,6 @@
"systemProxy": "Proxy del sistema"
},
"tooltips": {
"autoLaunchAdmin": "El modo de administrador puede no admitir el inicio automático.",
"silentStart": "El programa se ejecutará en segundo plano al iniciarse y no mostrará el panel."
},
"fields": {
-3
View File
@@ -62,9 +62,6 @@
"actions": {
"settings": "تنظیمات"
},
"tooltips": {
"autoLaunchAdmin": "Administrator mode may not support auto launch"
},
"badges": {
"adminMode": "Administrator Mode",
"serviceMode": "حالت سرویس",
-1
View File
@@ -15,7 +15,6 @@
"systemProxy": "پراکسی سیستم"
},
"tooltips": {
"autoLaunchAdmin": "حالت ادمین ممکن است از راه‌اندازی خودکار پشتیبانی نکند",
"silentStart": "برنامه را در حالت پس‌زمینه بدون نمایش پانل اجرا کنید"
},
"fields": {
-3
View File
@@ -62,9 +62,6 @@
"actions": {
"settings": "Pengaturan"
},
"tooltips": {
"autoLaunchAdmin": "Administrator mode may not support auto launch"
},
"badges": {
"adminMode": "Administrator Mode",
"serviceMode": "Mode Layanan",
-1
View File
@@ -15,7 +15,6 @@
"systemProxy": "Proksi Sistem"
},
"tooltips": {
"autoLaunchAdmin": "Administrator mode may not support auto launch",
"silentStart": "Mulai program dalam mode latar belakang tanpa menampilkan panel"
},
"fields": {
-3
View File
@@ -62,9 +62,6 @@
"actions": {
"settings": "設定"
},
"tooltips": {
"autoLaunchAdmin": "管理者モードでは起動時の自動起動がサポートされない場合があります。"
},
"badges": {
"adminMode": "管理者モード",
"serviceMode": "サービスモード",
-1
View File
@@ -15,7 +15,6 @@
"systemProxy": "システムプロキシ"
},
"tooltips": {
"autoLaunchAdmin": "管理者モードでは起動時の自動起動がサポートされない場合があります。",
"silentStart": "アプリケーションを起動すると、バックグラウンドモードで実行され、アプリケーションパネルは表示されません。"
},
"fields": {
-3
View File
@@ -62,9 +62,6 @@
"actions": {
"settings": "설정"
},
"tooltips": {
"autoLaunchAdmin": "관리자 모드에서는 자동 실행이 지원되지 않을 수 있습니다"
},
"badges": {
"adminMode": "관리자 모드",
"serviceMode": "서비스 모드",
-1
View File
@@ -15,7 +15,6 @@
"systemProxy": "시스템 프록시"
},
"tooltips": {
"autoLaunchAdmin": "관리자 모드에서는 자동 실행이 지원되지 않을 수 있습니다",
"silentStart": "패널을 표시하지 않고 백그라운드에서 시작합니다"
},
"fields": {
-3
View File
@@ -62,9 +62,6 @@
"actions": {
"settings": "Настройки"
},
"tooltips": {
"autoLaunchAdmin": "Administrator mode may not support auto launch"
},
"badges": {
"adminMode": "Administrator Mode",
"serviceMode": "Режим системной службы",
-1
View File
@@ -15,7 +15,6 @@
"systemProxy": "Системный прокси"
},
"tooltips": {
"autoLaunchAdmin": "Administrator mode may not support auto launch",
"silentStart": "Запускать программу в фоновом режиме без отображения панели"
},
"fields": {
-3
View File
@@ -62,9 +62,6 @@
"actions": {
"settings": "Ayarlar"
},
"tooltips": {
"autoLaunchAdmin": "Yönetici modu otomatik başlatmayı desteklemeyebilir"
},
"badges": {
"adminMode": "Yönetici Modu",
"serviceMode": "Hizmet Modu",
-1
View File
@@ -15,7 +15,6 @@
"systemProxy": "Sistem Vekil'i"
},
"tooltips": {
"autoLaunchAdmin": "Yönetici modu otomatik başlatmayı desteklemeyebilir",
"silentStart": "Programı paneli görüntülemeden arka plan modunda başlatır"
},
"fields": {
-3
View File
@@ -62,9 +62,6 @@
"actions": {
"settings": "Көйләүләр"
},
"tooltips": {
"autoLaunchAdmin": "Administrator mode may not support auto launch"
},
"badges": {
"adminMode": "Administrator Mode",
"serviceMode": "Сервис режимы",
-1
View File
@@ -15,7 +15,6 @@
"systemProxy": "Системалы прокси"
},
"tooltips": {
"autoLaunchAdmin": "Administrator mode may not support auto launch",
"silentStart": "Программаны фоновый режимда, тәрәзәсез эшләтеп җибәрү"
},
"fields": {
-3
View File
@@ -62,9 +62,6 @@
"actions": {
"settings": "设置"
},
"tooltips": {
"autoLaunchAdmin": "管理员模式可能不支持开机自启"
},
"badges": {
"adminMode": "管理员模式",
"serviceMode": "服务模式",
-1
View File
@@ -15,7 +15,6 @@
"systemProxy": "系统代理"
},
"tooltips": {
"autoLaunchAdmin": "管理员模式可能不支持开机自启",
"silentStart": "程序启动时以后台模式运行,不显示程序面板"
},
"fields": {
-3
View File
@@ -62,9 +62,6 @@
"actions": {
"settings": "設定"
},
"tooltips": {
"autoLaunchAdmin": "管理員模式可能不支援開機自啟"
},
"badges": {
"adminMode": "管理員模式",
"serviceMode": "服務模式",
-1
View File
@@ -15,7 +15,6 @@
"systemProxy": "系統代理"
},
"tooltips": {
"autoLaunchAdmin": "管理員模式可能不支援開機自啟",
"silentStart": "程序啟動時以後台模式執行,不顯示程序面板"
},
"fields": {
-2
View File
@@ -59,7 +59,6 @@ export const translationKeys = [
"home.components.systemInfo.fields.lastCheckUpdate",
"home.components.systemInfo.fields.vergeVersion",
"home.components.systemInfo.actions.settings",
"home.components.systemInfo.tooltips.autoLaunchAdmin",
"home.components.systemInfo.badges.adminMode",
"home.components.systemInfo.badges.serviceMode",
"home.components.systemInfo.badges.sidecarMode",
@@ -320,7 +319,6 @@ export const translationKeys = [
"settings.sections.system.title",
"settings.sections.system.toggles.tunMode",
"settings.sections.system.toggles.systemProxy",
"settings.sections.system.tooltips.autoLaunchAdmin",
"settings.sections.system.tooltips.silentStart",
"settings.sections.system.fields.autoLaunch",
"settings.sections.system.fields.silentStart",
-4
View File
@@ -124,9 +124,6 @@ export interface TranslationResources {
vergeVersion: string;
};
title: string;
tooltips: {
autoLaunchAdmin: string;
};
};
tests: {
title: string;
@@ -1166,7 +1163,6 @@ export interface TranslationResources {
tunMode: string;
};
tooltips: {
autoLaunchAdmin: string;
silentStart: string;
};
};