From 801b79b728727e6fb0411fa8f3d53a5757879603 Mon Sep 17 00:00:00 2001 From: huzibaca Date: Thu, 21 Nov 2024 11:13:11 +0800 Subject: [PATCH] chore: remove unused code --- src/components/setting/setting-system.tsx | 11 ----------- src/services/cmds.ts | 12 ------------ 2 files changed, 23 deletions(-) diff --git a/src/components/setting/setting-system.tsx b/src/components/setting/setting-system.tsx index f886853e..b76a2ad9 100644 --- a/src/components/setting/setting-system.tsx +++ b/src/components/setting/setting-system.tsx @@ -2,7 +2,6 @@ import useSWR from "swr"; import { useRef } from "react"; import { useTranslation } from "react-i18next"; import { SettingsRounded } from "@mui/icons-material"; -import { checkService } from "@/services/cmds"; import { useVerge } from "@/hooks/use-verge"; import { DialogRef, Notice, Switch } from "@/components/base"; import { SettingList, SettingItem } from "./mods/setting-comp"; @@ -19,16 +18,6 @@ const SettingSystem = ({ onError }: Props) => { const { t } = useTranslation(); const { verge, mutateVerge, patchVerge } = useVerge(); - // service mode - const { data: serviceStatus, mutate: mutateServiceStatus } = useSWR( - "checkService", - checkService, - { - revalidateIfStale: false, - shouldRetryOnError: false, - focusThrottleInterval: 36e5, // 1 hour - } - ); const sysproxyRef = useRef(null); const tunRef = useRef(null); diff --git a/src/services/cmds.ts b/src/services/cmds.ts index 0e1266e3..83d442cf 100644 --- a/src/services/cmds.ts +++ b/src/services/cmds.ts @@ -169,18 +169,6 @@ export async function cmdTestDelay(url: string) { return invoke("test_delay", { url }); } -/// service mode - -export async function checkService() { - try { - const result = await invoke("check_service"); - if (result?.code === 0) return "active"; - if (result?.code === 400) return "installed"; - return "unknown"; - } catch (err: any) { - return "uninstall"; - } -} export async function invoke_uwp_tool() { return invoke("invoke_uwp_tool").catch((err) => Notice.error(err?.message || err.toString(), 1500),