|
@@ -1,4 +1,5 @@
|
|
import useSWR, { useSWRConfig } from "swr";
|
|
import useSWR, { useSWRConfig } from "swr";
|
|
|
|
+import { useTranslation } from "react-i18next";
|
|
import { Box, ListItemText, Switch, TextField } from "@mui/material";
|
|
import { Box, ListItemText, Switch, TextField } from "@mui/material";
|
|
import { getVergeConfig, patchVergeConfig } from "../../services/cmds";
|
|
import { getVergeConfig, patchVergeConfig } from "../../services/cmds";
|
|
import { SettingList, SettingItem } from "./setting";
|
|
import { SettingList, SettingItem } from "./setting";
|
|
@@ -11,15 +12,16 @@ interface Props {
|
|
}
|
|
}
|
|
|
|
|
|
const SettingSystem = ({ onError }: Props) => {
|
|
const SettingSystem = ({ onError }: Props) => {
|
|
|
|
+ const { t } = useTranslation();
|
|
const { mutate } = useSWRConfig();
|
|
const { mutate } = useSWRConfig();
|
|
const { data: vergeConfig } = useSWR("getVergeConfig", getVergeConfig);
|
|
const { data: vergeConfig } = useSWR("getVergeConfig", getVergeConfig);
|
|
|
|
|
|
const {
|
|
const {
|
|
- enable_tun_mode = false,
|
|
|
|
- enable_auto_launch = false,
|
|
|
|
- enable_system_proxy = false,
|
|
|
|
- system_proxy_bypass = "",
|
|
|
|
- enable_proxy_guard = false,
|
|
|
|
|
|
+ enable_tun_mode,
|
|
|
|
+ enable_auto_launch,
|
|
|
|
+ enable_system_proxy,
|
|
|
|
+ system_proxy_bypass,
|
|
|
|
+ enable_proxy_guard,
|
|
} = vergeConfig ?? {};
|
|
} = vergeConfig ?? {};
|
|
|
|
|
|
const onSwitchFormat = (_e: any, value: boolean) => value;
|
|
const onSwitchFormat = (_e: any, value: boolean) => value;
|
|
@@ -28,11 +30,11 @@ const SettingSystem = ({ onError }: Props) => {
|
|
};
|
|
};
|
|
|
|
|
|
return (
|
|
return (
|
|
- <SettingList title="System Setting">
|
|
|
|
|
|
+ <SettingList title={t("System Setting")}>
|
|
<SettingItem>
|
|
<SettingItem>
|
|
- <ListItemText primary="Tun Mode" />
|
|
|
|
|
|
+ <ListItemText primary={t("Tun Mode")} />
|
|
<GuardState
|
|
<GuardState
|
|
- value={enable_tun_mode}
|
|
|
|
|
|
+ value={enable_tun_mode ?? false}
|
|
valueProps="checked"
|
|
valueProps="checked"
|
|
onCatch={onError}
|
|
onCatch={onError}
|
|
onFormat={onSwitchFormat}
|
|
onFormat={onSwitchFormat}
|
|
@@ -44,9 +46,9 @@ const SettingSystem = ({ onError }: Props) => {
|
|
</SettingItem>
|
|
</SettingItem>
|
|
|
|
|
|
<SettingItem>
|
|
<SettingItem>
|
|
- <ListItemText primary="Auto Launch" />
|
|
|
|
|
|
+ <ListItemText primary={t("Auto Launch")} />
|
|
<GuardState
|
|
<GuardState
|
|
- value={enable_auto_launch}
|
|
|
|
|
|
+ value={enable_auto_launch ?? false}
|
|
valueProps="checked"
|
|
valueProps="checked"
|
|
onCatch={onError}
|
|
onCatch={onError}
|
|
onFormat={onSwitchFormat}
|
|
onFormat={onSwitchFormat}
|
|
@@ -61,13 +63,13 @@ const SettingSystem = ({ onError }: Props) => {
|
|
<ListItemText
|
|
<ListItemText
|
|
primary={
|
|
primary={
|
|
<Box sx={{ display: "flex", alignItems: "center" }}>
|
|
<Box sx={{ display: "flex", alignItems: "center" }}>
|
|
- System Proxy
|
|
|
|
|
|
+ {t("System Proxy")}
|
|
<SysproxyTooltip />
|
|
<SysproxyTooltip />
|
|
</Box>
|
|
</Box>
|
|
}
|
|
}
|
|
/>
|
|
/>
|
|
<GuardState
|
|
<GuardState
|
|
- value={enable_system_proxy}
|
|
|
|
|
|
+ value={enable_system_proxy ?? false}
|
|
valueProps="checked"
|
|
valueProps="checked"
|
|
onCatch={onError}
|
|
onCatch={onError}
|
|
onFormat={onSwitchFormat}
|
|
onFormat={onSwitchFormat}
|
|
@@ -83,9 +85,9 @@ const SettingSystem = ({ onError }: Props) => {
|
|
|
|
|
|
{enable_system_proxy && (
|
|
{enable_system_proxy && (
|
|
<SettingItem>
|
|
<SettingItem>
|
|
- <ListItemText primary="Proxy Guard" />
|
|
|
|
|
|
+ <ListItemText primary={t("Proxy Guard")} />
|
|
<GuardState
|
|
<GuardState
|
|
- value={enable_proxy_guard}
|
|
|
|
|
|
+ value={enable_proxy_guard ?? false}
|
|
valueProps="checked"
|
|
valueProps="checked"
|
|
onCatch={onError}
|
|
onCatch={onError}
|
|
onFormat={onSwitchFormat}
|
|
onFormat={onSwitchFormat}
|
|
@@ -99,7 +101,7 @@ const SettingSystem = ({ onError }: Props) => {
|
|
|
|
|
|
{enable_system_proxy && (
|
|
{enable_system_proxy && (
|
|
<SettingItem>
|
|
<SettingItem>
|
|
- <ListItemText primary="Proxy Bypass" />
|
|
|
|
|
|
+ <ListItemText primary={t("Proxy Bypass")} />
|
|
<GuardState
|
|
<GuardState
|
|
value={system_proxy_bypass ?? ""}
|
|
value={system_proxy_bypass ?? ""}
|
|
onCatch={onError}
|
|
onCatch={onError}
|