mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
feat: clash meta core supports
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
Select,
|
||||
MenuItem,
|
||||
Typography,
|
||||
Box,
|
||||
} from "@mui/material";
|
||||
import { ApiType } from "../../services/types";
|
||||
import { atomClashPort } from "../../services/states";
|
||||
@@ -16,11 +17,14 @@ import { SettingList, SettingItem } from "./setting";
|
||||
import { getClashConfig, getVersion, updateConfigs } from "../../services/api";
|
||||
import Notice from "../base/base-notice";
|
||||
import GuardState from "./guard-state";
|
||||
import CoreSwitch from "./core-switch";
|
||||
|
||||
interface Props {
|
||||
onError: (err: Error) => void;
|
||||
}
|
||||
|
||||
const MULTI_CORE = !!import.meta.env.VITE_MULTI_CORE;
|
||||
|
||||
const SettingClash = ({ onError }: Props) => {
|
||||
const { t } = useTranslation();
|
||||
const { mutate } = useSWRConfig();
|
||||
@@ -54,7 +58,7 @@ const SettingClash = ({ onError }: Props) => {
|
||||
}
|
||||
await patchClashConfig({ "mixed-port": port });
|
||||
setGlobalClashPort(port);
|
||||
Notice.success("Change Clash port successfully!");
|
||||
Notice.success("Change Clash port successfully!", 1000);
|
||||
|
||||
// update the config
|
||||
mutate("getClashConfig");
|
||||
@@ -129,7 +133,18 @@ const SettingClash = ({ onError }: Props) => {
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem>
|
||||
<ListItemText primary={t("Clash Core")} />
|
||||
<ListItemText
|
||||
primary={
|
||||
MULTI_CORE ? (
|
||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||
<span style={{ marginRight: 4 }}>{t("Clash Core")}</span>
|
||||
<CoreSwitch />
|
||||
</Box>
|
||||
) : (
|
||||
t("Clash Core")
|
||||
)
|
||||
}
|
||||
/>
|
||||
<Typography sx={{ py: 1 }}>{clashVer}</Typography>
|
||||
</SettingItem>
|
||||
</SettingList>
|
||||
|
||||
Reference in New Issue
Block a user