Skip to content
Snippets Groups Projects
Unverified Commit 6e3cc57f authored by GyDi's avatar GyDi
Browse files

feat: display clash core version

parent f2c04621
No related branches found
No related tags found
No related merge requests found
...@@ -8,12 +8,13 @@ import { ...@@ -8,12 +8,13 @@ import {
Switch, Switch,
Select, Select,
MenuItem, MenuItem,
Typography,
} from "@mui/material"; } from "@mui/material";
import { getClashConfig, updateConfigs } from "../../services/api";
import { SettingList, SettingItem } from "./setting";
import { patchClashConfig } from "../../services/cmds";
import { atomClashPort } from "../../states/setting";
import { ApiType } from "../../services/types"; import { ApiType } from "../../services/types";
import { atomClashPort } from "../../states/setting";
import { patchClashConfig } from "../../services/cmds";
import { SettingList, SettingItem } from "./setting";
import { getClashConfig, getVersion, updateConfigs } from "../../services/api";
import GuardState from "./guard-state"; import GuardState from "./guard-state";
import Notice from "../notice"; import Notice from "../notice";
...@@ -68,6 +69,15 @@ const SettingClash = ({ onError }: Props) => { ...@@ -68,6 +69,15 @@ const SettingClash = ({ onError }: Props) => {
{ wait: 1000 } { wait: 1000 }
); );
// get clash core version
const [clashVer, setClashVer] = useState("");
useEffect(() => {
getVersion().then((res) => {
const { premium, version } = res;
setClashVer(premium ? `${version} Premium` : version);
});
}, []);
return ( return (
<SettingList title="Clash Setting"> <SettingList title="Clash Setting">
<SettingItem> <SettingItem>
...@@ -128,6 +138,11 @@ const SettingClash = ({ onError }: Props) => { ...@@ -128,6 +138,11 @@ const SettingClash = ({ onError }: Props) => {
<TextField autoComplete="off" size="small" sx={{ width: 120 }} /> <TextField autoComplete="off" size="small" sx={{ width: 120 }} />
</GuardState> </GuardState>
</SettingItem> </SettingItem>
<SettingItem>
<ListItemText primary="Clash core" />
<Typography sx={{ py: 1 }}>{clashVer}</Typography>
</SettingItem>
</SettingList> </SettingList>
); );
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment