refactor: remove redundant proxy query paths (#5928)

This commit is contained in:
SaladDay
2026-07-30 20:52:22 -04:00
committed by GitHub
parent 3c1154bed9
commit 4317bd9981
9 changed files with 89 additions and 273 deletions
+5 -31
View File
@@ -1,6 +1,5 @@
import { invoke } from "@tauri-apps/api/core";
import type {
ProxyConfig,
ProxyStatus,
ProxyServerInfo,
ProxyTakeoverStatus,
@@ -16,6 +15,11 @@ export const proxyApi = {
return invoke("start_proxy_server");
},
// 停止代理服务器(不恢复已接管配置)
async stopProxyServer(): Promise<void> {
return invoke("stop_proxy_server");
},
// 停止代理服务器并恢复配置
async stopProxyWithRestore(): Promise<void> {
return invoke("stop_proxy_with_restore");
@@ -26,24 +30,6 @@ export const proxyApi = {
return invoke("get_proxy_status");
},
// 检查代理服务器是否正在运行
async isProxyRunning(): Promise<boolean> {
return invoke("is_proxy_running");
},
// 检查是否处于接管模式
async isLiveTakeoverActive(): Promise<boolean> {
return invoke("is_live_takeover_active");
},
// 代理模式下切换供应商
async switchProxyProvider(
appType: string,
providerId: string,
): Promise<void> {
return invoke("switch_proxy_provider", { appType, providerId });
},
// ========== 接管状态 API ==========
// 获取各应用接管状态
@@ -59,18 +45,6 @@ export const proxyApi = {
return invoke("set_proxy_takeover_for_app", { appType, enabled });
},
// ========== Legacy 代理配置 API (兼容) ==========
// 获取代理配置(旧版 v2 兼容接口)
async getProxyConfig(): Promise<ProxyConfig> {
return invoke("get_proxy_config");
},
// 更新代理配置(旧版 v2 兼容接口)
async updateProxyConfig(config: ProxyConfig): Promise<void> {
return invoke("update_proxy_config", { config });
},
// ========== v3+ 全局/应用级配置 API ==========
// 获取全局代理配置