mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-06 03:26:51 +03:00
feat: extend selector checks displaying
This commit is contained in:
@@ -40,21 +40,43 @@ export async function runSectionsCheck() {
|
||||
section.code,
|
||||
);
|
||||
|
||||
const selectedOutbound = section.outbounds.find(
|
||||
(item) => item.selected,
|
||||
);
|
||||
const isUrlTest = selectedOutbound?.type === 'URLTest';
|
||||
|
||||
const success = latencyGroup.success && !latencyGroup.data.message;
|
||||
|
||||
if (success) {
|
||||
const latency = Object.values(latencyGroup.data)
|
||||
.map((item) => (item ? `${item}ms` : 'n/a'))
|
||||
.join(' / ');
|
||||
if (isUrlTest) {
|
||||
const latency = Object.values(latencyGroup.data)
|
||||
.map((item) => (item ? `${item}ms` : 'n/a'))
|
||||
.join(' / ');
|
||||
|
||||
return {
|
||||
success: true,
|
||||
latency: `[${_('Fastest')}] ${latency}`,
|
||||
};
|
||||
}
|
||||
|
||||
const selectedProxyDelay =
|
||||
latencyGroup.data?.[selectedOutbound?.code ?? ''];
|
||||
|
||||
if (selectedProxyDelay) {
|
||||
return {
|
||||
success: true,
|
||||
latency: `[${selectedOutbound?.code ?? ''}] ${selectedProxyDelay}ms`,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
latency,
|
||||
success: false,
|
||||
latency: `[${selectedOutbound?.code ?? ''}] ${_('Not responding')}`,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
success: false,
|
||||
latency: _('Not responding'),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3736,16 +3736,33 @@ async function runSectionsCheck() {
|
||||
const latencyGroup = await PodkopShellMethods.getClashApiGroupLatency(
|
||||
section.code
|
||||
);
|
||||
const selectedOutbound = section.outbounds.find(
|
||||
(item) => item.selected
|
||||
);
|
||||
const isUrlTest = selectedOutbound?.type === "URLTest";
|
||||
const success3 = latencyGroup.success && !latencyGroup.data.message;
|
||||
if (success3) {
|
||||
const latency2 = Object.values(latencyGroup.data).map((item) => item ? `${item}ms` : "n/a").join(" / ");
|
||||
if (isUrlTest) {
|
||||
const latency2 = Object.values(latencyGroup.data).map((item) => item ? `${item}ms` : "n/a").join(" / ");
|
||||
return {
|
||||
success: true,
|
||||
latency: `[${_("Fastest")}] ${latency2}`
|
||||
};
|
||||
}
|
||||
const selectedProxyDelay = latencyGroup.data?.[selectedOutbound?.code ?? ""];
|
||||
if (selectedProxyDelay) {
|
||||
return {
|
||||
success: true,
|
||||
latency: `[${selectedOutbound?.code ?? ""}] ${selectedProxyDelay}ms`
|
||||
};
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
latency: latency2
|
||||
success: false,
|
||||
latency: `[${selectedOutbound?.code ?? ""}] ${_("Not responding")}`
|
||||
};
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
success: false,
|
||||
latency: _("Not responding")
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user