@decentnetwork/lan 0.1.274 → 0.1.275
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.
- package/dist/cli/commands.d.ts +1 -0
- package/dist/cli/commands.js +42 -0
- package/dist/cli/index.js +1 -1
- package/dist/ui/desktop/app.js +1 -1
- package/package.json +1 -1
package/dist/cli/commands.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ export declare function cmdUp(args: {
|
|
|
70
70
|
configDir?: string;
|
|
71
71
|
realTun?: boolean;
|
|
72
72
|
}): Promise<void>;
|
|
73
|
+
export declare function resolveBeaglesName(input: string): Promise<string | null>;
|
|
73
74
|
/**
|
|
74
75
|
* Send a friend request to another peer's address.
|
|
75
76
|
* Run while daemon is DOWN — opens a temporary peer, sends request, exits.
|
package/dist/cli/commands.js
CHANGED
|
@@ -480,6 +480,42 @@ export async function cmdUp(args) {
|
|
|
480
480
|
// Keep alive
|
|
481
481
|
await new Promise(() => { });
|
|
482
482
|
}
|
|
483
|
+
/**
|
|
484
|
+
* Resolve a *.beagles.eth name to its Carrier address via the ens-gateway
|
|
485
|
+
* worker (the registry the Beagle mobile apps register into). Only names
|
|
486
|
+
* from OUR gateway resolve — this is not a general ENS resolver.
|
|
487
|
+
*
|
|
488
|
+
* Returns null when the input doesn't look like a name (so callers can
|
|
489
|
+
* fall through to treating it as a raw Carrier address). Throws when it
|
|
490
|
+
* IS a name but the gateway doesn't know it.
|
|
491
|
+
*/
|
|
492
|
+
const ENS_GATEWAY = "https://ens-gateway.beaglechat.workers.dev";
|
|
493
|
+
export async function resolveBeaglesName(input) {
|
|
494
|
+
const raw = input.trim();
|
|
495
|
+
// A Carrier address is 52 base58 chars, a userid 44 — both dot-free.
|
|
496
|
+
// Anything with a dot, a space, or too short to be either is a name.
|
|
497
|
+
const looksLikeName = raw.includes(".") || raw.includes(" ") || raw.length < 40;
|
|
498
|
+
if (!looksLikeName)
|
|
499
|
+
return null;
|
|
500
|
+
const full = raw.includes(".") ? raw : `${raw}.beagles.eth`;
|
|
501
|
+
// Registered labels aren't strictly normalized upstream (mixed case,
|
|
502
|
+
// stray spaces exist in the registry) — compare loosely.
|
|
503
|
+
const norm = (s) => s.toLowerCase().replace(/\s+/g, "");
|
|
504
|
+
const want = norm(full);
|
|
505
|
+
const res = await fetch(`${ENS_GATEWAY}/names`);
|
|
506
|
+
if (!res.ok)
|
|
507
|
+
throw new Error(`name lookup failed: gateway HTTP ${res.status}`);
|
|
508
|
+
const names = (await res.json());
|
|
509
|
+
for (const [key, val] of Object.entries(names)) {
|
|
510
|
+
if (norm(key) !== want)
|
|
511
|
+
continue;
|
|
512
|
+
const addr = val?.texts?.carrierAddress;
|
|
513
|
+
if (!addr)
|
|
514
|
+
throw new Error(`'${key}' is registered but has no Carrier address bound`);
|
|
515
|
+
return addr;
|
|
516
|
+
}
|
|
517
|
+
throw new Error(`name '${full}' is not registered on the beagles.eth gateway`);
|
|
518
|
+
}
|
|
483
519
|
/**
|
|
484
520
|
* Send a friend request to another peer's address.
|
|
485
521
|
* Run while daemon is DOWN — opens a temporary peer, sends request, exits.
|
|
@@ -489,6 +525,12 @@ export async function cmdUp(args) {
|
|
|
489
525
|
export async function cmdFriendRequest(args) {
|
|
490
526
|
const dir = args.configDir || ConfigLoader.defaultConfigDir();
|
|
491
527
|
const config = await ConfigLoader.load(resolve(dir, "config.yaml"));
|
|
528
|
+
// Accept a *.beagles.eth name in place of a raw Carrier address.
|
|
529
|
+
const resolved = await resolveBeaglesName(args.address);
|
|
530
|
+
if (resolved !== null) {
|
|
531
|
+
console.log(`Resolved '${args.address.trim()}' → ${resolved}`);
|
|
532
|
+
args = { ...args, address: resolved };
|
|
533
|
+
}
|
|
492
534
|
// If the daemon is running, route through IPC instead of spawning a
|
|
493
535
|
// second Carrier peer. The daemon's existing Peer instance sends the
|
|
494
536
|
// request — no session conflict, no second DHT announce, no race.
|
package/dist/cli/index.js
CHANGED
|
@@ -227,7 +227,7 @@ async function main() {
|
|
|
227
227
|
});
|
|
228
228
|
})
|
|
229
229
|
.command("friend-request <address>", "Send a friend request (routes through the running daemon when up; opens a standalone peer when down)", (y) => y
|
|
230
|
-
.positional("address", { type: "string", demandOption: true, describe: "Recipient Carrier address" })
|
|
230
|
+
.positional("address", { type: "string", demandOption: true, describe: "Recipient Carrier address, or a *.beagles.eth name (bare label ok, e.g. 's3ns')" })
|
|
231
231
|
.option("hello", { type: "string", describe: "Greeting message" })
|
|
232
232
|
.option("wait-ms", { type: "number", default: 8000, describe: "Wait time for relay delivery" })
|
|
233
233
|
.option("config-dir", { type: "string" }), async (argv) => {
|
package/dist/ui/desktop/app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
window.__DK_UI_VERSION="0.1.
|
|
1
|
+
window.__DK_UI_VERSION="0.1.275";
|
|
2
2
|
const ICON_PATHS = {
|
|
3
3
|
// ---- tab bar (the four must feel like one set) ----
|
|
4
4
|
users: '<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decentnetwork/lan",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.275",
|
|
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",
|