diff --git a/src/main/core/mihomoApi.ts b/src/main/core/mihomoApi.ts index c1d638c..1463470 100644 --- a/src/main/core/mihomoApi.ts +++ b/src/main/core/mihomoApi.ts @@ -149,6 +149,10 @@ export const mihomoChangeProxy = async (group: string, proxy: string): Promise => { + return await mihomoHttp('DELETE', `/proxies/${encodeURIComponent(group)}`) +} + export const mihomoUpgradeGeo = async (): Promise => { return await mihomoHttp('POST', '/configs/geo') } diff --git a/src/main/utils/ipc.ts b/src/main/utils/ipc.ts index 684acef..68dbf14 100644 --- a/src/main/utils/ipc.ts +++ b/src/main/utils/ipc.ts @@ -10,6 +10,7 @@ import { mihomoProxyProviders, mihomoRuleProviders, mihomoRules, + mihomoUnfixedProxy, mihomoUpdateProxyProviders, mihomoUpdateRuleProviders, mihomoUpgrade, @@ -120,6 +121,7 @@ export function registerIpcMainHandlers(): void { ipcMain.handle('mihomoChangeProxy', (_e, group, proxy) => ipcErrorWrapper(mihomoChangeProxy)(group, proxy) ) + ipcMain.handle('mihomoUnfixedProxy', (_e, group) => ipcErrorWrapper(mihomoUnfixedProxy)(group)) ipcMain.handle('mihomoUpgradeGeo', ipcErrorWrapper(mihomoUpgradeGeo)) ipcMain.handle('mihomoUpgrade', ipcErrorWrapper(mihomoUpgrade)) ipcMain.handle('mihomoProxyDelay', (_e, proxy, url) => diff --git a/src/renderer/src/components/proxies/proxy-item.tsx b/src/renderer/src/components/proxies/proxy-item.tsx index 140b777..9f9aaf0 100644 --- a/src/renderer/src/components/proxies/proxy-item.tsx +++ b/src/renderer/src/components/proxies/proxy-item.tsx @@ -1,5 +1,5 @@ import { Button, Card, CardBody } from '@nextui-org/react' -import { mihomoGroupDelay } from '@renderer/utils/ipc' +import { mihomoUnfixedProxy } from '@renderer/utils/ipc' import React, { useMemo, useState } from 'react' import { FaMapPin } from 'react-icons/fa6' @@ -24,7 +24,6 @@ const ProxyItem: React.FC = (props) => { }, [proxy]) const [loading, setLoading] = useState(false) - const [unfixing, setUnfixing] = useState(false) function delayColor(delay: number): 'primary' | 'success' | 'warning' | 'danger' { if (delay === -1) return 'primary' if (delay === 0) return 'danger' @@ -74,13 +73,10 @@ const ProxyItem: React.FC = (props) => {