fix: correct section display name for json outbound

This commit is contained in:
divocat
2025-10-07 22:56:40 +03:00
parent b7bad57299
commit a45ab62885
2 changed files with 10 additions and 5 deletions

View File

@@ -61,6 +61,11 @@ export async function getDashboardSections(): Promise<IGetDashboardSectionsRespo
(proxy) => proxy.code === `${section['.name']}-out`, (proxy) => proxy.code === `${section['.name']}-out`,
); );
const parsedOutbound = JSON.parse(section.outbound_json);
const parsedTag = parsedOutbound?.tag ? decodeURIComponent(parsedOutbound?.tag) : undefined;
const proxyDisplayName = parsedTag || outbound?.value?.name || ''
return { return {
withTagSelect: false, withTagSelect: false,
code: outbound?.code || section['.name'], code: outbound?.code || section['.name'],
@@ -68,10 +73,7 @@ export async function getDashboardSections(): Promise<IGetDashboardSectionsRespo
outbounds: [ outbounds: [
{ {
code: outbound?.code || section['.name'], code: outbound?.code || section['.name'],
displayName: displayName: proxyDisplayName,
decodeURIComponent(JSON.parse(section.outbound_json)?.tag) ||
outbound?.value?.name ||
'',
latency: outbound?.value?.history?.[0]?.delay || 0, latency: outbound?.value?.history?.[0]?.delay || 0,
type: outbound?.value?.type || '', type: outbound?.value?.type || '',
selected: true, selected: true,

View File

@@ -925,6 +925,9 @@ async function getDashboardSections() {
const outbound = proxies.find( const outbound = proxies.find(
(proxy) => proxy.code === `${section[".name"]}-out` (proxy) => proxy.code === `${section[".name"]}-out`
); );
const parsedOutbound = JSON.parse(section.outbound_json);
const parsedTag = parsedOutbound?.tag ? decodeURIComponent(parsedOutbound?.tag) : void 0;
const proxyDisplayName = parsedTag || outbound?.value?.name || "";
return { return {
withTagSelect: false, withTagSelect: false,
code: outbound?.code || section[".name"], code: outbound?.code || section[".name"],
@@ -932,7 +935,7 @@ async function getDashboardSections() {
outbounds: [ outbounds: [
{ {
code: outbound?.code || section[".name"], code: outbound?.code || section[".name"],
displayName: decodeURIComponent(JSON.parse(section.outbound_json)?.tag) || outbound?.value?.name || "", displayName: proxyDisplayName,
latency: outbound?.value?.history?.[0]?.delay || 0, latency: outbound?.value?.history?.[0]?.delay || 0,
type: outbound?.value?.type || "", type: outbound?.value?.type || "",
selected: true selected: true