diff --git a/src/components/MapIcons.tsx b/src/components/MapIcons.tsx index 574c1c3..4faefb1 100644 --- a/src/components/MapIcons.tsx +++ b/src/components/MapIcons.tsx @@ -1,5 +1,6 @@ import React from 'react'; import moment from "moment"; +import { formatPublicKey } from '../lib/meshcore'; type NodePosition = { node_id: string; @@ -144,7 +145,7 @@ export function ClusterMarker({ children }: ClusterMarkerProps) { export function PopupContent({ node }: PopupContentProps) { return (
-
ID: {node.node_id}
+
ID: {node.type === "meshcore" ? formatPublicKey(node.node_id) : node.node_id}
Full Name: {node.name ?? "-"}
Short Name: {node.short_name ?? "-"}
Type: {node.type ?? "-"}
diff --git a/src/lib/meshcore.ts b/src/lib/meshcore.ts index aa79ecb..b0da02e 100644 --- a/src/lib/meshcore.ts +++ b/src/lib/meshcore.ts @@ -191,4 +191,10 @@ export async function decryptMeshcoreGroupMessage({ }); } return null; +} + +export function formatPublicKey(pubKey: string): string { + // Take the first 8 characters, add ellipsis, and then the last 8 characters + const formattedKey = `<${pubKey.slice(0, 8)}...${pubKey.slice(-8)}>`; + return formattedKey; } \ No newline at end of file