@ghostlytools/cli 1.11.0 → 1.11.2
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 +24 -16
- package/dist/assets/{api-CTqIcdu7.js → api-BM3PsXbB.js} +372 -123
- package/dist/assets/api-BM3PsXbB.js.map +1 -0
- package/dist/assets/{api-B-52sVYp.js → api-CtXgscmK.js} +2 -2
- package/dist/assets/{apiKit-CZq4Lq4f.js → apiKit-lCTQ0EBG.js} +17 -7
- package/dist/assets/apiKit-lCTQ0EBG.js.map +1 -0
- package/dist/assets/appFetch-BKHy5H8J.js +194 -0
- package/dist/assets/appFetch-BKHy5H8J.js.map +1 -0
- package/dist/assets/{apps-kRsY9S2S.js → apps-DO_gAZgm.js} +1 -1
- package/dist/assets/{apps-C_X0zgSG.js → apps-Do26w3c7.js} +44 -40
- package/dist/assets/apps-Do26w3c7.js.map +1 -0
- package/dist/assets/{arkade-_aaB7VbW.js → arkade-CZrLbz-M.js} +2 -2
- package/dist/assets/{arkade-_aaB7VbW.js.map → arkade-CZrLbz-M.js.map} +1 -1
- package/dist/assets/{backup-DBg388Ke.js → backup-D21x1f5P.js} +1 -1
- package/dist/assets/{backup-OTvrmk-w.js → backup-j47AzDvG.js} +84 -33
- package/dist/assets/backup-j47AzDvG.js.map +1 -0
- package/dist/assets/{bitcoind-CZchoh43.js → bitcoind-CdSmvy2y.js} +3 -3
- package/dist/assets/{bitcoind-CZchoh43.js.map → bitcoind-CdSmvy2y.js.map} +1 -1
- package/dist/assets/{bitcoindProvider-DGw3xBSa.js → bitcoindProvider-BvoRh0D5.js} +2 -2
- package/dist/assets/{bitcoindProvider-DGw3xBSa.js.map → bitcoindProvider-BvoRh0D5.js.map} +1 -1
- package/dist/assets/{buttons-DUu7hxxT.js → buttons-CiGlBVBT.js} +18 -7
- package/dist/assets/buttons-CiGlBVBT.js.map +1 -0
- package/dist/assets/buttons-D2l2bVCG.js +2 -0
- package/dist/assets/{childEnv-BVOQK9EA.js → childEnv-K_IzUqQx.js} +4 -3
- package/dist/assets/childEnv-K_IzUqQx.js.map +1 -0
- package/dist/assets/{client-DDpZP1R1.js → client-raIncVtF.js} +31 -3
- package/dist/assets/client-raIncVtF.js.map +1 -0
- package/dist/assets/{codec-DrryGcPT.js → codec-DcG2AeyE.js} +2 -2
- package/dist/assets/{codec-DrryGcPT.js.map → codec-DcG2AeyE.js.map} +1 -1
- package/dist/assets/endpoint-DarqblYE.js +5052 -0
- package/dist/assets/endpoint-DarqblYE.js.map +1 -0
- package/dist/assets/{envelope-Q_rMgoE9.js → envelope-Dud6lntA.js} +2 -2
- package/dist/assets/{envelope-Q_rMgoE9.js.map → envelope-Dud6lntA.js.map} +1 -1
- package/dist/assets/{fedimintSdk-CqTeMdF0.js → fedimintSdk-DRKRSw14.js} +6 -3
- package/dist/assets/fedimintSdk-DRKRSw14.js.map +1 -0
- package/dist/assets/{fixedHosts-BV5GDiTU.js → fixedHosts-CNX7QiUD.js} +3 -3
- package/dist/assets/{fixedHosts-BV5GDiTU.js.map → fixedHosts-CNX7QiUD.js.map} +1 -1
- package/dist/assets/{host-BlUzZgQL.js → host-8RskzQgB.js} +306 -84
- package/dist/assets/host-8RskzQgB.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-BvI_uNZO.js → hyperdhtRelay-uAThbFub.js} +2 -2
- package/dist/assets/{hyperdhtRelay-BvI_uNZO.js.map → hyperdhtRelay-uAThbFub.js.map} +1 -1
- package/dist/assets/{irohWeb-CqPN8VPY.js → irohWeb-DGelfgDJ.js} +695 -40
- package/dist/assets/irohWeb-DGelfgDJ.js.map +1 -0
- package/dist/assets/jsonOut-POtMBS_V.js +16 -0
- package/dist/assets/jsonOut-POtMBS_V.js.map +1 -0
- package/dist/assets/{main-vQjlgEnt.js → main-BC33ooYg.js} +175 -107
- package/dist/assets/main-BC33ooYg.js.map +1 -0
- package/dist/assets/{mainline-p6HOW7sb.js → mainline-DYrjsS1t.js} +27 -8
- package/dist/assets/mainline-DYrjsS1t.js.map +1 -0
- package/dist/assets/{networkReason-DMffkiJ6.js → networkReason-n2oBs4by.js} +3 -3
- package/dist/assets/{networkReason-DMffkiJ6.js.map → networkReason-n2oBs4by.js.map} +1 -1
- package/dist/assets/{nwc-2vH18oNy.js → nwc-Do3VSlIS.js} +6 -5
- package/dist/assets/nwc-Do3VSlIS.js.map +1 -0
- package/dist/assets/{nwcProvider-DpeDy0bV.js → nwcProvider-Du5aWNIn.js} +6 -3
- package/dist/assets/{nwcProvider-DpeDy0bV.js.map → nwcProvider-Du5aWNIn.js.map} +1 -1
- package/dist/assets/{ownDid-iKz8u_fM.js → ownDid-CwwYu8s2.js} +3 -3
- package/dist/assets/{ownDid-iKz8u_fM.js.map → ownDid-CwwYu8s2.js.map} +1 -1
- package/dist/assets/{ownStatus-BlRKnM5F.js → ownStatus-D7dB4zJB.js} +4 -3
- package/dist/assets/{ownStatus-BlRKnM5F.js.map → ownStatus-D7dB4zJB.js.map} +1 -1
- package/dist/assets/{profiles-B5e0TyvS.js → profiles-NyF5FnYF.js} +82 -6
- package/dist/assets/profiles-NyF5FnYF.js.map +1 -0
- package/dist/assets/{registry-Cc_PQb3k.js → registry-C734VrO9.js} +1 -1
- package/dist/assets/{registry-CnFO2Pp5.js → registry-DKDInr0A.js} +75 -23
- package/dist/assets/registry-DKDInr0A.js.map +1 -0
- package/dist/assets/{resolve-DI8uAM_Y.js → resolve-3Tqh9AWQ.js} +4 -3
- package/dist/assets/resolve-3Tqh9AWQ.js.map +1 -0
- package/dist/assets/{server-DdtPxkqI.js → server-B6PQ6iae.js} +430 -868
- package/dist/assets/server-B6PQ6iae.js.map +1 -0
- package/dist/assets/{src-BnpEQqzk.js → src-ChJijTlM.js} +1139 -243
- package/dist/assets/src-ChJijTlM.js.map +1 -0
- package/dist/assets/{sshForges-cdIAraDw.js → sshForges-Brf0fslM.js} +2 -2
- package/dist/assets/{sshForges-cdIAraDw.js.map → sshForges-Brf0fslM.js.map} +1 -1
- package/dist/assets/{translate-kNopA04L.js → translate-xLme9Rdh.js} +10 -8
- package/dist/assets/translate-xLme9Rdh.js.map +1 -0
- package/dist/assets/{types-C4_KafL_.js → types-Clyb52K2.js} +2 -1
- package/dist/assets/types-Clyb52K2.js.map +1 -0
- package/dist/assets/{usdt-CDaLhEYh.js → usdt-CSU5KzTV.js} +3 -3
- package/dist/assets/{usdt-CDaLhEYh.js.map → usdt-CSU5KzTV.js.map} +1 -1
- package/dist/ghostly.mjs +1 -1
- package/npm-shrinkwrap.json +3592 -0
- package/package.json +5 -3
- package/dist/assets/api-CTqIcdu7.js.map +0 -1
- package/dist/assets/apiKit-CZq4Lq4f.js.map +0 -1
- package/dist/assets/apps-C_X0zgSG.js.map +0 -1
- package/dist/assets/backup-OTvrmk-w.js.map +0 -1
- package/dist/assets/buttons-4EKtQl-7.js +0 -2
- package/dist/assets/buttons-DUu7hxxT.js.map +0 -1
- package/dist/assets/childEnv-BVOQK9EA.js.map +0 -1
- package/dist/assets/client-DDpZP1R1.js.map +0 -1
- package/dist/assets/endpoint-DWHkXWVM.js +0 -419
- package/dist/assets/endpoint-DWHkXWVM.js.map +0 -1
- package/dist/assets/fedimintSdk-CqTeMdF0.js.map +0 -1
- package/dist/assets/host-BlUzZgQL.js.map +0 -1
- package/dist/assets/irohWeb-CqPN8VPY.js.map +0 -1
- package/dist/assets/main-vQjlgEnt.js.map +0 -1
- package/dist/assets/mainline-p6HOW7sb.js.map +0 -1
- package/dist/assets/nwc-2vH18oNy.js.map +0 -1
- package/dist/assets/profiles-B5e0TyvS.js.map +0 -1
- package/dist/assets/registry-CnFO2Pp5.js.map +0 -1
- package/dist/assets/resolve-DI8uAM_Y.js.map +0 -1
- package/dist/assets/server-DdtPxkqI.js.map +0 -1
- package/dist/assets/src-BnpEQqzk.js.map +0 -1
- package/dist/assets/translate-kNopA04L.js.map +0 -1
- package/dist/assets/types-C4_KafL_.js.map +0 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ao as STATUS_CARD_LIMITS, Ba as sanitizeMime, Bn as withoutAudioMetadata, Fo as cardLine, Ga as downsamplePeaks, Gu as normalizeRelayUrl, Ha as VOICE_LIMITS, Ja as voiceDownloadName, Jn as withoutPictureMetadata, Ku as relayUrlProblem, Lo as checkStatusCard, Mo as appCardId, Nl as appRef, No as appCardUrl, Oi as APP_DATA_MAX_BYTES, Tl as isAppUrl, Ua as VOICE_METER, Un as withoutVideoMetadata, Uo as claimedTime, Va as PLAYABLE_AUDIO, Vo as MESSAGE_CLOCK_SKEW_MS, Wa as baseMime, Wn as NO_PICTURE_METADATA, Xi as identityStatement, Ya as voiceLevel, ai as sanitizeTypingStatus, bd as toBase64Url, bl as APP_PERMISSIONS, bs as LIMITS, cs as AWAITING_PEER_MS, dd as sanitizeAvatar, gs as GhostlyHttpError, lu as ownInviteRefusal, ni as TYPING_KINDS, or as GROUP_FILE_LIMITS, qa as parseVoiceMeta, ql as readImageMeta, qn as stripPictureMetadata, ri as TYPING_REFRESH_MS, su as inviteLink, ud as MAX_AVATAR_LENGTH, vs as parseLocalTarget, xo as replySnippet, yd as randomBytes$1, za as sanitizeFileName, zl as isAppRef, zo as statusCardBytes } from "./src-ChJijTlM.js";
|
|
2
2
|
import { p as fileStore } from "./idb-CEuoNsTv.js";
|
|
3
3
|
import { f as FILE_BYTES_STEP, o as fileBytes, s as fileBytesOf } from "./fileBytes-BLPZq9YU.js";
|
|
4
|
-
import {
|
|
5
|
-
import { t as IDENTITY_PROVIDERS } from "./registry-
|
|
4
|
+
import { B as removeStored, U as waitingGroupFile, W as IDENTITY_DRAFT_TTL_MS, a as groupMemberOfLink, b as replyRef, c as groupPayTwin, ft as iceServerProblem, h as groupOfFile, k as paymentNetwork, o as groupPayLineId, p as groupFileId, pt as iceServerSetting, s as groupPayNoteId, t as DEFAULT_IROH_RELAYS } from "./irohWeb-DGelfgDJ.js";
|
|
5
|
+
import { t as IDENTITY_PROVIDERS } from "./registry-DKDInr0A.js";
|
|
6
6
|
import { n as secretWords, r as findSecret, t as guardText } from "./secretGuard-B7Hj0Kvz.js";
|
|
7
7
|
import { i as localFileError, r as asCliError, t as CliError } from "./errors-Dt-ZnyOX.js";
|
|
8
|
-
import { a as PAY_METHODS, d as ENGINE_METHODS, f as ENGINE_PARAMS, g as engineParamsProblem, i as CHAT_METHODS, l as withStoredIds, m as READ_PARAMS, n as statusJson, o as TRANSPORT_NAMES, p as ENGINE_READS, r as ADDRESS_TYPES, s as WALLET_TYPES, t as checkOwnStatus, u as DESTRUCTIVE_CALLS } from "./ownStatus-
|
|
9
|
-
import { A as sinceSeq, D as oneShotWaits, E as oneOf, F as transportOffered, I as waitForState, N as state, O as sentAt, P as str, S as nobodyJoined, T as num, _ as messageOf, b as noFile, c as findChatOrGroup, d as groupNameOf, f as groupOf, g as list, h as keptForJoin,
|
|
10
|
-
import { t as childEnv } from "./childEnv-
|
|
8
|
+
import { a as PAY_METHODS, d as ENGINE_METHODS, f as ENGINE_PARAMS, g as engineParamsProblem, i as CHAT_METHODS, l as withStoredIds, m as READ_PARAMS, n as statusJson, o as TRANSPORT_NAMES, p as ENGINE_READS, r as ADDRESS_TYPES, s as WALLET_TYPES, t as checkOwnStatus, u as DESTRUCTIVE_CALLS } from "./ownStatus-D7dB4zJB.js";
|
|
9
|
+
import { A as sinceSeq, D as oneShotWaits, E as oneOf, F as transportOffered, I as waitForState, N as state, O as sentAt, P as str, S as nobodyJoined, T as num, _ as messageOf, a as contactKeyOf, b as noFile, c as findChatOrGroup, d as groupNameOf, f as groupOf, g as list, h as keptForJoin, j as somebodyJoined, k as shownName, l as findGroup, m as inviteTaken, n as chatOf, o as dhtOnly, p as groupPrefixed, r as chatOrGroup, s as findChat, t as bool, u as findOwnNamedChat, w as node, x as noMessage } from "./apiKit-lCTQ0EBG.js";
|
|
10
|
+
import { t as childEnv } from "./childEnv-K_IzUqQx.js";
|
|
11
11
|
import { t as chatState } from "./waitNotice-Cn0WJ-He.js";
|
|
12
|
-
import { a as goesOn, c as
|
|
13
|
-
import { a as checkShownName } from "./profiles-
|
|
14
|
-
import { t as BACKUP_METHODS } from "./backup-
|
|
15
|
-
import { o as checkedBundle } from "./apps-
|
|
12
|
+
import { a as goesOn, c as waitForEdit, d as waitForRemoval, i as pressable, l as waitForGroupFrame, n as buttonsCard, o as nobodyElseIn, s as waitForConfirmed, t as BUTTON_METHODS, u as waitForMessage } from "./buttons-CiGlBVBT.js";
|
|
13
|
+
import { a as checkShownName } from "./profiles-NyF5FnYF.js";
|
|
14
|
+
import { t as BACKUP_METHODS } from "./backup-j47AzDvG.js";
|
|
15
|
+
import { o as checkedBundle } from "./apps-Do26w3c7.js";
|
|
16
16
|
import { generateMnemonic } from "@scure/bip39";
|
|
17
17
|
import { wordlist } from "@scure/bip39/wordlists/english.js";
|
|
18
18
|
import { execFile, spawn } from "node:child_process";
|
|
19
|
-
import { openAsBlob, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
19
|
+
import { openAsBlob, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
20
20
|
import { access, constants as constants$1, copyFile, link, open, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
21
21
|
import { basename, dirname, extname, join, resolve, sep } from "node:path";
|
|
22
22
|
import { randomBytes, timingSafeEqual } from "node:crypto";
|
|
@@ -373,6 +373,12 @@ function pushWavFrames(view, from, to, channels, width, read, sink) {
|
|
|
373
373
|
more: true
|
|
374
374
|
};
|
|
375
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* Opus packets a demuxer keeps: as many as the longest voice note read past its limit can have, at 2.5 ms (Opus's
|
|
378
|
+
* shortest packet) each. Past it a file is longer than a voice note anyway. Before, a 1 MB WebM of blocks each lacing
|
|
379
|
+
* 256 empty frames held ~8 KB of heap per byte read, and took the daemon down out of memory.
|
|
380
|
+
*/
|
|
381
|
+
var MAX_OPUS_PACKETS = Math.ceil((VOICE_LIMITS.maxDurationMs + PAST_LIMIT_MS) / 2.5);
|
|
376
382
|
/** A variable-length number in EBML: its length in bytes and value (the marker bit kept for ids, dropped for sizes). */
|
|
377
383
|
function vint(bytes, at, keepMarker) {
|
|
378
384
|
const first = bytes[at];
|
|
@@ -408,7 +414,7 @@ function demuxWebm(bytes) {
|
|
|
408
414
|
const tracks = [];
|
|
409
415
|
const blocks = [];
|
|
410
416
|
let at = 0;
|
|
411
|
-
while (at < bytes.length) {
|
|
417
|
+
while (at < bytes.length && blocks.length < MAX_OPUS_PACKETS) {
|
|
412
418
|
const id = vint(bytes, at, true);
|
|
413
419
|
if (!id) break;
|
|
414
420
|
const size = vint(bytes, at + id.length, false);
|
|
@@ -434,7 +440,7 @@ function demuxWebm(bytes) {
|
|
|
434
440
|
else if (id.value === 159 && track) track.channels = uint(data);
|
|
435
441
|
else if (id.value === 163 || id.value === 161) {
|
|
436
442
|
const number = vint(data, 0, false);
|
|
437
|
-
if (number) for (const frame of laced(data, number.length)) blocks.push({
|
|
443
|
+
if (number) for (const frame of laced(data, number.length).slice(0, MAX_OPUS_PACKETS - blocks.length)) blocks.push({
|
|
438
444
|
track: number.value,
|
|
439
445
|
data: frame
|
|
440
446
|
});
|
|
@@ -497,7 +503,7 @@ function demuxOgg(bytes) {
|
|
|
497
503
|
let packet = [];
|
|
498
504
|
let endGranule;
|
|
499
505
|
let at = 0;
|
|
500
|
-
while (at + 27 <= bytes.length && ascii(bytes, at, 4) === "OggS") {
|
|
506
|
+
while (at + 27 <= bytes.length && ascii(bytes, at, 4) === "OggS" && frames.length < MAX_OPUS_PACKETS) {
|
|
501
507
|
const segments = bytes[at + 26];
|
|
502
508
|
const table = bytes.subarray(at + 27, at + 27 + segments);
|
|
503
509
|
let pos = at + 27 + segments;
|
|
@@ -507,6 +513,7 @@ function demuxOgg(bytes) {
|
|
|
507
513
|
serial = pageSerial;
|
|
508
514
|
if (granule >= 0) endGranule = granule;
|
|
509
515
|
for (const size of table) {
|
|
516
|
+
if (frames.length >= MAX_OPUS_PACKETS) break;
|
|
510
517
|
packet.push(bytes.subarray(pos, pos + size));
|
|
511
518
|
pos += size;
|
|
512
519
|
if (size < 255) {
|
|
@@ -848,17 +855,21 @@ async function voiceOf(params, path, mime, size) {
|
|
|
848
855
|
throw new CliError("bad_request", `A voice note's waveform is 1 to ${VOICE_LIMITS.maxBars} peaks from 0 to 255`);
|
|
849
856
|
}
|
|
850
857
|
/**
|
|
851
|
-
* The file at `path` as it is sent, as the apps send it (platform/services.ts `sendable`): a picture
|
|
852
|
-
* QuickTime video without its metadata (where it was taken or recorded, the device, the time
|
|
853
|
-
* and its digest computed. One whose metadata cannot be removed is
|
|
858
|
+
* The file at `path` as it is sent, as the apps send it (platform/services.ts `sendable`): a picture, an MP4 or
|
|
859
|
+
* QuickTime video or an audio file without its metadata (where it was taken or recorded, the device, the time, an
|
|
860
|
+
* audio file's tags), before its size is read and its digest computed. One whose metadata cannot be removed is
|
|
861
|
+
* refused, never sent as it was. A voice note is a file made anywhere, so its tags go too.
|
|
854
862
|
*/
|
|
855
|
-
async function sendable(path, mime
|
|
863
|
+
async function sendable(path, mime) {
|
|
856
864
|
const source = await openAsBlob(path, { type: mime });
|
|
857
|
-
if (voice) return source;
|
|
858
865
|
try {
|
|
859
|
-
return await withoutPictureMetadata(source, mime) ?? await withoutVideoMetadata(source, mime) ?? source;
|
|
866
|
+
return await withoutPictureMetadata(source, mime) ?? await withoutVideoMetadata(source, mime) ?? await withoutAudioMetadata(source, mime) ?? source;
|
|
860
867
|
} catch (error) {
|
|
861
|
-
if (error instanceof Error &&
|
|
868
|
+
if (error instanceof Error && [
|
|
869
|
+
"This picture cannot be sent: Ghostly could not remove the details saved in it, like where it was taken",
|
|
870
|
+
"This video cannot be sent: Ghostly could not remove the details saved in it, like where it was recorded",
|
|
871
|
+
"This audio cannot be sent: Ghostly could not remove the details saved in it, like where it was recorded"
|
|
872
|
+
].includes(error.message)) throw new CliError("refused", error.message);
|
|
862
873
|
throw error;
|
|
863
874
|
}
|
|
864
875
|
}
|
|
@@ -897,7 +908,7 @@ async function sendToGroup(ctx, params, group, path, picked) {
|
|
|
897
908
|
const check = await node(ctx).groupFileCheck({ groupId: group.id });
|
|
898
909
|
if (check.error) throw check.refused ? new CliError("refused", check.error) : groupSendRefused(check.error);
|
|
899
910
|
const { voice, warning } = await voiceOf(params, path, mime, picked);
|
|
900
|
-
const source = await whileUnchanged(path, () => sendable(path, mime
|
|
911
|
+
const source = await whileUnchanged(path, () => sendable(path, mime));
|
|
901
912
|
const size = source.size;
|
|
902
913
|
const image = voice ? void 0 : await whileUnchanged(path, () => readImageMeta(source, mime));
|
|
903
914
|
const fileId = groupFileId(group.id, "out");
|
|
@@ -1109,7 +1120,7 @@ var FILE_METHODS = {
|
|
|
1109
1120
|
}, { tail: ", or it cannot be replied to" });
|
|
1110
1121
|
}
|
|
1111
1122
|
const { voice, warning } = await voiceOf(params, path, mime, info.size);
|
|
1112
|
-
const source = await whileUnchanged(path, () => sendable(path, mime
|
|
1123
|
+
const source = await whileUnchanged(path, () => sendable(path, mime));
|
|
1113
1124
|
const image = voice ? void 0 : await whileUnchanged(path, () => readImageMeta(source, mime));
|
|
1114
1125
|
const wireId = toBase64Url(randomBytes$1(12));
|
|
1115
1126
|
const file = {
|
|
@@ -1860,6 +1871,37 @@ function writeHolds(ctx, holds) {
|
|
|
1860
1871
|
writeFileSync(file + ".tmp", JSON.stringify(holds) + "\n", { mode: 384 });
|
|
1861
1872
|
renameSync(file + ".tmp", file);
|
|
1862
1873
|
}
|
|
1874
|
+
/**
|
|
1875
|
+
* Changes one chat's entry: the file is read again right here and written back in the same step, with no wait in
|
|
1876
|
+
* between, so what another chat's hold, expiry or release wrote meanwhile stays. Each call read the file before its
|
|
1877
|
+
* engine call and wrote that copy back after it: two holds at once on a daemon (which serves its connections at once)
|
|
1878
|
+
* kept only one, and the other chat stayed on DHT only for good; an expiry meanwhile brought an ended hold back.
|
|
1879
|
+
* Only one process writes the file: a command goes through the profile's daemon when one runs, and otherwise holds
|
|
1880
|
+
* the profile itself.
|
|
1881
|
+
*/
|
|
1882
|
+
function editHold(ctx, linkId, hold) {
|
|
1883
|
+
const holds = readHolds(ctx);
|
|
1884
|
+
if (hold) holds[linkId] = hold;
|
|
1885
|
+
else if (holds[linkId]) delete holds[linkId];
|
|
1886
|
+
else return;
|
|
1887
|
+
writeHolds(ctx, holds);
|
|
1888
|
+
}
|
|
1889
|
+
/** Per profile folder and chat, the last change to its hold under way: changes to one chat's hold go one after another. */
|
|
1890
|
+
var queues = /* @__PURE__ */ new Map();
|
|
1891
|
+
/**
|
|
1892
|
+
* Runs `task` once the changes to this chat's hold started before it are done (failed or not). A hold and an expiry,
|
|
1893
|
+
* a release or a removal of the same chat no longer run into each other; other chats' run meanwhile.
|
|
1894
|
+
*/
|
|
1895
|
+
function inTurn(ctx, linkId, task) {
|
|
1896
|
+
const key = `${ctx.runtime.paths.dir}\0${linkId}`;
|
|
1897
|
+
const run = (queues.get(key) ?? Promise.resolve()).then(task, task);
|
|
1898
|
+
const settled = run.then(() => {}, () => {});
|
|
1899
|
+
queues.set(key, settled);
|
|
1900
|
+
settled.then(() => {
|
|
1901
|
+
if (queues.get(key) === settled) queues.delete(key);
|
|
1902
|
+
});
|
|
1903
|
+
return run;
|
|
1904
|
+
}
|
|
1863
1905
|
function timersOf(ctx) {
|
|
1864
1906
|
let map = timers.get(ctx);
|
|
1865
1907
|
if (!map) timers.set(ctx, map = /* @__PURE__ */ new Map());
|
|
@@ -1908,56 +1950,78 @@ function holdOf(ctx, linkId) {
|
|
|
1908
1950
|
return until !== void 0 && until > Date.now() ? until : null;
|
|
1909
1951
|
}
|
|
1910
1952
|
/** Keeps the chat off its direct link for `minutes` (again: from now). */
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1953
|
+
function holdChat(ctx, link, minutes) {
|
|
1954
|
+
return inTurn(ctx, link.id, async () => {
|
|
1955
|
+
const now = state(ctx).links.find((l) => l.id === link.id) ?? link;
|
|
1956
|
+
const held = readHolds(ctx)[link.id];
|
|
1957
|
+
if (now.deliveryMode === "dht" && !held) throw new CliError("refused", "This chat is on DHT only already, by its own choice: chat transport auto leaves it");
|
|
1958
|
+
if (!now.profile) throw new CliError("unavailable", "A chat of the older protocol has no DHT only");
|
|
1959
|
+
const until = Date.now() + minutes * 6e4;
|
|
1960
|
+
editHold(ctx, link.id, {
|
|
1961
|
+
until,
|
|
1962
|
+
since: held?.since ?? Date.now()
|
|
1920
1963
|
});
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
chat
|
|
1932
|
-
|
|
1964
|
+
if (now.deliveryMode !== "dht") try {
|
|
1965
|
+
await node(ctx).setChatTransport({
|
|
1966
|
+
linkId: link.id,
|
|
1967
|
+
transport: "dht"
|
|
1968
|
+
});
|
|
1969
|
+
} catch (error) {
|
|
1970
|
+
editHold(ctx, link.id, held ?? null);
|
|
1971
|
+
throw new CliError("unavailable", error instanceof Error ? error.message : String(error));
|
|
1972
|
+
}
|
|
1973
|
+
schedule(ctx, link.id, until);
|
|
1974
|
+
ctx.hub.emit("chat.held", `chat.held:${link.id}:${until}`, {
|
|
1975
|
+
chat: link.id,
|
|
1976
|
+
until
|
|
1977
|
+
});
|
|
1978
|
+
return until;
|
|
1933
1979
|
});
|
|
1934
|
-
return until;
|
|
1935
1980
|
}
|
|
1936
1981
|
/**
|
|
1937
1982
|
* Ends a hold: the chat leaves DHT only, unless someone chose otherwise meanwhile. Whether there was one. `reason`:
|
|
1938
1983
|
* expired, connect (`chat connect`) or lifted (`--hold 0`, or `chat transport`: `chosen`, the chat's transport was
|
|
1939
1984
|
* just chosen, and stays as chosen).
|
|
1940
1985
|
*/
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1986
|
+
function releaseHold(ctx, linkId, reason, chosen = false) {
|
|
1987
|
+
return inTurn(ctx, linkId, async () => {
|
|
1988
|
+
if (!readHolds(ctx)[linkId]) return false;
|
|
1989
|
+
stopWait(ctx, linkId);
|
|
1990
|
+
const link = state(ctx).links.find((l) => l.id === linkId);
|
|
1991
|
+
if (!chosen && link?.deliveryMode === "dht") await node(ctx).setDeliveryMode({
|
|
1992
|
+
linkId,
|
|
1993
|
+
mode: "stream"
|
|
1994
|
+
});
|
|
1995
|
+
editHold(ctx, linkId, null);
|
|
1996
|
+
ctx.hub.emit("chat.released", `chat.released:${linkId}:${Date.now()}`, {
|
|
1997
|
+
chat: linkId,
|
|
1998
|
+
reason
|
|
1999
|
+
});
|
|
2000
|
+
return true;
|
|
1949
2001
|
});
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
2002
|
+
}
|
|
2003
|
+
/**
|
|
2004
|
+
* A removed chat's hold goes with it, with no release said: it stayed in the folder until its time was up (and in a
|
|
2005
|
+
* backup made meanwhile), a chat joined again from the same invite showed its `heldUntil`, and its end said
|
|
2006
|
+
* `chat.released` for a chat that was gone.
|
|
2007
|
+
*/
|
|
2008
|
+
function forgetHold(ctx, linkId) {
|
|
2009
|
+
return inTurn(ctx, linkId, async () => {
|
|
2010
|
+
stopWait(ctx, linkId);
|
|
2011
|
+
editHold(ctx, linkId, null);
|
|
1955
2012
|
});
|
|
1956
|
-
return true;
|
|
1957
2013
|
}
|
|
1958
|
-
/**
|
|
2014
|
+
/**
|
|
2015
|
+
* At start: holds whose time is up end now, the others are timed again. A hold whose chat the store does not have is
|
|
2016
|
+
* dropped, with no release said: a profile restored from a backup taken while that chat was removed (the backup reads
|
|
2017
|
+
* holds.json before and after its store) had it, and its end said `chat.released` for a chat it never had.
|
|
2018
|
+
*/
|
|
1959
2019
|
function resumeHolds(ctx) {
|
|
1960
|
-
|
|
2020
|
+
const chats = new Set(state(ctx).links.map((link) => link.id));
|
|
2021
|
+
const holds = readHolds(ctx), gone = Object.keys(holds).filter((linkId) => !chats.has(linkId));
|
|
2022
|
+
for (const linkId of gone) delete holds[linkId];
|
|
2023
|
+
if (gone.length) writeHolds(ctx, holds);
|
|
2024
|
+
for (const [linkId, hold] of Object.entries(holds)) schedule(ctx, linkId, hold.until);
|
|
1961
2025
|
}
|
|
1962
2026
|
//#endregion
|
|
1963
2027
|
//#region src/views.ts
|
|
@@ -2054,6 +2118,23 @@ function chatDetailsJson(link, showSecret) {
|
|
|
2054
2118
|
pin: pinJson(link.pin)
|
|
2055
2119
|
};
|
|
2056
2120
|
}
|
|
2121
|
+
function groupPayJson(note) {
|
|
2122
|
+
const by = note.from === "*" && note.rail === "lightning" ? null : note.by ?? null;
|
|
2123
|
+
return {
|
|
2124
|
+
id: note.id,
|
|
2125
|
+
kind: note.kind,
|
|
2126
|
+
from: note.from,
|
|
2127
|
+
to: note.to,
|
|
2128
|
+
by,
|
|
2129
|
+
claims: [...note.claims ?? []],
|
|
2130
|
+
amount: note.amount,
|
|
2131
|
+
decimals: note.decimals,
|
|
2132
|
+
unit: note.unit,
|
|
2133
|
+
rail: note.rail,
|
|
2134
|
+
state: note.state,
|
|
2135
|
+
test: !!note.test
|
|
2136
|
+
};
|
|
2137
|
+
}
|
|
2057
2138
|
function messageJson(message) {
|
|
2058
2139
|
return {
|
|
2059
2140
|
id: message.id,
|
|
@@ -2097,7 +2178,8 @@ function messageJson(message) {
|
|
|
2097
2178
|
button: message.press.button,
|
|
2098
2179
|
label: message.press.label,
|
|
2099
2180
|
...message.press.inferred ? { inferred: true } : {}
|
|
2100
|
-
} } : {}
|
|
2181
|
+
} } : {},
|
|
2182
|
+
...message.groupPay ? { groupPay: groupPayJson(message.groupPay) } : {}
|
|
2101
2183
|
};
|
|
2102
2184
|
}
|
|
2103
2185
|
/**
|
|
@@ -2147,9 +2229,13 @@ function chatMessageJson(message, link) {
|
|
|
2147
2229
|
* name rides on the edge or the roster), so the roster fills `nick` when the message has none, and for an author no
|
|
2148
2230
|
* longer in it (removed, or back with a new member key) the name the group knew them by. A group's own line written
|
|
2149
2231
|
* before that name came ("Member a4w9nb5y joined") says it, as the app draws it; before, it kept the key for good.
|
|
2232
|
+
* `twinOf`: the line of the payment note this message is the twin of (`groupPayTwins`).
|
|
2150
2233
|
*/
|
|
2151
|
-
function groupMessageJson(message, group) {
|
|
2152
|
-
const json =
|
|
2234
|
+
function groupMessageJson(message, group, twinOf) {
|
|
2235
|
+
const json = twinOf ? {
|
|
2236
|
+
...messageJson(message),
|
|
2237
|
+
twinOf
|
|
2238
|
+
} : messageJson(message);
|
|
2153
2239
|
if (!message.member) return json;
|
|
2154
2240
|
const nick = json.nick ?? group?.members.find((m) => m.key === message.member)?.nick ?? group?.formerNames?.[message.member];
|
|
2155
2241
|
if (!nick) return json;
|
|
@@ -2162,6 +2248,20 @@ function groupMessageJson(message, group) {
|
|
|
2162
2248
|
};
|
|
2163
2249
|
}
|
|
2164
2250
|
/**
|
|
2251
|
+
* Which payment lines of a group's history are twins of a payment note's line, by message id, as the app's group page
|
|
2252
|
+
* tells them (`groupPayTwin`): the requester's own request, the request as it came over the edge, a payment answering
|
|
2253
|
+
* it. Only for a note whose line is in `notes` (the group's, by note id): a twin of nothing is no twin.
|
|
2254
|
+
*/
|
|
2255
|
+
function groupPayTwins(messages, notes, payments, group) {
|
|
2256
|
+
const twins = /* @__PURE__ */ new Map();
|
|
2257
|
+
for (const m of messages) {
|
|
2258
|
+
if (!m.paymentId || m.groupPay) continue;
|
|
2259
|
+
const note = groupPayTwin(m, payments[m.paymentId], (id) => notes.get(id), group?.myKey, (linkId) => groupMemberOfLink(group, linkId));
|
|
2260
|
+
if (note && notes.has(note)) twins.set(m.id, groupPayLineId(note));
|
|
2261
|
+
}
|
|
2262
|
+
return twins;
|
|
2263
|
+
}
|
|
2264
|
+
/**
|
|
2165
2265
|
* A group as the CLI prints it. The entry link lets anyone who reads it join, so it is `<hidden>` unless asked for
|
|
2166
2266
|
* (`--show-secret`, or `group link`); null when the group has none.
|
|
2167
2267
|
*/
|
|
@@ -2213,14 +2313,28 @@ function groupJson(group, showSecret = false) {
|
|
|
2213
2313
|
/**
|
|
2214
2314
|
* A member by key, unique key prefix or name; never this profile itself (`myName`: its name, which its own row lacks).
|
|
2215
2315
|
* A whole key is that member, whatever another member calls itself; a prefix and a name stand side by side (two
|
|
2216
|
-
* members is an error, not a guess).
|
|
2316
|
+
* members is an error, not a guess). For a grant (`byKeyOnly`: admin, a pinned hub) a member found only by the name it
|
|
2317
|
+
* gave itself is refused, with its key: another member could call itself that name while the one meant is away, as
|
|
2318
|
+
* `findOwnNamedChat` refuses a contact's own name.
|
|
2217
2319
|
*/
|
|
2218
|
-
function findMember(group, ref, myName) {
|
|
2320
|
+
function findMember(group, ref, myName, byKeyOnly = false) {
|
|
2219
2321
|
const lower = ref.toLowerCase();
|
|
2322
|
+
const asKey = contactKeyOf(ref);
|
|
2323
|
+
if (asKey !== void 0) {
|
|
2324
|
+
const member = group.members.find((m) => !m.me && m.key === asKey);
|
|
2325
|
+
if (member) return member;
|
|
2326
|
+
throw noMember(group, asKey, myName);
|
|
2327
|
+
}
|
|
2220
2328
|
const others = group.members.filter((m) => !m.me);
|
|
2221
2329
|
const byKey = others.filter((m) => m.key === ref);
|
|
2222
2330
|
const matches = byKey.length ? byKey : others.filter((m) => m.key.startsWith(ref) || m.nick?.trim().toLowerCase() === lower);
|
|
2223
|
-
if (matches.length === 1)
|
|
2331
|
+
if (matches.length === 1) {
|
|
2332
|
+
if (byKeyOnly && !matches[0].key.startsWith(ref)) throw new CliError("bad_request", `${JSON.stringify(ref)} names a member only by the name it gave itself: use its key`, {
|
|
2333
|
+
member: matches[0].key,
|
|
2334
|
+
name: matches[0].nick ?? null
|
|
2335
|
+
});
|
|
2336
|
+
return matches[0];
|
|
2337
|
+
}
|
|
2224
2338
|
throw matches.length ? new CliError("bad_request", `${JSON.stringify(ref)} names more than one member`) : noMember(group, ref, myName);
|
|
2225
2339
|
}
|
|
2226
2340
|
/**
|
|
@@ -2262,12 +2376,23 @@ async function picture(params) {
|
|
|
2262
2376
|
if (bool(params, "clear")) return null;
|
|
2263
2377
|
return pictureFrom(str(params, "path", true));
|
|
2264
2378
|
}
|
|
2265
|
-
/**
|
|
2266
|
-
|
|
2379
|
+
/**
|
|
2380
|
+
* A group this profile administers or is in, not only an invitation: before, the engine answered `group rename`,
|
|
2381
|
+
* `picture`, `link`, `rotate` and `invite` on an invitation not yet joined with "Group not found" (engine, exit 1),
|
|
2382
|
+
* while `group show` listed it, and `remove`/`admin` said "No member" of a member list it had not received yet.
|
|
2383
|
+
*/
|
|
2384
|
+
function joined(ctx, params, twin) {
|
|
2385
|
+
const group = groupOf(ctx, params, twin);
|
|
2386
|
+
if (group.status || !group.invitation) return group;
|
|
2387
|
+
const ref = str(params, "group", true), shown = /^[\w.:-]+$/.test(ref) ? ref : JSON.stringify(ref);
|
|
2388
|
+
throw new CliError("refused", group.invitation.accepted ? `You are not in ${group.name} yet: you accepted its invitation, and its admin has not let you in` : `You are not in ${group.name} yet: ghostly group accept ${shown} joins it`);
|
|
2389
|
+
}
|
|
2390
|
+
/** The member `params.member` names in `group`, this profile's own name said to be it; by its key only for a grant. */
|
|
2391
|
+
var member = (ctx, group, params, grant = false) => findMember(group, str(params, "member", true), state(ctx).settings.nick, grant);
|
|
2267
2392
|
var view = (ctx, id, params) => groupJson(state(ctx).groups.find((g) => g.id === id) ?? groupOf(ctx, { group: id }), bool(params, "showSecret"));
|
|
2268
2393
|
var GROUP_ADMIN_METHODS = {
|
|
2269
2394
|
async "group.invite"(ctx, params) {
|
|
2270
|
-
const group =
|
|
2395
|
+
const group = joined(ctx, params);
|
|
2271
2396
|
const link = findOwnNamedChat(state(ctx).links, str(params, "chat", true), state(ctx).groups);
|
|
2272
2397
|
await node(ctx).inviteToGroup({
|
|
2273
2398
|
groupId: group.id,
|
|
@@ -2276,23 +2401,28 @@ var GROUP_ADMIN_METHODS = {
|
|
|
2276
2401
|
return view(ctx, group.id, params);
|
|
2277
2402
|
},
|
|
2278
2403
|
async "group.remove"(ctx, params) {
|
|
2279
|
-
const group =
|
|
2404
|
+
const group = joined(ctx, params);
|
|
2405
|
+
const removed = member(ctx, group, params);
|
|
2280
2406
|
await node(ctx).removeGroupMember({
|
|
2281
2407
|
groupId: group.id,
|
|
2282
|
-
key:
|
|
2408
|
+
key: removed.key
|
|
2283
2409
|
});
|
|
2284
|
-
|
|
2410
|
+
const linkOn = !!(state(ctx).groups.find((g) => g.id === group.id) ?? group).entryLink;
|
|
2411
|
+
return {
|
|
2412
|
+
...view(ctx, group.id, params),
|
|
2413
|
+
...linkOn && { warning: `${removed.nick ?? "They"} can still join again with the group's link: ghostly group link ${group.id} --reset gives it a new one and keeps them out` }
|
|
2414
|
+
};
|
|
2285
2415
|
},
|
|
2286
2416
|
async "group.admin"(ctx, params) {
|
|
2287
|
-
const group =
|
|
2417
|
+
const group = joined(ctx, params);
|
|
2288
2418
|
await node(ctx).makeGroupAdmin({
|
|
2289
2419
|
groupId: group.id,
|
|
2290
|
-
key: member(ctx, group, params).key
|
|
2420
|
+
key: member(ctx, group, params, true).key
|
|
2291
2421
|
});
|
|
2292
2422
|
return view(ctx, group.id, params);
|
|
2293
2423
|
},
|
|
2294
2424
|
async "group.hub"(ctx, params) {
|
|
2295
|
-
const group =
|
|
2425
|
+
const group = joined(ctx, params);
|
|
2296
2426
|
const role = str(params, "role") ?? "auto";
|
|
2297
2427
|
if (![
|
|
2298
2428
|
"pin",
|
|
@@ -2301,13 +2431,13 @@ var GROUP_ADMIN_METHODS = {
|
|
|
2301
2431
|
].includes(role)) throw new CliError("bad_request", "role is pin, exclude or auto");
|
|
2302
2432
|
await node(ctx).setGroupHub({
|
|
2303
2433
|
groupId: group.id,
|
|
2304
|
-
key: member(ctx, group, params).key,
|
|
2434
|
+
key: member(ctx, group, params, role === "pin").key,
|
|
2305
2435
|
role: role === "auto" ? null : role
|
|
2306
2436
|
});
|
|
2307
2437
|
return view(ctx, group.id, params);
|
|
2308
2438
|
},
|
|
2309
2439
|
async "group.rename"(ctx, params) {
|
|
2310
|
-
const group =
|
|
2440
|
+
const group = joined(ctx, params, "chat rename <chat> <name...>");
|
|
2311
2441
|
const name = groupNameOf(params);
|
|
2312
2442
|
guardText(name, bool(params, "force"), "group's name", "rename it");
|
|
2313
2443
|
await node(ctx).renameGroup({
|
|
@@ -2317,12 +2447,12 @@ var GROUP_ADMIN_METHODS = {
|
|
|
2317
2447
|
return view(ctx, group.id, params);
|
|
2318
2448
|
},
|
|
2319
2449
|
async "group.rotate"(ctx, params) {
|
|
2320
|
-
const group =
|
|
2450
|
+
const group = joined(ctx, params);
|
|
2321
2451
|
await node(ctx).rotateGroup({ groupId: group.id });
|
|
2322
2452
|
return view(ctx, group.id, params);
|
|
2323
2453
|
},
|
|
2324
2454
|
async "group.link"(ctx, params) {
|
|
2325
|
-
const group =
|
|
2455
|
+
const group = joined(ctx, params);
|
|
2326
2456
|
if (params.on === false) {
|
|
2327
2457
|
await node(ctx).disableGroupLink({ groupId: group.id });
|
|
2328
2458
|
return {
|
|
@@ -2340,7 +2470,7 @@ var GROUP_ADMIN_METHODS = {
|
|
|
2340
2470
|
};
|
|
2341
2471
|
},
|
|
2342
2472
|
async "group.picture"(ctx, params) {
|
|
2343
|
-
const group =
|
|
2473
|
+
const group = joined(ctx, params);
|
|
2344
2474
|
await node(ctx).setGroupPicture({
|
|
2345
2475
|
groupId: group.id,
|
|
2346
2476
|
picture: await picture(params)
|
|
@@ -3156,10 +3286,26 @@ function servedApps(dir) {
|
|
|
3156
3286
|
return [];
|
|
3157
3287
|
}
|
|
3158
3288
|
}
|
|
3289
|
+
/** Writes of the list by this process: a stamp taken before one never matches one taken after, whatever the clock. */
|
|
3290
|
+
var writes = 0;
|
|
3291
|
+
/**
|
|
3292
|
+
* What changes whenever `apps.json` does, for a reader that keeps what it learned from the list until then: this
|
|
3293
|
+
* process's writes, and the file's inode, size and change times (a one-shot `app serve` writes it from another process).
|
|
3294
|
+
* Cheaper than a read: no parse.
|
|
3295
|
+
*/
|
|
3296
|
+
function servedStamp(dir) {
|
|
3297
|
+
try {
|
|
3298
|
+
const s = statSync(servedFile(dir), { bigint: true });
|
|
3299
|
+
return `${writes} ${s.ino} ${s.size} ${s.mtimeNs} ${s.ctimeNs}`;
|
|
3300
|
+
} catch {
|
|
3301
|
+
return `${writes} none`;
|
|
3302
|
+
}
|
|
3303
|
+
}
|
|
3159
3304
|
function writeServed(dir, apps) {
|
|
3160
3305
|
const file = servedFile(dir);
|
|
3161
3306
|
writeFileSync(file + ".tmp", JSON.stringify(apps, null, 2) + "\n", { mode: 384 });
|
|
3162
3307
|
renameSync(file + ".tmp", file);
|
|
3308
|
+
writes++;
|
|
3163
3309
|
}
|
|
3164
3310
|
/** A served app by its reference or, when only one has it, its name. */
|
|
3165
3311
|
function servedApp(apps, ref) {
|
|
@@ -3247,23 +3393,49 @@ function peerVersion(hub, chat, ref) {
|
|
|
3247
3393
|
function reportAppFrames(hub, node, profileDir) {
|
|
3248
3394
|
const open = /* @__PURE__ */ new Map();
|
|
3249
3395
|
peers.set(hub, open);
|
|
3250
|
-
/**
|
|
3396
|
+
/**
|
|
3397
|
+
* Per chat: chat app id to reference, of the apps served when they were learned there; the list's stamp then
|
|
3398
|
+
* (undefined when an id could not be derived, so the next open tries again); and the version of each served app's
|
|
3399
|
+
* last open since.
|
|
3400
|
+
*/
|
|
3251
3401
|
const known = /* @__PURE__ */ new Map();
|
|
3252
3402
|
let count = 0;
|
|
3253
3403
|
const learn = (chat) => {
|
|
3404
|
+
let stamp = servedStamp(profileDir);
|
|
3254
3405
|
const ids = /* @__PURE__ */ new Map();
|
|
3255
3406
|
for (const { ref } of servedApps(profileDir)) try {
|
|
3256
3407
|
ids.set(node.appId({
|
|
3257
3408
|
linkId: chat,
|
|
3258
3409
|
ref
|
|
3259
3410
|
}).app, ref);
|
|
3260
|
-
} catch {
|
|
3261
|
-
|
|
3262
|
-
|
|
3411
|
+
} catch {
|
|
3412
|
+
stamp = void 0;
|
|
3413
|
+
}
|
|
3414
|
+
const learnt = {
|
|
3415
|
+
ids,
|
|
3416
|
+
stamp,
|
|
3417
|
+
versions: /* @__PURE__ */ new Map()
|
|
3418
|
+
};
|
|
3419
|
+
known.set(chat, learnt);
|
|
3420
|
+
return learnt;
|
|
3421
|
+
};
|
|
3422
|
+
/**
|
|
3423
|
+
* An open learns the served list again only when it changed since (a stat, no read), or names another version of a
|
|
3424
|
+
* served app than its last open did: an app served or unserved since is taken or left from its next open, and a
|
|
3425
|
+
* contact repeating opens (up to 50 a second for each of 16 apps) costs no read of the list nor derivation of ids.
|
|
3426
|
+
*/
|
|
3427
|
+
const current = (chat, frame) => {
|
|
3428
|
+
const learnt = known.get(chat);
|
|
3429
|
+
if (!learnt) return learn(chat);
|
|
3430
|
+
if (!("o" in frame) || frame.o !== "open") return learnt;
|
|
3431
|
+
const was = learnt.versions.get(frame.app);
|
|
3432
|
+
return learnt.stamp === void 0 || learnt.stamp !== servedStamp(profileDir) || was !== void 0 && was !== frame.v ? learn(chat) : learnt;
|
|
3263
3433
|
};
|
|
3264
3434
|
return hub.onAppFrame((chat, frame) => {
|
|
3265
|
-
const
|
|
3435
|
+
const learnt = current(chat, frame);
|
|
3436
|
+
const app = learnt.ids.get(frame.app);
|
|
3266
3437
|
if (!app) return;
|
|
3438
|
+
if ("o" in frame && frame.o === "open") learnt.versions.set(frame.app, frame.v);
|
|
3267
3439
|
const id = `${chat}:${app}:${Date.now()}-${++count}`;
|
|
3268
3440
|
if ("o" in frame) {
|
|
3269
3441
|
if (frame.o === "open") open.set(`${chat} ${app}`, frame.v);
|
|
@@ -3319,6 +3491,7 @@ var APP_CHAT_METHODS = {
|
|
|
3319
3491
|
}));
|
|
3320
3492
|
let card = null;
|
|
3321
3493
|
if (!bool(params, "noCard") && peer === null) {
|
|
3494
|
+
const version = app.version.length <= STATUS_CARD_LIMITS.appVersion ? { version: app.version } : {};
|
|
3322
3495
|
const sent = {
|
|
3323
3496
|
kind: "app",
|
|
3324
3497
|
id: appCardId(app.ref),
|
|
@@ -3326,7 +3499,7 @@ var APP_CHAT_METHODS = {
|
|
|
3326
3499
|
digest: app.digest,
|
|
3327
3500
|
sequence: app.sequence,
|
|
3328
3501
|
title: app.title,
|
|
3329
|
-
version
|
|
3502
|
+
...version,
|
|
3330
3503
|
...app.url !== void 0 && { url: app.url },
|
|
3331
3504
|
opened: true
|
|
3332
3505
|
};
|
|
@@ -3477,7 +3650,32 @@ async function federationsOpen(ctx, ms = 3e4) {
|
|
|
3477
3650
|
const connecting = () => NETWORKS.some((n) => (netView(state(ctx), n)?.fedimint?.federations ?? []).some((f) => f.status === "connecting"));
|
|
3478
3651
|
while (connecting() && Date.now() < until) await new Promise((resolve) => setTimeout(resolve, 250));
|
|
3479
3652
|
}
|
|
3480
|
-
/**
|
|
3653
|
+
/**
|
|
3654
|
+
* An Arkade, Bark, Spark or USDT balance, known only once the wallet is open and read it: until then the view holds 0
|
|
3655
|
+
* (USDT "0", also offline for good), which the app's total shows as "?" (walletTotals). `null` with `status` `locked` or
|
|
3656
|
+
* `reading`, never a 0 a script takes for the balance.
|
|
3657
|
+
*/
|
|
3658
|
+
function readBalance(view) {
|
|
3659
|
+
if (!view) return {
|
|
3660
|
+
balance: null,
|
|
3661
|
+
status: null
|
|
3662
|
+
};
|
|
3663
|
+
if (view.locked) return {
|
|
3664
|
+
balance: null,
|
|
3665
|
+
status: "locked"
|
|
3666
|
+
};
|
|
3667
|
+
return view.read ? {
|
|
3668
|
+
balance: view.balance,
|
|
3669
|
+
status: null
|
|
3670
|
+
} : {
|
|
3671
|
+
balance: null,
|
|
3672
|
+
status: "reading"
|
|
3673
|
+
};
|
|
3674
|
+
}
|
|
3675
|
+
/**
|
|
3676
|
+
* One wallet of the deck with its balance, in its own unit. Never a key, a phrase or a token. A balance not read yet
|
|
3677
|
+
* is `null`, with `status` saying why (`locked`, `reading`, `error`).
|
|
3678
|
+
*/
|
|
3481
3679
|
function walletJson(instance, s) {
|
|
3482
3680
|
const view = netView(s, instance.network);
|
|
3483
3681
|
let balance = null, unit = "sat", address = null, status = null, error = null;
|
|
@@ -3493,16 +3691,16 @@ function walletJson(instance, s) {
|
|
|
3493
3691
|
break;
|
|
3494
3692
|
}
|
|
3495
3693
|
case "arkade":
|
|
3496
|
-
balance = view?.ark
|
|
3694
|
+
({balance, status} = readBalance(view?.ark));
|
|
3497
3695
|
address = view?.ark?.address ?? null;
|
|
3498
3696
|
error = view?.ark?.error ?? null;
|
|
3499
3697
|
break;
|
|
3500
3698
|
case "bark":
|
|
3501
|
-
balance = view?.bark
|
|
3699
|
+
({balance, status} = readBalance(view?.bark));
|
|
3502
3700
|
error = view?.bark?.error ?? null;
|
|
3503
3701
|
break;
|
|
3504
3702
|
case "spark":
|
|
3505
|
-
balance = view?.spark
|
|
3703
|
+
({balance, status} = readBalance(view?.spark));
|
|
3506
3704
|
address = view?.spark?.address ?? null;
|
|
3507
3705
|
error = view?.spark?.error ?? null;
|
|
3508
3706
|
break;
|
|
@@ -3512,12 +3710,16 @@ function walletJson(instance, s) {
|
|
|
3512
3710
|
status = view?.bitcoin?.status ?? null;
|
|
3513
3711
|
error = view?.bitcoin?.error ?? null;
|
|
3514
3712
|
break;
|
|
3515
|
-
case "fedimint":
|
|
3516
|
-
|
|
3517
|
-
|
|
3713
|
+
case "fedimint": {
|
|
3714
|
+
const federations = view?.fedimint?.federations ?? [];
|
|
3715
|
+
const known = federations.every((f) => f.read && f.status === "ready");
|
|
3716
|
+
balance = known ? view?.fedimint?.balance ?? null : null;
|
|
3717
|
+
status = known ? null : federations.some((f) => f.status === "error") ? "error" : "reading";
|
|
3718
|
+
error = view?.fedimint?.error ?? federations.find((f) => f.error)?.error ?? null;
|
|
3518
3719
|
break;
|
|
3720
|
+
}
|
|
3519
3721
|
case "usdt":
|
|
3520
|
-
balance = view?.usdt
|
|
3722
|
+
({balance, status} = readBalance(view?.usdt));
|
|
3521
3723
|
unit = "token-base";
|
|
3522
3724
|
address = view?.usdt?.address ?? null;
|
|
3523
3725
|
error = view?.usdt?.error ?? null;
|
|
@@ -3842,6 +4044,8 @@ var WALLET_METHODS = Object.fromEntries(Object.entries({
|
|
|
3842
4044
|
network: n,
|
|
3843
4045
|
...card ? { card } : {}
|
|
3844
4046
|
});
|
|
4047
|
+
const expected = isInvoice(text) ? num(params, "amount", 0, { min: 1 }) : 0;
|
|
4048
|
+
if (expected && quote.amount !== expected) throw new CliError("refused", `The invoice asks ${quote.amount} sats, not the ${expected} given with --amount`);
|
|
3845
4049
|
const maxFee = params.maxFee === void 0 ? null : num(params, "maxFee", 0);
|
|
3846
4050
|
if (maxFee !== null && quote.feeReserve > maxFee) throw new CliError("refused", `The fee may reach ${quote.feeReserve} sats, more than the ${maxFee} allowed`);
|
|
3847
4051
|
const paid = await node(ctx).walletPayQuote({
|
|
@@ -4008,21 +4212,28 @@ function checkTextSize(text) {
|
|
|
4008
4212
|
}
|
|
4009
4213
|
/**
|
|
4010
4214
|
* The engine's state as `engine getState` prints it without `--show-secret`: the settings' credentials, a group's
|
|
4011
|
-
* entry link (anyone who reads
|
|
4012
|
-
* are `<hidden>`.
|
|
4215
|
+
* entry link and the link of another group kept under its id (anyone who reads one can join), a pending chat's
|
|
4216
|
+
* invite code (whoever reads it can take the chat) and this side's wake-up tokens are `<hidden>`.
|
|
4013
4217
|
*/
|
|
4014
4218
|
function hideStateSecrets(state) {
|
|
4219
|
+
const hideOther = (o) => o && typeof o === "object" && "link" in o ? {
|
|
4220
|
+
...o,
|
|
4221
|
+
link: "<hidden>"
|
|
4222
|
+
} : o;
|
|
4015
4223
|
return {
|
|
4016
4224
|
...state,
|
|
4017
4225
|
settings: redactSettings(state.settings),
|
|
4018
|
-
...state.groups ? { groups: state.groups.map((g) =>
|
|
4226
|
+
...state.groups ? { groups: state.groups.map((g) => ({
|
|
4019
4227
|
...g,
|
|
4020
|
-
entryLink: "<hidden>"
|
|
4021
|
-
|
|
4022
|
-
|
|
4228
|
+
...g.entryLink ? { entryLink: "<hidden>" } : {},
|
|
4229
|
+
...g.others ? { others: g.others.map(hideOther) } : {},
|
|
4230
|
+
...g.wakeTokens ? { wakeTokens: g.wakeTokens.map(() => "<hidden>") } : {}
|
|
4231
|
+
})) } : {},
|
|
4232
|
+
...state.links ? { links: state.links.map((l) => ({
|
|
4023
4233
|
...l,
|
|
4024
|
-
inviteCode: "<hidden>"
|
|
4025
|
-
|
|
4234
|
+
...l.inviteCode ? { inviteCode: "<hidden>" } : {},
|
|
4235
|
+
...l.wakeToken ? { wakeToken: "<hidden>" } : {}
|
|
4236
|
+
})) } : {}
|
|
4026
4237
|
};
|
|
4027
4238
|
}
|
|
4028
4239
|
/** Settings as a bot may read them: storage credentials and other secrets masked unless asked for. */
|
|
@@ -4053,7 +4264,8 @@ var SETTABLE_KINDS = {
|
|
|
4053
4264
|
sendTyping: "boolean",
|
|
4054
4265
|
nick: "string",
|
|
4055
4266
|
autoDownloads: "boolean",
|
|
4056
|
-
serveFiles: "boolean"
|
|
4267
|
+
serveFiles: "boolean",
|
|
4268
|
+
daemonPresence: "boolean"
|
|
4057
4269
|
};
|
|
4058
4270
|
var SETTABLE = SETTABLE_KINDS;
|
|
4059
4271
|
/**
|
|
@@ -4068,7 +4280,8 @@ var SETTING_DEFAULTS = {
|
|
|
4068
4280
|
shareProfile: () => true,
|
|
4069
4281
|
sendTyping: () => true,
|
|
4070
4282
|
autoDownloads: () => true,
|
|
4071
|
-
serveFiles: () => true
|
|
4283
|
+
serveFiles: () => true,
|
|
4284
|
+
daemonPresence: () => false
|
|
4072
4285
|
};
|
|
4073
4286
|
/**
|
|
4074
4287
|
* The settings as `settings get` and `settings set` answer them: each key `settings set` takes, with its value in
|
|
@@ -4205,6 +4418,8 @@ function inviteNotOut(detail) {
|
|
|
4205
4418
|
}
|
|
4206
4419
|
/** V8's words for reading what a value does not have: an `engine.call` given a parameter of the wrong kind. */
|
|
4207
4420
|
var BAD_VALUE = /^Cannot (destructure|read properties of (undefined|null))|is not (a function|iterable)/;
|
|
4421
|
+
/** A one-shot's typing without `--for` (it opens the profile offline, `offlineCall`): said on no live session. */
|
|
4422
|
+
var ONE_SHOT_TYPING = "Typing is said on a live session only, and a one-shot has none: it reached nobody. Keep the profile online (`ghostly daemon --detach`), or give --for to wait until it is live";
|
|
4208
4423
|
var METHODS = {
|
|
4209
4424
|
...WALLET_METHODS,
|
|
4210
4425
|
...FILE_METHODS,
|
|
@@ -4390,7 +4605,7 @@ var METHODS = {
|
|
|
4390
4605
|
},
|
|
4391
4606
|
async "chat.history"(ctx, params) {
|
|
4392
4607
|
const link = chatNotGroup(ctx, params, "group history");
|
|
4393
|
-
return historyOf(ctx, link.id, params, (m) => chatMessageJson(m, link));
|
|
4608
|
+
return historyOf(ctx, link.id, params, async () => (m) => chatMessageJson(m, link));
|
|
4394
4609
|
},
|
|
4395
4610
|
async "chat.send"(ctx, params) {
|
|
4396
4611
|
const link = chatNotGroup(ctx, params, "group send", "[text...]");
|
|
@@ -4446,6 +4661,7 @@ var METHODS = {
|
|
|
4446
4661
|
const link = chatNotGroup(ctx, params, "group edit", "<message> <text...>");
|
|
4447
4662
|
const messageId = str(params, "message", true);
|
|
4448
4663
|
const text = str(params, "text", true);
|
|
4664
|
+
checkTextSize(text);
|
|
4449
4665
|
if (!bool(params, "force")) {
|
|
4450
4666
|
const secret = findSecret(text);
|
|
4451
4667
|
if (secret) throw new CliError("confirm", `The text looks like ${secretWords(secret)}; edit with --force if you mean to`, { kind: secret.kind });
|
|
@@ -4509,7 +4725,8 @@ var METHODS = {
|
|
|
4509
4725
|
...status ? { status } : {},
|
|
4510
4726
|
live: open(state(ctx)),
|
|
4511
4727
|
sendTyping: state(ctx).settings.sendTyping !== false,
|
|
4512
|
-
...until ? { until } : {}
|
|
4728
|
+
...until ? { until } : {},
|
|
4729
|
+
...!kept && ctx.mode === "one-shot" && { note: ONE_SHOT_TYPING }
|
|
4513
4730
|
};
|
|
4514
4731
|
},
|
|
4515
4732
|
/**
|
|
@@ -4627,9 +4844,16 @@ var METHODS = {
|
|
|
4627
4844
|
*/
|
|
4628
4845
|
async "chat.forward"(ctx, params) {
|
|
4629
4846
|
const from = chatOrGroup(ctx, str(params, "chat", true));
|
|
4630
|
-
const messageIds = list(params, "messages");
|
|
4847
|
+
const messageIds = [...new Set(list(params, "messages"))];
|
|
4631
4848
|
if (!messageIds.length) throw new CliError("bad_request", "Name the messages to forward (their ids, from history or an event)");
|
|
4632
|
-
|
|
4849
|
+
if (messageIds.length > 30) throw new CliError("bad_request", `Forward at most 30 messages at once, not ${messageIds.length}`);
|
|
4850
|
+
const to = [];
|
|
4851
|
+
for (const ref of new Set(list(params, "to"))) {
|
|
4852
|
+
const target = chatOrGroup(ctx, ref);
|
|
4853
|
+
if (to.some((t) => t.linkId === target.linkId)) continue;
|
|
4854
|
+
if (to.length === 5) throw new CliError("bad_request", `Forward to at most 5 chats and groups at once`);
|
|
4855
|
+
to.push(target);
|
|
4856
|
+
}
|
|
4633
4857
|
if (!to.length) throw new CliError("bad_request", "Forward to which chat? Name one or more with --to");
|
|
4634
4858
|
const chosen = [];
|
|
4635
4859
|
for (const id of messageIds) {
|
|
@@ -4827,6 +5051,7 @@ var METHODS = {
|
|
|
4827
5051
|
await node(ctx).removeLink({ linkId: link.id });
|
|
4828
5052
|
ctx.calls.forgetChat(link.id);
|
|
4829
5053
|
ctx.groupAuto.forgetChat(link.id);
|
|
5054
|
+
await forgetHold(ctx, link.id);
|
|
4830
5055
|
return { removed: link.id };
|
|
4831
5056
|
},
|
|
4832
5057
|
async "chat.transport"(ctx, params) {
|
|
@@ -4952,7 +5177,10 @@ var METHODS = {
|
|
|
4952
5177
|
},
|
|
4953
5178
|
async "group.history"(ctx, params) {
|
|
4954
5179
|
const group = groupOf(ctx, params, "chat history <chat>");
|
|
4955
|
-
return historyOf(ctx, `group:${group.id}`, params, (
|
|
5180
|
+
return historyOf(ctx, `group:${group.id}`, params, async (page) => {
|
|
5181
|
+
const twins = await groupPayTwinsOf(ctx, group, page);
|
|
5182
|
+
return (m) => groupMessageJson(m, group, twins.get(m.id));
|
|
5183
|
+
});
|
|
4956
5184
|
},
|
|
4957
5185
|
async "group.send"(ctx, params) {
|
|
4958
5186
|
const group = groupOf(ctx, params, "send <chat> [text...]");
|
|
@@ -4960,7 +5188,7 @@ var METHODS = {
|
|
|
4960
5188
|
checkTextSize(text);
|
|
4961
5189
|
if (!bool(params, "force")) {
|
|
4962
5190
|
const secret = findSecret(text);
|
|
4963
|
-
if (secret) throw new CliError("confirm",
|
|
5191
|
+
if (secret) throw new CliError("confirm", `The text looks like ${secretWords(secret)}; send it with --force if you mean to`, { kind: secret.kind });
|
|
4964
5192
|
}
|
|
4965
5193
|
const mentions = mentionsFor(text, list(params, "mentions"), group);
|
|
4966
5194
|
const replyTo = str(params, "reply");
|
|
@@ -4995,7 +5223,8 @@ var METHODS = {
|
|
|
4995
5223
|
...card ? {
|
|
4996
5224
|
buttons: card.id,
|
|
4997
5225
|
card
|
|
4998
|
-
} : {}
|
|
5226
|
+
} : {},
|
|
5227
|
+
...messageId && nobodyElseIn(ctx, group.id) ? { note: "Nobody else is in this group: nobody gets this message, not even someone who joins later" } : {}
|
|
4999
5228
|
};
|
|
5000
5229
|
},
|
|
5001
5230
|
/**
|
|
@@ -5007,6 +5236,7 @@ var METHODS = {
|
|
|
5007
5236
|
const group = groupOf(ctx, params, "edit <chat> <message> <text...>");
|
|
5008
5237
|
const messageId = str(params, "message", true);
|
|
5009
5238
|
const text = str(params, "text", true);
|
|
5239
|
+
checkTextSize(text);
|
|
5010
5240
|
if (!bool(params, "force")) {
|
|
5011
5241
|
const secret = findSecret(text);
|
|
5012
5242
|
if (secret) throw new CliError("confirm", `The text looks like ${secretWords(secret)}; edit with --force if you mean to`, { kind: secret.kind });
|
|
@@ -5111,7 +5341,8 @@ var METHODS = {
|
|
|
5111
5341
|
...status ? { status } : {},
|
|
5112
5342
|
reached: reached(state(ctx)),
|
|
5113
5343
|
sendTyping: state(ctx).settings.sendTyping !== false,
|
|
5114
|
-
...until ? { until } : {}
|
|
5344
|
+
...until ? { until } : {},
|
|
5345
|
+
...!kept && ctx.mode === "one-shot" && { note: ONE_SHOT_TYPING }
|
|
5115
5346
|
};
|
|
5116
5347
|
},
|
|
5117
5348
|
async "group.leave"(ctx, params) {
|
|
@@ -5241,7 +5472,8 @@ var ENGINE_SENDS = /* @__PURE__ */ new Set([
|
|
|
5241
5472
|
"createGroup",
|
|
5242
5473
|
"renameGroup",
|
|
5243
5474
|
"updateSettings",
|
|
5244
|
-
"sendFile"
|
|
5475
|
+
"sendFile",
|
|
5476
|
+
"setOwnStatus"
|
|
5245
5477
|
]);
|
|
5246
5478
|
async function guardEngineSend(ctx, method, args) {
|
|
5247
5479
|
const of = (value, key) => value && typeof value === "object" ? value[key] : void 0;
|
|
@@ -5253,7 +5485,8 @@ async function guardEngineSend(ctx, method, args) {
|
|
|
5253
5485
|
args.comment,
|
|
5254
5486
|
args.name,
|
|
5255
5487
|
of(args.settings, "nick"),
|
|
5256
|
-
of(args.file, "name")
|
|
5488
|
+
of(args.file, "name"),
|
|
5489
|
+
of(args.status, "text")
|
|
5257
5490
|
];
|
|
5258
5491
|
if (method === "forwardMessages") {
|
|
5259
5492
|
const ids = Array.isArray(args.messageIds) ? args.messageIds.filter((id) => typeof id === "string") : [];
|
|
@@ -5394,7 +5627,10 @@ async function connectWithin(ctx, link, ms) {
|
|
|
5394
5627
|
try {
|
|
5395
5628
|
if (await Promise.race([dial, late]) !== "late") return;
|
|
5396
5629
|
} catch (error) {
|
|
5397
|
-
if (asCliError(error).code !== "timeout")
|
|
5630
|
+
if (asCliError(error).code !== "timeout") {
|
|
5631
|
+
dhtOnly(findChat(state(ctx).links, link.id));
|
|
5632
|
+
throw error;
|
|
5633
|
+
}
|
|
5398
5634
|
} finally {
|
|
5399
5635
|
clearTimeout(timer);
|
|
5400
5636
|
}
|
|
@@ -5420,11 +5656,7 @@ async function saveMark(ctx, params, remove) {
|
|
|
5420
5656
|
saved: !remove
|
|
5421
5657
|
};
|
|
5422
5658
|
}
|
|
5423
|
-
|
|
5424
|
-
* A page of a chat's or a group's history: only that page is read from the store (the newest, those before `before`,
|
|
5425
|
-
* or the oldest after `after`), so a long chat's is as quick as a short one's.
|
|
5426
|
-
*/
|
|
5427
|
-
async function historyOf(ctx, chat, params, json = messageJson) {
|
|
5659
|
+
async function historyOf(ctx, chat, params, linesOf = async () => messageJson) {
|
|
5428
5660
|
const limit = num(params, "limit", 50, {
|
|
5429
5661
|
min: 1,
|
|
5430
5662
|
max: 1e4,
|
|
@@ -5451,11 +5683,28 @@ async function historyOf(ctx, chat, params, json = messageJson) {
|
|
|
5451
5683
|
});
|
|
5452
5684
|
});
|
|
5453
5685
|
const originals = await originalsNow(ctx, chat, page.messages);
|
|
5686
|
+
const json = await linesOf(page.messages);
|
|
5454
5687
|
return {
|
|
5455
5688
|
messages: page.messages.map((m) => quoteChecked(json(m), m, originals)),
|
|
5456
5689
|
more: page.more
|
|
5457
5690
|
};
|
|
5458
5691
|
}
|
|
5692
|
+
/**
|
|
5693
|
+
* The payment lines of a group's history page that are twins of a payment note's line (`groupPayTwins`), as the app
|
|
5694
|
+
* tells them. A note whose line is not on the page is read as its one row, as the originals of replies are.
|
|
5695
|
+
*/
|
|
5696
|
+
async function groupPayTwinsOf(ctx, group, page) {
|
|
5697
|
+
const rows = page.filter((m) => m.paymentId && !m.groupPay);
|
|
5698
|
+
if (!rows.length) return /* @__PURE__ */ new Map();
|
|
5699
|
+
const payments = state(ctx).payments ?? {};
|
|
5700
|
+
const notes = new Map(page.flatMap((m) => m.groupPay ? [[m.groupPay.id, m.groupPay]] : []));
|
|
5701
|
+
for (const id of new Set(rows.map((m) => groupPayNoteId(m.paymentId, payments[m.paymentId])))) {
|
|
5702
|
+
if (notes.has(id)) continue;
|
|
5703
|
+
const note = (await node(ctx).getMessage(`group:${group.id}`, groupPayLineId(id)))?.groupPay;
|
|
5704
|
+
if (note) notes.set(note.id, note);
|
|
5705
|
+
}
|
|
5706
|
+
return groupPayTwins(rows, notes, payments, group);
|
|
5707
|
+
}
|
|
5459
5708
|
/** Past this many originals outside a page, its history is read once instead of row by row. */
|
|
5460
5709
|
var ORIGINAL_READS = 32;
|
|
5461
5710
|
/**
|
|
@@ -5509,6 +5758,6 @@ async function callApi(ctx, method, params = {}) {
|
|
|
5509
5758
|
return run(ctx, await withStoredIds(ctx, params));
|
|
5510
5759
|
}
|
|
5511
5760
|
//#endregion
|
|
5512
|
-
export {
|
|
5761
|
+
export { groupPayTwins as _, hideStateSecrets as a, settingsInEffect as c, servedApps as d, nodeLocalFetch as f, groupMessageJson as g, groupJson as h, groupSendRefused as i, paymentJson as l, chatMessageJson as m, SETTABLE as n, mentionsFor as o, chatJson as p, callApi as r, redactSettings as s, API_METHODS as t, reportAppFrames as u, resumeHolds as v, flushCardUpdates as y };
|
|
5513
5762
|
|
|
5514
|
-
//# sourceMappingURL=api-
|
|
5763
|
+
//# sourceMappingURL=api-BM3PsXbB.js.map
|