* chore(deps): update cargo dependencies * fix: sysinfo crate use limit features * fix: update headers-core dependency and kode-bridge version; enhance system monitor status validation * fix: extend overall_status type in ISystemMonitorOverview to include 'healthy' * refactor: update URL encoding strategy in IpcManager and cmdGetProxyDelay function * fix: resolve speed test functionality issue after IPC migration * fix: resolve speed test functionality issue after IPC migration #4221, #4218 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
@@ -512,12 +512,9 @@ export async function cmdGetProxyDelay(
|
||||
) {
|
||||
// 确保URL不为空
|
||||
const testUrl = url || "https://cp.cloudflare.com/generate_204";
|
||||
console.log(
|
||||
`[API] 调用延迟测试API,代理: ${name}, 超时: ${timeout}ms, URL: ${testUrl}`,
|
||||
);
|
||||
|
||||
try {
|
||||
name = encodeURIComponent(name);
|
||||
// 不再在前端编码代理名称,由后端统一处理编码
|
||||
const result = await invoke<{ delay: number }>(
|
||||
"clash_api_get_proxy_delay",
|
||||
{
|
||||
@@ -529,20 +526,12 @@ export async function cmdGetProxyDelay(
|
||||
|
||||
// 验证返回结果中是否有delay字段,并且值是一个有效的数字
|
||||
if (result && typeof result.delay === "number") {
|
||||
console.log(
|
||||
`[API] 延迟测试API调用成功,代理: ${name}, 延迟: ${result.delay}ms`,
|
||||
);
|
||||
return result;
|
||||
} else {
|
||||
console.error(
|
||||
`[API] 延迟测试API返回无效结果,代理: ${name}, 结果:`,
|
||||
result,
|
||||
);
|
||||
// 返回一个有效的结果对象,但标记为超时
|
||||
return { delay: 1e6 };
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`[API] 延迟测试API调用失败,代理: ${name}`, error);
|
||||
// 返回一个有效的结果对象,但标记为错误
|
||||
return { delay: 1e6 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user