@ghostlytools/cli 1.6.1 → 1.7.1
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/README.md +36 -12
- package/dist/assets/{api-BpNU2LQh.js → api-CD9JbPuA.js} +99 -28
- package/dist/assets/api-CD9JbPuA.js.map +1 -0
- package/dist/assets/{api-Cx8ZCntM.js → api-CJM3R93b.js} +2 -2
- package/dist/assets/{apiKit-d1wi3raD.js → apiKit-BmnROpCN.js} +8 -4
- package/dist/assets/{apiKit-d1wi3raD.js.map → apiKit-BmnROpCN.js.map} +1 -1
- package/dist/assets/{apps-C-HiIRCA.js → apps-CJ2dvKSz.js} +1 -1
- package/dist/assets/{apps-B1QjRWqq.js → apps-DVA60Tg6.js} +34 -11
- package/dist/assets/apps-DVA60Tg6.js.map +1 -0
- package/dist/assets/{arkade-B5g4r3Ea.js → arkade-CHqwEHFd.js} +2 -2
- package/dist/assets/{arkade-B5g4r3Ea.js.map → arkade-CHqwEHFd.js.map} +1 -1
- package/dist/assets/{backup-Boqn5Y35.js → backup-B4dSNvzb.js} +5 -5
- package/dist/assets/{backup-Boqn5Y35.js.map → backup-B4dSNvzb.js.map} +1 -1
- package/dist/assets/{backup-BS9HwGyn.js → backup-C4CbTEcj.js} +1 -1
- package/dist/assets/{blobFiles-B6nf0gCG.js → blobFiles-Bckz9fjp.js} +2 -2
- package/dist/assets/{blobFiles-B6nf0gCG.js.map → blobFiles-Bckz9fjp.js.map} +1 -1
- package/dist/assets/buttons-BMVGYXpR.js +2 -0
- package/dist/assets/{buttons-Bjc51aod.js → buttons-C13rK2mH.js} +3 -3
- package/dist/assets/{buttons-Bjc51aod.js.map → buttons-C13rK2mH.js.map} +1 -1
- package/dist/assets/{daemonProof-ui8jtIw0.js → daemonProof-B41oSfon.js} +2 -2
- package/dist/assets/{daemonProof-ui8jtIw0.js.map → daemonProof-B41oSfon.js.map} +1 -1
- package/dist/assets/{envelope-DvZMFRzg.js → envelope-4TXDx3vD.js} +2 -2
- package/dist/assets/{envelope-DvZMFRzg.js.map → envelope-4TXDx3vD.js.map} +1 -1
- package/dist/assets/{fileBytes-BMEBas7S.js → fileBytes-BD0v3rRG.js} +10 -2
- package/dist/assets/{fileBytes-BMEBas7S.js.map → fileBytes-BD0v3rRG.js.map} +1 -1
- package/dist/assets/{fileBytes-CtwagJ8h.js → fileBytes-OolN5cSY.js} +1 -1
- package/dist/assets/{fileBytes-CFNrRfcl.js → fileBytes-_fd-2JRY.js} +2 -2
- package/dist/assets/{fileBytes-CFNrRfcl.js.map → fileBytes-_fd-2JRY.js.map} +1 -1
- package/dist/assets/fileBytesIdb-CsSQcSxD.js +2 -0
- package/dist/assets/{fileBytesIdb-BXAN7i-N.js → fileBytesIdb-NtA8r9EM.js} +2 -2
- package/dist/assets/{fileBytesIdb-BXAN7i-N.js.map → fileBytesIdb-NtA8r9EM.js.map} +1 -1
- package/dist/assets/{fileBytesOpfs-Do1Vpkis.js → fileBytesOpfs-B8fJwkwM.js} +3 -3
- package/dist/assets/{fileBytesOpfs-Do1Vpkis.js.map → fileBytesOpfs-B8fJwkwM.js.map} +1 -1
- package/dist/assets/{ghostly_iroh_web-BXCsSxxo.js → ghostly_iroh_web-CO0onry8.js} +33 -27
- package/dist/assets/ghostly_iroh_web-CO0onry8.js.map +1 -0
- package/dist/assets/ghostly_iroh_web_bg.wasm +0 -0
- package/dist/assets/{groupFiles-y4lGrOC-.js → groupFiles-ajZgZ6P8.js} +41 -25
- package/dist/assets/groupFiles-ajZgZ6P8.js.map +1 -0
- package/dist/assets/{host-DFGS8vJE.js → host-CVeNtA2_.js} +43 -20
- package/dist/assets/host-CVeNtA2_.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-CZLnOc4e.js → hyperdhtRelay-CI2ISE-g.js} +2 -2
- package/dist/assets/{hyperdhtRelay-CZLnOc4e.js.map → hyperdhtRelay-CI2ISE-g.js.map} +1 -1
- package/dist/assets/{irohWeb-Y9wt8zG7.js → irohWeb-DcRJdhce.js} +3 -3
- package/dist/assets/{irohWeb-Y9wt8zG7.js.map → irohWeb-DcRJdhce.js.map} +1 -1
- package/dist/assets/{main-xgWC0qPZ.js → main-CjO0KGiF.js} +272 -79
- package/dist/assets/main-CjO0KGiF.js.map +1 -0
- package/dist/assets/{mainline-CjQ3pmvq.js → mainline-WM-WItCV.js} +27 -8
- package/dist/assets/mainline-WM-WItCV.js.map +1 -0
- package/dist/assets/{networkReason-i9wu5ZJs.js → networkReason-380j5yMs.js} +2 -2
- package/dist/assets/{networkReason-i9wu5ZJs.js.map → networkReason-380j5yMs.js.map} +1 -1
- package/dist/assets/{nwc-yO0nHt9S.js → nwc-D5dkC1xg.js} +3 -3
- package/dist/assets/{nwc-yO0nHt9S.js.map → nwc-D5dkC1xg.js.map} +1 -1
- package/dist/assets/{nwcProvider-BEg4I5Bk.js → nwcProvider-p_rMwtDv.js} +2 -2
- package/dist/assets/{nwcProvider-BEg4I5Bk.js.map → nwcProvider-p_rMwtDv.js.map} +1 -1
- package/dist/assets/{profiles-CEnZfN78.js → profiles-BFd0tpCZ.js} +91 -19
- package/dist/assets/profiles-BFd0tpCZ.js.map +1 -0
- package/dist/assets/{registry-CBDcdRPx.js → registry-BKffx4ZU.js} +1 -1
- package/dist/assets/{registry-DyGu5C-Z.js → registry-BfNcA6kF.js} +3 -3
- package/dist/assets/registry-BfNcA6kF.js.map +1 -0
- package/dist/assets/{resolve-CnkY--2E.js → resolve-hUsgRkmm.js} +2 -2
- package/dist/assets/{resolve-CnkY--2E.js.map → resolve-hUsgRkmm.js.map} +1 -1
- package/dist/assets/{server-CH142eWc.js → server-C3tJZFnv.js} +422 -149
- package/dist/assets/server-C3tJZFnv.js.map +1 -0
- package/dist/assets/{src-BXeGLwWV.js → src-BMHgbkli.js} +246 -62
- package/dist/assets/src-BMHgbkli.js.map +1 -0
- package/dist/assets/translate-DJUutSis.js +1067 -0
- package/dist/assets/translate-DJUutSis.js.map +1 -0
- package/dist/assets/types-C4_KafL_.js.map +1 -1
- package/dist/assets/{usdt-CdSNFUzO.js → usdt-glkUxsDe.js} +3 -3
- package/dist/assets/{usdt-CdSNFUzO.js.map → usdt-glkUxsDe.js.map} +1 -1
- package/dist/assets/{words-DA5feEav.js → words-DyW9b27T.js} +2 -2
- package/dist/assets/{words-DA5feEav.js.map → words-DyW9b27T.js.map} +1 -1
- package/dist/ghostly.mjs +1 -1
- package/package.json +1 -1
- package/dist/assets/api-BpNU2LQh.js.map +0 -1
- package/dist/assets/apps-B1QjRWqq.js.map +0 -1
- package/dist/assets/buttons-CugVarw3.js +0 -2
- package/dist/assets/fileBytesIdb-C20oXDdr.js +0 -2
- package/dist/assets/ghostly_iroh_web-BXCsSxxo.js.map +0 -1
- package/dist/assets/groupFiles-y4lGrOC-.js.map +0 -1
- package/dist/assets/host-DFGS8vJE.js.map +0 -1
- package/dist/assets/main-xgWC0qPZ.js.map +0 -1
- package/dist/assets/mainline-CjQ3pmvq.js.map +0 -1
- package/dist/assets/profiles-CEnZfN78.js.map +0 -1
- package/dist/assets/registry-DyGu5C-Z.js.map +0 -1
- package/dist/assets/server-CH142eWc.js.map +0 -1
- package/dist/assets/src-BXeGLwWV.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as fedimintSdkOn, r as irohRelayProblem } from "./irohWeb-
|
|
1
|
+
import { Bo as callSignalHeardAt, Fo as CALL_SIGNAL_MAX_AGE_MS, Ho as extractParamsFromSdp, Io as RTC_CONFIG, Lo as answersOffer, Qr as checkPushEndpoint, Ro as buildSdpFromSignal, Uo as parseCallSignal, Wo as signalHasVideo, Zl as setLinkTraceSink, _u as fromBase64Url, wi as isPublicAddress, zo as callRtcConfig } from "./src-BMHgbkli.js";
|
|
2
|
+
import { a as fedimintSdkOn, r as irohRelayProblem } from "./irohWeb-DcRJdhce.js";
|
|
3
3
|
import { r as asCliError, t as CliError } from "./errors-CzXgR8Cc.js";
|
|
4
|
-
import { a as findChat, c as findOwnNamedChat } from "./apiKit-
|
|
5
|
-
import { _ as flushCardUpdates, c as paymentJson, d as nodeLocalFetch, f as chatJson, g as resumeHolds, h as groupMessageJson, l as reportAppFrames, m as groupJson, p as chatMessageJson, r as callApi, u as servedApps } from "./api-
|
|
6
|
-
import { g as ownFolder, n as RESTORED_MARK, r as acquireLock, v as privateFolder, y as runtimePath } from "./profiles-
|
|
7
|
-
import { _ as isCallRate, f as DEFAULT_RATE, g as frameSamples, h as frameBytes, i as newDaemonSecret, m as bytesToMs, o as proof, p as PlaybackQueue, r as greeting, u as removeDaemonSecret } from "./daemonProof-
|
|
4
|
+
import { a as findChat, c as findOwnNamedChat } from "./apiKit-BmnROpCN.js";
|
|
5
|
+
import { _ as flushCardUpdates, c as paymentJson, d as nodeLocalFetch, f as chatJson, g as resumeHolds, h as groupMessageJson, l as reportAppFrames, m as groupJson, p as chatMessageJson, r as callApi, u as servedApps } from "./api-CD9JbPuA.js";
|
|
6
|
+
import { g as ownFolder, n as RESTORED_MARK, r as acquireLock, v as privateFolder, y as runtimePath } from "./profiles-BFd0tpCZ.js";
|
|
7
|
+
import { _ as isCallRate, f as DEFAULT_RATE, g as frameSamples, h as frameBytes, i as newDaemonSecret, m as bytesToMs, o as proof, p as PlaybackQueue, r as greeting, u as removeDaemonSecret } from "./daemonProof-B41oSfon.js";
|
|
8
8
|
import { createRequire } from "node:module";
|
|
9
9
|
import { appendFileSync, chmodSync, closeSync, existsSync, fstatSync, fsyncSync, ftruncateSync, lstatSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, renameSync, rmSync, statSync, writeFileSync, writeSync } from "node:fs";
|
|
10
10
|
import { readFile } from "node:fs/promises";
|
|
@@ -674,7 +674,8 @@ async function openConnection(stack, options, offer, held = false) {
|
|
|
674
674
|
videoTrack = pc.addTrack(video);
|
|
675
675
|
videoTrack.onMessage(() => {});
|
|
676
676
|
}
|
|
677
|
-
const
|
|
677
|
+
const turn = callUsesTurn(iceServers);
|
|
678
|
+
const gathered = gathering(pc, { turn });
|
|
678
679
|
if (offer) pc.setRemoteDescription(buildSdpFromSignal(held ? {
|
|
679
680
|
...offer,
|
|
680
681
|
c: []
|
|
@@ -683,6 +684,7 @@ async function openConnection(stack, options, offer, held = false) {
|
|
|
683
684
|
await gathered;
|
|
684
685
|
const sdp = pc.localDescription()?.sdp;
|
|
685
686
|
if (!sdp) throw new Error("No local description");
|
|
687
|
+
if (turn && !/ typ relay/.test(sdp)) log(`no relay address: the TURN server refused the allocation or did not answer in time`);
|
|
686
688
|
const local = {
|
|
687
689
|
...extractParamsFromSdp(sdp, {
|
|
688
690
|
maxCandidates: 8,
|
|
@@ -1096,9 +1098,14 @@ var CallManager = class {
|
|
|
1096
1098
|
/**
|
|
1097
1099
|
* The ringing call's answer, made now (`EarlyAnswer`): when the call is answered, its candidates have been gathered
|
|
1098
1100
|
* and the answer goes at once. Made again every EARLY_ANSWER_MS while it rings; when it cannot be made, the answer makes its own.
|
|
1101
|
+
* Not made with a TURN server in the profile's settings: libjuice never gives an allocation back (no Refresh with
|
|
1102
|
+
* LIFETIME 0 when a connection closes), so each one held a relay on the server for 10 minutes, those of calls declined,
|
|
1103
|
+
* missed and cancelled too, and a server with a per-user quota refused the next calls theirs. The answer allocates.
|
|
1099
1104
|
*/
|
|
1100
1105
|
prepare(call) {
|
|
1101
1106
|
if (this.host.answers === false || call.ended || call.state !== "ringing") return;
|
|
1107
|
+
const iceServers = this.host.engine.getState().settings?.iceServers ?? [];
|
|
1108
|
+
if (callUsesTurn(callIceServers(iceServers))) return;
|
|
1102
1109
|
this.stopEarly(call);
|
|
1103
1110
|
call.earlyTimer = setTimeout(() => this.prepare(call), this.host.earlyAnswerMs ?? 3e4);
|
|
1104
1111
|
call.earlyTimer.unref?.();
|
|
@@ -1109,7 +1116,7 @@ var CallManager = class {
|
|
|
1109
1116
|
const making = {
|
|
1110
1117
|
chat: call.chat,
|
|
1111
1118
|
done: this.stack().then((stack) => EarlyAnswer.open(stack, offer, {
|
|
1112
|
-
iceServers
|
|
1119
|
+
iceServers,
|
|
1113
1120
|
log: (line) => process.stderr.write(`ghostly: call ${call.id}: ${line}\n`)
|
|
1114
1121
|
})).catch((error) => {
|
|
1115
1122
|
this.stopEarly(call);
|
|
@@ -4602,7 +4609,7 @@ function blobsFromDisk(value, depth = 0) {
|
|
|
4602
4609
|
* for the Desktop's sidecar; a network all on loopback (the tests') is announced on loopback too.
|
|
4603
4610
|
*/
|
|
4604
4611
|
function hyperdhtNetwork(env = process.env.GHOSTLY_HYPERDHT_BOOTSTRAP) {
|
|
4605
|
-
const bootstrap = (
|
|
4612
|
+
const bootstrap = bootstrapNodes("GHOSTLY_HYPERDHT_BOOTSTRAP", env);
|
|
4606
4613
|
if (!bootstrap.length) return {};
|
|
4607
4614
|
return {
|
|
4608
4615
|
bootstrap,
|
|
@@ -4610,6 +4617,21 @@ function hyperdhtNetwork(env = process.env.GHOSTLY_HYPERDHT_BOOTSTRAP) {
|
|
|
4610
4617
|
};
|
|
4611
4618
|
}
|
|
4612
4619
|
/**
|
|
4620
|
+
* A bootstrap variable's nodes ("host:port,…"), each checked: a host without a port, a port past 65535 or `;` between
|
|
4621
|
+
* nodes crashed every command from bittorrent-dht's timer (port NaN), and `udp://…`, `[v6]:port` or nodes split by
|
|
4622
|
+
* spaces were looked up as names and left the profile with no DHT. IPv6 nodes are refused: neither bittorrent-dht nor
|
|
4623
|
+
* dht-rpc reads them (both split host and port at the first ':').
|
|
4624
|
+
*/
|
|
4625
|
+
function bootstrapNodes(name, env) {
|
|
4626
|
+
const nodes = (env ?? "").split(",").map((node) => node.trim()).filter(Boolean);
|
|
4627
|
+
const bad = nodes.find((node) => {
|
|
4628
|
+
const port = /^[^\s:;/@[\]]+:(\d{1,5})$/.exec(node)?.[1];
|
|
4629
|
+
return !port || Number(port) < 1 || Number(port) > 65535;
|
|
4630
|
+
});
|
|
4631
|
+
if (bad !== void 0) throw new CliError("usage", `${name} takes host:port nodes, comma-separated, not ${JSON.stringify(bad)}`);
|
|
4632
|
+
return nodes;
|
|
4633
|
+
}
|
|
4634
|
+
/**
|
|
4613
4635
|
* The Pkarr relays of a private network or a test, `GHOSTLY_PKARR_RELAYS` ("http://…,…"), the Desktop's name for it:
|
|
4614
4636
|
* the only relays this process uses, whatever the profile's `relays` setting says, from its very first publish. Null
|
|
4615
4637
|
* when unset.
|
|
@@ -4617,7 +4639,7 @@ function hyperdhtNetwork(env = process.env.GHOSTLY_HYPERDHT_BOOTSTRAP) {
|
|
|
4617
4639
|
function pkarrRelays(env = process.env) {
|
|
4618
4640
|
const relays = (env.GHOSTLY_PKARR_RELAYS ?? "").split(",").map((url) => url.trim()).filter(Boolean);
|
|
4619
4641
|
if (!relays.length) return null;
|
|
4620
|
-
const bad = relays.find((url) => !/^https?:\/\/[^/\s]/i.test(url));
|
|
4642
|
+
const bad = relays.find((url) => !/^https?:\/\/[^/\s]/i.test(url) || /[\s;]/.test(url) || !URL.canParse(url));
|
|
4621
4643
|
if (bad) throw new CliError("usage", `GHOSTLY_PKARR_RELAYS takes http:// or https:// URLs, comma-separated, not ${JSON.stringify(bad)}`);
|
|
4622
4644
|
return relays;
|
|
4623
4645
|
}
|
|
@@ -4662,7 +4684,7 @@ function withoutPublicStun(config) {
|
|
|
4662
4684
|
*/
|
|
4663
4685
|
function mainlineNetwork(env = process.env) {
|
|
4664
4686
|
if (!envSwitch("GHOSTLY_DHT", true, env)) return { off: true };
|
|
4665
|
-
const bootstrap = (
|
|
4687
|
+
const bootstrap = bootstrapNodes("GHOSTLY_DHT_BOOTSTRAP", env.GHOSTLY_DHT_BOOTSTRAP);
|
|
4666
4688
|
if (!bootstrap.length && pkarrRelays(env)) return { off: true };
|
|
4667
4689
|
if (!bootstrap.length) return { off: false };
|
|
4668
4690
|
return {
|
|
@@ -4768,6 +4790,8 @@ function leftOutIn(mark) {
|
|
|
4768
4790
|
async function startRuntime(paths, options = {}) {
|
|
4769
4791
|
const pinned = pkarrRelays();
|
|
4770
4792
|
const pinnedIroh = irohRelays();
|
|
4793
|
+
const network = hyperdhtNetwork();
|
|
4794
|
+
const dht = mainlineNetwork();
|
|
4771
4795
|
const trace = process.env.GHOSTLY_LINK_TRACE;
|
|
4772
4796
|
if (trace) setLinkTraceSink((line) => appendFileSync(trace, line + "\n", { mode: 384 }));
|
|
4773
4797
|
if (trace || options.logJoins) (await import("./joinTrace-D-fnt2p3.js")).setJoinTraceSink((line) => {
|
|
@@ -4797,18 +4821,16 @@ async function startRuntime(paths, options = {}) {
|
|
|
4797
4821
|
if (testMints) (await import("./mints-CqTdA4Gk.js")).declareTestMints(testMints.split(","));
|
|
4798
4822
|
await installEventSource();
|
|
4799
4823
|
await preloadWalletModules();
|
|
4800
|
-
(await import("./ghostly_iroh_web-
|
|
4801
|
-
const [{ registerFileBytes }, { NodeFileBytes }] = await Promise.all([import("./fileBytes-
|
|
4824
|
+
(await import("./ghostly_iroh_web-CO0onry8.js")).initSync({ module: irohWasmBytes() });
|
|
4825
|
+
const [{ registerFileBytes }, { NodeFileBytes }] = await Promise.all([import("./fileBytes-OolN5cSY.js"), import("./fileBytes-_fd-2JRY.js")]);
|
|
4802
4826
|
registerFileBytes("native", async () => new NodeFileBytes(paths.files), true);
|
|
4803
|
-
if (await (await import("./blobFiles-
|
|
4804
|
-
const [{ EngineServer }, { createHyperEndpoint }] = await Promise.all([import("./server-
|
|
4805
|
-
const
|
|
4806
|
-
const dht = mainlineNetwork();
|
|
4807
|
-
const mainline = dht.off ? null : new (await (import("./mainline-CjQ3pmvq.js"))).Mainline({
|
|
4827
|
+
if (await (await import("./blobFiles-Bckz9fjp.js")).moveBlobFiles()) await store.compact();
|
|
4828
|
+
const [{ EngineServer }, { createHyperEndpoint }] = await Promise.all([import("./server-C3tJZFnv.js"), import("./endpoint-BdaeBw2L.js")]);
|
|
4829
|
+
const mainline = dht.off ? null : new (await (import("./mainline-WM-WItCV.js"))).Mainline({
|
|
4808
4830
|
bootstrap: dht.bootstrap,
|
|
4809
4831
|
host: dht.host
|
|
4810
4832
|
});
|
|
4811
|
-
const transport = mainline || pinned ? new (await (import("./mainline-
|
|
4833
|
+
const transport = mainline || pinned ? new (await (import("./mainline-WM-WItCV.js"))).RelaysAndDht(mainline, pinned ? { relays: pinned } : {}, !!pinned) : null;
|
|
4812
4834
|
const apps = servedApps(paths.dir).length > 0;
|
|
4813
4835
|
const server = new EngineServer({
|
|
4814
4836
|
...transport ? { transport } : {},
|
|
@@ -4827,6 +4849,7 @@ async function startRuntime(paths, options = {}) {
|
|
|
4827
4849
|
callsSupport: callsUnavailable === null,
|
|
4828
4850
|
...callsUnavailable ? { callsUnavailable } : {},
|
|
4829
4851
|
...options.deferGroups ? { deferGroups: true } : {},
|
|
4852
|
+
...options.deferChats ? { deferChats: true } : {},
|
|
4830
4853
|
...options.offline ? { offline: true } : {},
|
|
4831
4854
|
...process.env.GHOSTLY_TEST_WEBRTC_GROUP_LINKS === "1" ? { webrtcGroupLinks: true } : {}
|
|
4832
4855
|
});
|
|
@@ -5149,4 +5172,4 @@ function connection(ctx, socket, secret) {
|
|
|
5149
5172
|
//#endregion
|
|
5150
5173
|
export { BASELINE_NEWEST, MAX_LINE, MAX_UNREAD, keepServing, openHost, serve };
|
|
5151
5174
|
|
|
5152
|
-
//# sourceMappingURL=host-
|
|
5175
|
+
//# sourceMappingURL=host-CVeNtA2_.js.map
|