@decentnetwork/lan 0.1.51 → 0.1.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -685,12 +685,12 @@ export async function cmdFriendsList(args) {
685
685
  // A friend we only friend-requested (status "requested") has no name in
686
686
  // the local SDK record yet — but the dora roster knows it. Cross-reference
687
687
  // live IPAM so the list shows "cn", "mac-dev", … instead of "(unnamed)".
688
- const ipamNames = new Map();
688
+ const ipamInfo = new Map();
689
689
  try {
690
690
  const { peers } = await fetchLiveIpam(config);
691
691
  for (const p of peers) {
692
- if (p.carrierId && p.name)
693
- ipamNames.set(p.carrierId, p.name);
692
+ if (p.carrierId)
693
+ ipamInfo.set(p.carrierId, { name: p.name, virtualIp: p.virtualIp });
694
694
  }
695
695
  }
696
696
  catch {
@@ -709,9 +709,14 @@ export async function cmdFriendsList(args) {
709
709
  console.log(`Friends (${friends.length}) ${source === "daemon" ? "[live]" : "[disk]"}:`);
710
710
  for (const friend of friends) {
711
711
  const userid = friend.carrierId || friend.pubkey;
712
- const name = friend.name || ipamNames.get(userid) || "(unnamed)";
712
+ const ipam = ipamInfo.get(userid);
713
+ // friend.name is usually the generic SDK default "@decentnetwork/peer";
714
+ // prefer the dora-roster name (cn, mac-dev, …) when that's all we have.
715
+ const realName = friend.name && friend.name !== "@decentnetwork/peer" ? friend.name : undefined;
716
+ const name = realName || ipam?.name || "(unnamed)";
717
+ const ipSuffix = ipam?.virtualIp ? ` ${ipam.virtualIp}` : "";
713
718
  console.log(``);
714
- console.log(` ${name} status=${friend.status}`);
719
+ console.log(` ${name}${ipSuffix} status=${friend.status}`);
715
720
  console.log(` userid: ${userid}`);
716
721
  if (friend.address)
717
722
  console.log(` address: ${friend.address}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/lan",
3
- "version": "0.1.51",
3
+ "version": "0.1.52",
4
4
  "description": "Private virtual LAN for self-hosted services and AI agents, built on Elastos Carrier. NAT-traversal, name service, ACL, all over a peer-to-peer mesh — no public IP required.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",