diff --git a/src/renderer/src/components/connections/connection-detail-modal.tsx b/src/renderer/src/components/connections/connection-detail-modal.tsx index d308f266..a5674960 100644 --- a/src/renderer/src/components/connections/connection-detail-modal.tsx +++ b/src/renderer/src/components/connections/connection-detail-modal.tsx @@ -12,7 +12,7 @@ interface Props { const CopyableSettingItem: React.FC<{ title: string - value: string + value: string | string[] displayName?: string prefix?: string[] suffix?: string @@ -23,18 +23,23 @@ const CopyableSettingItem: React.FC<{ : domain.split('.').map((_, i, parts) => parts.slice(i).join('.')).slice(0, -1) const menuItems = [ - { key: 'raw', text: value }, - ...prefix.flatMap(p => - (p === 'DOMAIN-SUFFIX' - ? getSubDomains(value) - : p === 'IP-ASN' - ? [value.split(' ')[0]] - : [value] - ).map(v => ({ - key: `${p},${v}${suffix}`, - text: `${p},${v}${suffix}` - })) - ) + { key: 'raw', text: displayName || (Array.isArray(value) ? value.join(', ') : value) }, + ...(Array.isArray(value) && value.length === prefix.length + ? prefix.map((p, i) => value[i] ? ({ + key: `${p},${value[i]}${suffix}`, + text: `${p},${value[i]}${suffix}` + }) : null).filter(Boolean) + : prefix.flatMap(p => + (p === 'DOMAIN-SUFFIX' + ? getSubDomains(Array.isArray(value) ? value[0] : value) + : p === 'IP-ASN' + ? [(Array.isArray(value) ? value[0] : value).split(' ')[0]] + : [Array.isArray(value) ? value[0] : value] + ).map(v => ({ + key: `${p},${v}${suffix}`, + text: `${p},${v}${suffix}` + })) + )) ] return ( @@ -49,17 +54,17 @@ const CopyableSettingItem: React.FC<{ - navigator.clipboard.writeText(key === 'raw' ? value : key as string) + navigator.clipboard.writeText(key === 'raw' ? (Array.isArray(value) ? value.join(', ') : value) : key as string) } > - {menuItems.map(({ key, text }) => ( + {menuItems.filter(item => item !== null).map(({ key, text }) => ( {text} ))} } > - {displayName || value} + {displayName || (Array.isArray(value) ? value.join(', ') : value)} ) } @@ -91,9 +96,9 @@ const ConnectionDetailModal: React.FC = (props) => { {calcTraffic(connection.download)} {connection.metadata.host && ( = (props) => { {connection.metadata.process && ( )} {connection.metadata.processPath && ( @@ -132,6 +137,20 @@ const ConnectionDetailModal: React.FC = (props) => { suffix='/32' /> )} + {connection.metadata.sourceGeoIP && ( + + )} + {connection.metadata.sourceIPASN && ( + + )} {connection.metadata.destinationIP && (