mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 00:35:38 +08:00
perf: improve install status detection to ensure frontend consistency
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
- 安装服务模式后无法立即开启 TUN 模式
|
- 安装服务模式后无法立即开启 TUN 模式
|
||||||
|
|
||||||
#### 新增了:
|
#### 新增了:
|
||||||
- Mihomo(Meta)内核升级至 1.19.7
|
- Mihomo(Meta)内核升级至 1.19.8
|
||||||
- 允许代理主机地址设置为非 127.0.0.1 对 WSL 代理友好
|
- 允许代理主机地址设置为非 127.0.0.1 对 WSL 代理友好
|
||||||
- 关闭系统代理时关闭已建立的网络连接
|
- 关闭系统代理时关闭已建立的网络连接
|
||||||
- 托盘显示当前轻量模式状态
|
- 托盘显示当前轻量模式状态
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
- 支持手动卸载服务模式,回退到 Sidecar 模式
|
- 支持手动卸载服务模式,回退到 Sidecar 模式
|
||||||
- 优化了其他语言的翻译问题!
|
- 优化了其他语言的翻译问题!
|
||||||
- 添加了土耳其语,日本语,德语,西班牙语的支持 向着 i18 更进了一步 (●ˇ∀ˇ●) (后续可添加其他国家语言)
|
- 添加了土耳其语,日本语,德语,西班牙语的支持 向着 i18 更进了一步 (●ˇ∀ˇ●) (后续可添加其他国家语言)
|
||||||
|
- 卸载服务的按钮
|
||||||
|
|
||||||
#### 优化了:
|
#### 优化了:
|
||||||
- 系统代理 Bypass 设置
|
- 系统代理 Bypass 设置
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ pub async fn stop_core() -> CmdResult {
|
|||||||
wrap_err!(CoreManager::global().stop_core().await)
|
wrap_err!(CoreManager::global().stop_core().await)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// 重启核心
|
/// 重启核心
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn restart_core() -> CmdResult {
|
pub async fn restart_core() -> CmdResult {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
useTheme,
|
useTheme,
|
||||||
Fade,
|
Fade,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { useState, useMemo, memo, FC } from "react";
|
import { useState, useMemo, memo, FC, useEffect } from "react";
|
||||||
import ProxyControlSwitches from "@/components/shared/ProxyControlSwitches";
|
import ProxyControlSwitches from "@/components/shared/ProxyControlSwitches";
|
||||||
import {
|
import {
|
||||||
ComputerRounded,
|
ComputerRounded,
|
||||||
@@ -20,6 +20,8 @@ import {
|
|||||||
import { useVerge } from "@/hooks/use-verge";
|
import { useVerge } from "@/hooks/use-verge";
|
||||||
import { useSystemState } from "@/hooks/use-system-state";
|
import { useSystemState } from "@/hooks/use-system-state";
|
||||||
import { showNotice } from "@/services/noticeService";
|
import { showNotice } from "@/services/noticeService";
|
||||||
|
import { isServiceAvailable } from "@/services/cmds";
|
||||||
|
import { mutate } from "swr";
|
||||||
|
|
||||||
const LOCAL_STORAGE_TAB_KEY = "clash-verge-proxy-active-tab";
|
const LOCAL_STORAGE_TAB_KEY = "clash-verge-proxy-active-tab";
|
||||||
|
|
||||||
@@ -31,7 +33,7 @@ interface TabButtonProps {
|
|||||||
hasIndicator?: boolean;
|
hasIndicator?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 抽取Tab组件以减少重复代码
|
// Tab组件
|
||||||
const TabButton: FC<TabButtonProps> = memo(
|
const TabButton: FC<TabButtonProps> = memo(
|
||||||
({ isActive, onClick, icon: Icon, label, hasIndicator = false }) => (
|
({ isActive, onClick, icon: Icon, label, hasIndicator = false }) => (
|
||||||
<Paper
|
<Paper
|
||||||
@@ -96,7 +98,7 @@ interface TabDescriptionProps {
|
|||||||
tooltipTitle: string;
|
tooltipTitle: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 抽取描述文本组件
|
// 描述文本组件
|
||||||
const TabDescription: FC<TabDescriptionProps> = memo(
|
const TabDescription: FC<TabDescriptionProps> = memo(
|
||||||
({ description, tooltipTitle }) => (
|
({ description, tooltipTitle }) => (
|
||||||
<Fade in={true} timeout={200}>
|
<Fade in={true} timeout={200}>
|
||||||
@@ -138,29 +140,42 @@ export const ProxyTunCard: FC = () => {
|
|||||||
const [activeTab, setActiveTab] = useState<string>(
|
const [activeTab, setActiveTab] = useState<string>(
|
||||||
() => localStorage.getItem(LOCAL_STORAGE_TAB_KEY) || "system",
|
() => localStorage.getItem(LOCAL_STORAGE_TAB_KEY) || "system",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const [localServiceOk, setLocalServiceOk] = useState(false);
|
||||||
|
|
||||||
// 获取代理状态信息
|
|
||||||
const { verge } = useVerge();
|
const { verge } = useVerge();
|
||||||
const { isSidecarMode, isAdminMode } = useSystemState();
|
const { isAdminMode } = useSystemState();
|
||||||
|
|
||||||
// 从verge配置中获取开关状态
|
|
||||||
const { enable_system_proxy, enable_tun_mode } = verge ?? {};
|
const { enable_system_proxy, enable_tun_mode } = verge ?? {};
|
||||||
|
|
||||||
// 判断Tun模式是否可用 - 当处于服务模式或管理员模式时可用
|
const updateLocalStatus = async () => {
|
||||||
const isTunAvailable = !isSidecarMode || isAdminMode;
|
try {
|
||||||
|
const serviceStatus = await isServiceAvailable();
|
||||||
|
setLocalServiceOk(serviceStatus);
|
||||||
|
mutate("isServiceAvailable", serviceStatus, false);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("更新TUN状态失败:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
updateLocalStatus();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const isTunAvailable = localServiceOk || isAdminMode;
|
||||||
|
|
||||||
// 处理错误
|
|
||||||
const handleError = (err: Error) => {
|
const handleError = (err: Error) => {
|
||||||
showNotice('error', err.message || err.toString(), 3000);
|
showNotice('error', err.message || err.toString());
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理标签切换并保存到localStorage
|
|
||||||
const handleTabChange = (tab: string) => {
|
const handleTabChange = (tab: string) => {
|
||||||
setActiveTab(tab);
|
setActiveTab(tab);
|
||||||
localStorage.setItem(LOCAL_STORAGE_TAB_KEY, tab);
|
localStorage.setItem(LOCAL_STORAGE_TAB_KEY, tab);
|
||||||
|
if (tab === "tun") {
|
||||||
|
updateLocalStatus();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 用户提示文本 - 使用useMemo避免重复计算
|
|
||||||
const tabDescription = useMemo(() => {
|
const tabDescription = useMemo(() => {
|
||||||
if (activeTab === "system") {
|
if (activeTab === "system") {
|
||||||
return {
|
return {
|
||||||
@@ -183,7 +198,6 @@ export const ProxyTunCard: FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box sx={{ display: "flex", flexDirection: "column", width: "100%" }}>
|
<Box sx={{ display: "flex", flexDirection: "column", width: "100%" }}>
|
||||||
{/* 选项卡 */}
|
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
spacing={1}
|
spacing={1}
|
||||||
@@ -210,7 +224,6 @@ export const ProxyTunCard: FC = () => {
|
|||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
{/* 说明文本区域 */}
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
@@ -227,7 +240,6 @@ export const ProxyTunCard: FC = () => {
|
|||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{/* 控制开关部分 */}
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
mt: 0,
|
mt: 0,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import useSWR, { mutate } from "swr";
|
import useSWR, { mutate } from "swr";
|
||||||
import { useRef, useEffect } from "react";
|
import { useRef, useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
SettingsRounded,
|
SettingsRounded,
|
||||||
@@ -22,8 +22,8 @@ import {
|
|||||||
installService,
|
installService,
|
||||||
uninstallService,
|
uninstallService,
|
||||||
restartCore,
|
restartCore,
|
||||||
startCore,
|
|
||||||
stopCore,
|
stopCore,
|
||||||
|
isServiceAvailable,
|
||||||
} from "@/services/cmds";
|
} from "@/services/cmds";
|
||||||
import { useLockFn } from "ahooks";
|
import { useLockFn } from "ahooks";
|
||||||
import { Button, Tooltip } from "@mui/material";
|
import { Button, Tooltip } from "@mui/material";
|
||||||
@@ -43,11 +43,29 @@ const SettingSystem = ({ onError }: Props) => {
|
|||||||
const { data: sysproxy } = useSWR("getSystemProxy", getSystemProxy);
|
const { data: sysproxy } = useSWR("getSystemProxy", getSystemProxy);
|
||||||
const { data: autoproxy } = useSWR("getAutotemProxy", getAutotemProxy);
|
const { data: autoproxy } = useSWR("getAutotemProxy", getAutotemProxy);
|
||||||
|
|
||||||
const { isAdminMode, isSidecarMode, mutateRunningMode, isServiceOk } =
|
const { isAdminMode, isSidecarMode, mutateRunningMode } = useSystemState();
|
||||||
useSystemState();
|
|
||||||
|
// 添加本地服务状态
|
||||||
|
const [localServiceOk, setLocalServiceOk] = useState(false);
|
||||||
|
|
||||||
|
// 更新本地服务状态
|
||||||
|
const updateLocalStatus = async () => {
|
||||||
|
try {
|
||||||
|
const serviceStatus = await isServiceAvailable();
|
||||||
|
setLocalServiceOk(serviceStatus);
|
||||||
|
mutate("isServiceAvailable", serviceStatus, false);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("更新TUN状态失败:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 组件挂载时更新状态
|
||||||
|
useEffect(() => {
|
||||||
|
updateLocalStatus();
|
||||||
|
}, []);
|
||||||
|
|
||||||
// 判断Tun模式是否可用 - 当处于服务模式或管理员模式时可用
|
// 判断Tun模式是否可用 - 当处于服务模式或管理员模式时可用
|
||||||
const isTunAvailable = isServiceOk || (isSidecarMode && !isAdminMode);
|
const isTunAvailable = localServiceOk || isAdminMode;
|
||||||
|
|
||||||
console.log("is tun isTunAvailable:", isTunAvailable);
|
console.log("is tun isTunAvailable:", isTunAvailable);
|
||||||
|
|
||||||
@@ -68,7 +86,6 @@ const SettingSystem = ({ onError }: Props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const updateProxyStatus = async () => {
|
const updateProxyStatus = async () => {
|
||||||
// 等待一小段时间让系统代理状态变化
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||||
await mutate("getSystemProxy");
|
await mutate("getSystemProxy");
|
||||||
await mutate("getAutotemProxy");
|
await mutate("getAutotemProxy");
|
||||||
@@ -90,22 +107,24 @@ const SettingSystem = ({ onError }: Props) => {
|
|||||||
}
|
}
|
||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
showNotice("info", t(beforeMsg), 1000);
|
showNotice("info", t(beforeMsg));
|
||||||
await stopCore();
|
await stopCore();
|
||||||
showNotice("info", t(actionMsg), 1000);
|
showNotice("info", t(actionMsg));
|
||||||
await action();
|
await action();
|
||||||
showNotice("success", t(successMsg), 2000);
|
showNotice("success", t(successMsg));
|
||||||
showNotice("info", t("Starting Core..."), 1000);
|
showNotice("info", t("Restarting Core..."));
|
||||||
await startCore();
|
await restartCore();
|
||||||
await mutateRunningMode();
|
await mutateRunningMode();
|
||||||
|
await updateLocalStatus();
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
showNotice("error", err.message || err.toString(), 3000);
|
showNotice("error", err.message || err.toString());
|
||||||
try {
|
try {
|
||||||
showNotice("info", t("Try running core as Sidecar..."), 1000);
|
showNotice("info", t("Try running core as Sidecar..."));
|
||||||
await startCore();
|
await restartCore();
|
||||||
await mutateRunningMode();
|
await mutateRunningMode();
|
||||||
|
await updateLocalStatus();
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
showNotice("error", e?.message || e?.toString(), 3000);
|
showNotice("error", e?.message || e?.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,19 +133,19 @@ const SettingSystem = ({ onError }: Props) => {
|
|||||||
// 安装系统服务
|
// 安装系统服务
|
||||||
const onInstallService = () =>
|
const onInstallService = () =>
|
||||||
handleServiceOperation({
|
handleServiceOperation({
|
||||||
beforeMsg: "Stopping Core...",
|
beforeMsg: t("Stopping Core..."),
|
||||||
action: installService,
|
action: installService,
|
||||||
actionMsg: "Installing Service...",
|
actionMsg: t("Installing Service..."),
|
||||||
successMsg: "Service Installed Successfully",
|
successMsg: t("Service Installed Successfully"),
|
||||||
});
|
});
|
||||||
|
|
||||||
// 卸载系统服务
|
// 卸载系统服务
|
||||||
const onUninstallService = () =>
|
const onUninstallService = () =>
|
||||||
handleServiceOperation({
|
handleServiceOperation({
|
||||||
beforeMsg: "Stopping Core...",
|
beforeMsg: t("Stopping Core..."),
|
||||||
action: uninstallService,
|
action: uninstallService,
|
||||||
actionMsg: "Uninstalling Service...",
|
actionMsg: t("Uninstalling Service..."),
|
||||||
successMsg: "Service Uninstalled Successfully",
|
successMsg: t("Service Uninstalled Successfully"),
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -143,12 +162,12 @@ const SettingSystem = ({ onError }: Props) => {
|
|||||||
icon={SettingsRounded}
|
icon={SettingsRounded}
|
||||||
onClick={() => tunRef.current?.open()}
|
onClick={() => tunRef.current?.open()}
|
||||||
/>
|
/>
|
||||||
{!isServiceOk && !isAdminMode && (
|
{!isTunAvailable && (
|
||||||
<Tooltip title={t("TUN requires Service Mode")}>
|
<Tooltip title={t("TUN requires Service Mode or Admin Mode")}>
|
||||||
<WarningRounded sx={{ color: "warning.main", mr: 1 }} />
|
<WarningRounded sx={{ color: "warning.main", mr: 1 }} />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
{!isServiceOk && !isAdminMode && (
|
{!localServiceOk && !isAdminMode && (
|
||||||
<Tooltip title={t("Install Service")}>
|
<Tooltip title={t("Install Service")}>
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
@@ -162,7 +181,7 @@ const SettingSystem = ({ onError }: Props) => {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
{
|
{
|
||||||
isServiceOk && (
|
localServiceOk && (
|
||||||
<Tooltip title={t("Uninstall Service")}>
|
<Tooltip title={t("Uninstall Service")}>
|
||||||
<Button
|
<Button
|
||||||
// variant="outlined"
|
// variant="outlined"
|
||||||
@@ -185,20 +204,18 @@ const SettingSystem = ({ onError }: Props) => {
|
|||||||
onCatch={onError}
|
onCatch={onError}
|
||||||
onFormat={onSwitchFormat}
|
onFormat={onSwitchFormat}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
// 非 Service 状态禁止切换
|
if (!isTunAvailable) return;
|
||||||
if (!isServiceOk) return;
|
|
||||||
onChangeData({ enable_tun_mode: e });
|
onChangeData({ enable_tun_mode: e });
|
||||||
}}
|
}}
|
||||||
onGuard={(e) => {
|
onGuard={(e) => {
|
||||||
// 非 Service 状态禁止切换
|
if (!isTunAvailable) {
|
||||||
if (!isServiceOk) {
|
showNotice("error", t("TUN requires Service Mode or Admin Mode"));
|
||||||
showNotice("error", t("TUN requires Service Mode"), 2000);
|
return Promise.reject(new Error(t("TUN requires Service Mode or Admin Mode")));
|
||||||
return Promise.reject(new Error(t("TUN requires Service Mode")));
|
|
||||||
}
|
}
|
||||||
return patchVerge({ enable_tun_mode: e });
|
return patchVerge({ enable_tun_mode: e });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Switch edge="end" disabled={!isServiceOk} />
|
<Switch edge="end" disabled={!isTunAvailable} />
|
||||||
</GuardState>
|
</GuardState>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
<SettingItem
|
<SettingItem
|
||||||
@@ -268,15 +285,13 @@ const SettingSystem = ({ onError }: Props) => {
|
|||||||
showNotice(
|
showNotice(
|
||||||
"info",
|
"info",
|
||||||
t("Administrator mode may not support auto launch"),
|
t("Administrator mode may not support auto launch"),
|
||||||
2000,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 在应用更改之前先触发UI更新,让用户立即看到反馈
|
// 先触发UI更新立即看到反馈
|
||||||
onChangeData({ enable_auto_launch: e });
|
onChangeData({ enable_auto_launch: e });
|
||||||
await patchVerge({ enable_auto_launch: e });
|
await patchVerge({ enable_auto_launch: e });
|
||||||
// 更新实际状态
|
|
||||||
await mutate("getAutoLaunchStatus");
|
await mutate("getAutoLaunchStatus");
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import {
|
|||||||
getAutotemProxy,
|
getAutotemProxy,
|
||||||
getRunningMode,
|
getRunningMode,
|
||||||
installService,
|
installService,
|
||||||
|
restartCore,
|
||||||
|
isServiceAvailable,
|
||||||
} from "@/services/cmds";
|
} from "@/services/cmds";
|
||||||
import { useLockFn } from "ahooks";
|
import { useLockFn } from "ahooks";
|
||||||
import { closeAllConnections } from "@/services/api";
|
import { closeAllConnections } from "@/services/api";
|
||||||
@@ -70,7 +72,6 @@ const ProxyControlSwitches = ({ label, onError }: ProxySwitchProps) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const updateProxyStatus = async () => {
|
const updateProxyStatus = async () => {
|
||||||
// 等待一小段时间让系统代理状态变化
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||||
await mutate("getSystemProxy");
|
await mutate("getSystemProxy");
|
||||||
await mutate("getAutotemProxy");
|
await mutate("getAutotemProxy");
|
||||||
@@ -79,13 +80,46 @@ const ProxyControlSwitches = ({ label, onError }: ProxySwitchProps) => {
|
|||||||
// 安装系统服务
|
// 安装系统服务
|
||||||
const onInstallService = useLockFn(async () => {
|
const onInstallService = useLockFn(async () => {
|
||||||
try {
|
try {
|
||||||
showNotice('info', t("Installing Service..."), 1000);
|
showNotice('info', t("Installing Service..."));
|
||||||
await installService();
|
await installService();
|
||||||
showNotice('success', t("Service Installed Successfully"), 2000);
|
showNotice('success', t("Service Installed Successfully"));
|
||||||
|
|
||||||
|
showNotice('info', t("Waiting for service to be ready..."));
|
||||||
|
|
||||||
|
let serviceReady = false;
|
||||||
|
for (let i = 0; i < 5; i++) {
|
||||||
|
try {
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||||
|
const isAvailable = await isServiceAvailable();
|
||||||
|
|
||||||
|
if (isAvailable) {
|
||||||
|
serviceReady = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
showNotice('info', t("Service not ready, retrying..."));
|
||||||
|
} catch (error) {
|
||||||
|
console.error("检查服务状态失败:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
showNotice('info', t("Restarting Core..."));
|
||||||
|
await restartCore();
|
||||||
|
|
||||||
// 重新获取运行模式
|
// 重新获取运行模式
|
||||||
await mutateRunningMode();
|
await mutateRunningMode();
|
||||||
|
|
||||||
|
// 更新服务状态
|
||||||
|
const serviceStatus = await isServiceAvailable();
|
||||||
|
mutate("isServiceAvailable", serviceStatus, false);
|
||||||
|
|
||||||
|
if (serviceReady) {
|
||||||
|
showNotice('success', t("Service is ready and core restarted"));
|
||||||
|
} else {
|
||||||
|
showNotice('info', t("Service may not be fully ready"));
|
||||||
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
showNotice('error', err.message || err.toString(), 3000);
|
showNotice('error', err.message || err.toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -97,7 +131,7 @@ const ProxyControlSwitches = ({ label, onError }: ProxySwitchProps) => {
|
|||||||
fontSize: "15px",
|
fontSize: "15px",
|
||||||
fontWeight: "500",
|
fontWeight: "500",
|
||||||
mb: 0.5,
|
mb: 0.5,
|
||||||
display: "none", // 隐藏标签,因为在父组件中已经有标签了
|
display: "none",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{label}
|
{label}
|
||||||
@@ -216,7 +250,7 @@ const ProxyControlSwitches = ({ label, onError }: ProxySwitchProps) => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
{/* <Typography variant="caption" color="text.secondary">
|
{/* <Typography variant="caption" color="text.secondary">
|
||||||
{isSidecarMode
|
{isSidecarMode
|
||||||
? t("TUN requires Service Mode")
|
? t("TUN requires Service Mode or Admin Mode")
|
||||||
: t("For special applications")
|
: t("For special applications")
|
||||||
}
|
}
|
||||||
</Typography> */}
|
</Typography> */}
|
||||||
@@ -258,21 +292,19 @@ const ProxyControlSwitches = ({ label, onError }: ProxySwitchProps) => {
|
|||||||
onCatch={onError}
|
onCatch={onError}
|
||||||
onFormat={onSwitchFormat}
|
onFormat={onSwitchFormat}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
// 当在sidecar模式下禁用切换
|
|
||||||
if (isSidecarMode) {
|
if (isSidecarMode) {
|
||||||
showNotice('error', t("TUN requires Service Mode"), 2000);
|
showNotice('error', t("TUN requires Service Mode or Admin Mode"));
|
||||||
return Promise.reject(
|
return Promise.reject(
|
||||||
new Error(t("TUN requires Service Mode")),
|
new Error(t("TUN requires Service Mode or Admin Mode")),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
onChangeData({ enable_tun_mode: e });
|
onChangeData({ enable_tun_mode: e });
|
||||||
}}
|
}}
|
||||||
onGuard={(e) => {
|
onGuard={(e) => {
|
||||||
// 当在sidecar模式下禁用切换
|
|
||||||
if (isSidecarMode) {
|
if (isSidecarMode) {
|
||||||
showNotice('error', t("TUN requires Service Mode"), 2000);
|
showNotice('error', t("TUN requires Service Mode or Admin Mode"));
|
||||||
return Promise.reject(
|
return Promise.reject(
|
||||||
new Error(t("TUN requires Service Mode")),
|
new Error(t("TUN requires Service Mode or Admin Mode")),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return patchVerge({ enable_tun_mode: e });
|
return patchVerge({ enable_tun_mode: e });
|
||||||
|
|||||||
@@ -201,7 +201,7 @@
|
|||||||
"Settings": "الإعدادات",
|
"Settings": "الإعدادات",
|
||||||
"System Setting": "إعدادات النظام",
|
"System Setting": "إعدادات النظام",
|
||||||
"Tun Mode": "وضع الشبكة الافتراضية",
|
"Tun Mode": "وضع الشبكة الافتراضية",
|
||||||
"TUN requires Service Mode": "وضع TUN يتطلب تثبيت الخدمة",
|
"TUN requires Service Mode or Admin Mode": "وضع TUN يتطلب تثبيت الخدمة أو الوضع الإداري",
|
||||||
"Install Service": "تثبيت الخدمة",
|
"Install Service": "تثبيت الخدمة",
|
||||||
"Install Service failed": "فشل تثبيت الخدمة",
|
"Install Service failed": "فشل تثبيت الخدمة",
|
||||||
"Restart Core failed": "فشل إعادة تشغيل اللب",
|
"Restart Core failed": "فشل إعادة تشغيل اللب",
|
||||||
|
|||||||
@@ -201,7 +201,7 @@
|
|||||||
"Settings": "Einstellungen",
|
"Settings": "Einstellungen",
|
||||||
"System Setting": "Systemeinstellungen",
|
"System Setting": "Systemeinstellungen",
|
||||||
"Tun Mode": "TUN-Modus",
|
"Tun Mode": "TUN-Modus",
|
||||||
"TUN requires Service Mode": "Der TUN-Modus erfordert die Installation des Dienstes",
|
"TUN requires Service Mode or Admin Mode": "Der TUN-Modus erfordert die Installation des Dienstes oder den Administrator-Modus",
|
||||||
"Install Service": "Dienst installieren",
|
"Install Service": "Dienst installieren",
|
||||||
"Install Service failed": "Dienstinstallation fehlgeschlagen",
|
"Install Service failed": "Dienstinstallation fehlgeschlagen",
|
||||||
"Restart Core failed": "Neustart des Kerns fehlgeschlagen",
|
"Restart Core failed": "Neustart des Kerns fehlgeschlagen",
|
||||||
|
|||||||
@@ -201,7 +201,7 @@
|
|||||||
"Settings": "Settings",
|
"Settings": "Settings",
|
||||||
"System Setting": "System Setting",
|
"System Setting": "System Setting",
|
||||||
"Tun Mode": "Tun Mode",
|
"Tun Mode": "Tun Mode",
|
||||||
"TUN requires Service Mode": "TUN mode requires install service",
|
"TUN requires Service Mode or Admin Mode": "TUN mode requires install service or admin mode",
|
||||||
"Install Service": "Install Service",
|
"Install Service": "Install Service",
|
||||||
"Install Service failed": "Install Service failed",
|
"Install Service failed": "Install Service failed",
|
||||||
"Restart Core failed": "Restart Core failed",
|
"Restart Core failed": "Restart Core failed",
|
||||||
@@ -389,8 +389,15 @@
|
|||||||
"Profile Reactivated": "Profile Reactivated",
|
"Profile Reactivated": "Profile Reactivated",
|
||||||
"Only YAML Files Supported": "Only YAML Files Supported",
|
"Only YAML Files Supported": "Only YAML Files Supported",
|
||||||
"Settings Applied": "Settings Applied",
|
"Settings Applied": "Settings Applied",
|
||||||
|
"Stopping Core...": "Stopping Core...",
|
||||||
|
"Restarting Core...": "Restarting Core...",
|
||||||
"Installing Service...": "Installing Service...",
|
"Installing Service...": "Installing Service...",
|
||||||
"Service Installed Successfully": "Service Installed Successfully",
|
"Service Installed Successfully": "Service Installed Successfully",
|
||||||
|
"Service is ready and core restarted": "Service is ready and core restarted",
|
||||||
|
"Service may not be fully ready": "Service may not be fully ready",
|
||||||
|
"Waiting for service to be ready...": "Waiting for service to be ready...",
|
||||||
|
"Service not ready, retrying...": "Service not ready, retrying...",
|
||||||
|
"Uninstalling Service...": "Uninstalling Service...",
|
||||||
"Service Uninstalled Successfully": "Service Uninstalled Successfully",
|
"Service Uninstalled Successfully": "Service Uninstalled Successfully",
|
||||||
"Proxy Daemon Duration Cannot be Less than 1 Second": "Proxy Daemon Duration Cannot be Less than 1 Second",
|
"Proxy Daemon Duration Cannot be Less than 1 Second": "Proxy Daemon Duration Cannot be Less than 1 Second",
|
||||||
"Invalid Bypass Format": "Invalid Bypass Format",
|
"Invalid Bypass Format": "Invalid Bypass Format",
|
||||||
|
|||||||
@@ -201,7 +201,7 @@
|
|||||||
"Settings": "Ajustes",
|
"Settings": "Ajustes",
|
||||||
"System Setting": "Ajustes del sistema",
|
"System Setting": "Ajustes del sistema",
|
||||||
"Tun Mode": "Modo de interfaz virtual (TUN)",
|
"Tun Mode": "Modo de interfaz virtual (TUN)",
|
||||||
"TUN requires Service Mode": "El modo TUN requiere instalar el servicio",
|
"TUN requires Service Mode or Admin Mode": "El modo TUN requiere instalar el servicio o el modo de administrador",
|
||||||
"Install Service": "Instalar servicio",
|
"Install Service": "Instalar servicio",
|
||||||
"Install Service failed": "Error al instalar el servicio",
|
"Install Service failed": "Error al instalar el servicio",
|
||||||
"Restart Core failed": "Error al reiniciar el núcleo",
|
"Restart Core failed": "Error al reiniciar el núcleo",
|
||||||
|
|||||||
@@ -201,7 +201,7 @@
|
|||||||
"Settings": "تنظیمات",
|
"Settings": "تنظیمات",
|
||||||
"System Setting": "تنظیمات سیستم",
|
"System Setting": "تنظیمات سیستم",
|
||||||
"Tun Mode": "حالت شبکه مجازی",
|
"Tun Mode": "حالت شبکه مجازی",
|
||||||
"TUN requires Service Mode": "حالت TUN نیاز به نصب سرویس دارد",
|
"TUN requires Service Mode or Admin Mode": "حالت TUN نیاز به نصب سرویس دارد",
|
||||||
"Install Service": "نصب سرویس",
|
"Install Service": "نصب سرویس",
|
||||||
"Install Service failed": "نصب سرویس با شکست مواجه شد",
|
"Install Service failed": "نصب سرویس با شکست مواجه شد",
|
||||||
"Restart Core failed": "بازنشانی هسته با شکست مواجه شد",
|
"Restart Core failed": "بازنشانی هسته با شکست مواجه شد",
|
||||||
|
|||||||
@@ -201,7 +201,7 @@
|
|||||||
"Settings": "Pengaturan",
|
"Settings": "Pengaturan",
|
||||||
"System Setting": "Pengaturan sistem",
|
"System Setting": "Pengaturan sistem",
|
||||||
"Tun Mode": "Mode kartu jaringan virtual",
|
"Tun Mode": "Mode kartu jaringan virtual",
|
||||||
"TUN requires Service Mode": "Mode TUN membutuhkan instalasi layanan",
|
"TUN requires Service Mode or Admin Mode": "Mode TUN membutuhkan instalasi layanan",
|
||||||
"Install Service": "Instal layanan",
|
"Install Service": "Instal layanan",
|
||||||
"Install Service failed": "Gagal menginstal layanan",
|
"Install Service failed": "Gagal menginstal layanan",
|
||||||
"Restart Core failed": "Gagal mengulang memulai inti",
|
"Restart Core failed": "Gagal mengulang memulai inti",
|
||||||
|
|||||||
@@ -201,7 +201,7 @@
|
|||||||
"Settings": "設定",
|
"Settings": "設定",
|
||||||
"System Setting": "システム設定",
|
"System Setting": "システム設定",
|
||||||
"Tun Mode": "仮想ネットワークカードモード",
|
"Tun Mode": "仮想ネットワークカードモード",
|
||||||
"TUN requires Service Mode": "TUNモードではサービスのインストールが必要です",
|
"TUN requires Service Mode or Admin Mode": "TUNモードではサービスのインストールが必要です",
|
||||||
"Install Service": "サービスをインストール",
|
"Install Service": "サービスをインストール",
|
||||||
"Install Service failed": "サービスのインストールに失敗しました",
|
"Install Service failed": "サービスのインストールに失敗しました",
|
||||||
"Restart Core failed": "コアの再起動に失敗しました",
|
"Restart Core failed": "コアの再起動に失敗しました",
|
||||||
|
|||||||
@@ -201,7 +201,7 @@
|
|||||||
"Settings": "설정",
|
"Settings": "설정",
|
||||||
"System Setting": "시스템 설정",
|
"System Setting": "시스템 설정",
|
||||||
"Tun Mode": "가상 네트워크 인터페이스 모드",
|
"Tun Mode": "가상 네트워크 인터페이스 모드",
|
||||||
"TUN requires Service Mode": "TUN 모드는 서비스를 설치해야 합니다.",
|
"TUN requires Service Mode or Admin Mode": "TUN 모드는 서비스 모드 또는 관리자 모드를 설치해야 합니다.",
|
||||||
"Install Service": "서비스 설치",
|
"Install Service": "서비스 설치",
|
||||||
"Install Service failed": "서비스 설치 실패",
|
"Install Service failed": "서비스 설치 실패",
|
||||||
"Restart Core failed": "코어 재시작 실패",
|
"Restart Core failed": "코어 재시작 실패",
|
||||||
|
|||||||
@@ -201,7 +201,7 @@
|
|||||||
"Settings": "Настройки",
|
"Settings": "Настройки",
|
||||||
"System Setting": "Системные настройки",
|
"System Setting": "Системные настройки",
|
||||||
"Tun Mode": "Режим виртуального сетевого интерфейса (TUN)",
|
"Tun Mode": "Режим виртуального сетевого интерфейса (TUN)",
|
||||||
"TUN requires Service Mode": "Для режима TUN необходимо установить службу",
|
"TUN requires Service Mode or Admin Mode": "Для режима TUN необходимо установить службу или режим администратора",
|
||||||
"Install Service": "Установить службу",
|
"Install Service": "Установить службу",
|
||||||
"Install Service failed": "Не удалось установить службу",
|
"Install Service failed": "Не удалось установить службу",
|
||||||
"Restart Core failed": "Не удалось перезапустить ядро",
|
"Restart Core failed": "Не удалось перезапустить ядро",
|
||||||
|
|||||||
@@ -201,7 +201,7 @@
|
|||||||
"Settings": "Ayarlar",
|
"Settings": "Ayarlar",
|
||||||
"System Setting": "Sistem Ayarları",
|
"System Setting": "Sistem Ayarları",
|
||||||
"Tun Mode": "Tun Modu",
|
"Tun Mode": "Tun Modu",
|
||||||
"TUN requires Service Mode": "TUN modu hizmet kurulumu gerektirir",
|
"TUN requires Service Mode or Admin Mode": "TUN modu hizmet kurulumu gerektirir",
|
||||||
"Install Service": "Hizmeti Kur",
|
"Install Service": "Hizmeti Kur",
|
||||||
"Install Service failed": "Hizmet kurulumu başarısız oldu",
|
"Install Service failed": "Hizmet kurulumu başarısız oldu",
|
||||||
"Restart Core failed": "Çekirdek yeniden başlatma başarısız oldu",
|
"Restart Core failed": "Çekirdek yeniden başlatma başarısız oldu",
|
||||||
|
|||||||
@@ -201,7 +201,7 @@
|
|||||||
"Settings": "Сакламалар",
|
"Settings": "Сакламалар",
|
||||||
"System Setting": "Тизим сакламалары",
|
"System Setting": "Тизим сакламалары",
|
||||||
"Tun Mode": "Виртуал кырдау түре",
|
"Tun Mode": "Виртуал кырдау түре",
|
||||||
"TUN requires Service Mode": "TUN түре хизмәт түрене тиеш",
|
"TUN requires Service Mode or Admin Mode": "TUN түре хизмәт түрене тиеш",
|
||||||
"Install Service": "Хизмәт орнату",
|
"Install Service": "Хизмәт орнату",
|
||||||
"Install Service failed": "Хизмәт орнату бузылган",
|
"Install Service failed": "Хизмәт орнату бузылган",
|
||||||
"Restart Core failed": "Нүкте қайтарак иске яздыру бузылган",
|
"Restart Core failed": "Нүкте қайтарак иске яздыру бузылган",
|
||||||
|
|||||||
@@ -201,7 +201,7 @@
|
|||||||
"Settings": "设置",
|
"Settings": "设置",
|
||||||
"System Setting": "系统设置",
|
"System Setting": "系统设置",
|
||||||
"Tun Mode": "虚拟网卡模式",
|
"Tun Mode": "虚拟网卡模式",
|
||||||
"TUN requires Service Mode": "TUN 模式需要安装服务",
|
"TUN requires Service Mode or Admin Mode": "TUN 模式需要安装服务或管理员模式",
|
||||||
"Install Service": "安装服务",
|
"Install Service": "安装服务",
|
||||||
"Install Service failed": "安装服务失败",
|
"Install Service failed": "安装服务失败",
|
||||||
"Restart Core failed": "重启核心失败",
|
"Restart Core failed": "重启核心失败",
|
||||||
@@ -389,8 +389,15 @@
|
|||||||
"Profile Reactivated": "订阅已激活",
|
"Profile Reactivated": "订阅已激活",
|
||||||
"Only YAML Files Supported": "仅支持 YAML 文件",
|
"Only YAML Files Supported": "仅支持 YAML 文件",
|
||||||
"Settings Applied": "设置已应用",
|
"Settings Applied": "设置已应用",
|
||||||
|
"Stopping Core...": "内核停止中...",
|
||||||
|
"Restarting Core...": "内核重启中...",
|
||||||
"Installing Service...": "安装服务中...",
|
"Installing Service...": "安装服务中...",
|
||||||
"Service Installed Successfully": "已成功安装服务",
|
"Service Installed Successfully": "已成功安装服务",
|
||||||
|
"Service is ready and core restarted": "服务已就绪,内核已重启",
|
||||||
|
"Service may not be fully ready": "服务可能未完全就绪",
|
||||||
|
"Uninstalling Service...": "服务卸载中...",
|
||||||
|
"Waiting for service to be ready...": "等待服务就绪...",
|
||||||
|
"Service not ready, retrying...": "服务未就绪,重试中...",
|
||||||
"Service Uninstalled Successfully": "已成功卸载服务",
|
"Service Uninstalled Successfully": "已成功卸载服务",
|
||||||
"Proxy Daemon Duration Cannot be Less than 1 Second": "代理守护间隔时间不得低于 1 秒",
|
"Proxy Daemon Duration Cannot be Less than 1 Second": "代理守护间隔时间不得低于 1 秒",
|
||||||
"Invalid Bypass Format": "无效的代理绕过格式",
|
"Invalid Bypass Format": "无效的代理绕过格式",
|
||||||
|
|||||||
Reference in New Issue
Block a user