From 6e3cc57f480900098bb4963cc8aac886c8399226 Mon Sep 17 00:00:00 2001 From: GyDi Date: Thu, 10 Feb 2022 01:35:55 +0800 Subject: [PATCH] feat: display clash core version --- src/components/setting/setting-clash.tsx | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/components/setting/setting-clash.tsx b/src/components/setting/setting-clash.tsx index eee2e11..3825e87 100644 --- a/src/components/setting/setting-clash.tsx +++ b/src/components/setting/setting-clash.tsx @@ -8,12 +8,13 @@ import { Switch, Select, MenuItem, + Typography, } 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 { 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 Notice from "../notice"; @@ -68,6 +69,15 @@ const SettingClash = ({ onError }: Props) => { { wait: 1000 } ); + // get clash core version + const [clashVer, setClashVer] = useState(""); + useEffect(() => { + getVersion().then((res) => { + const { premium, version } = res; + setClashVer(premium ? `${version} Premium` : version); + }); + }, []); + return ( @@ -128,6 +138,11 @@ const SettingClash = ({ onError }: Props) => { + + + + {clashVer} + ); };