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