@ghostlytools/cli 1.8.0 → 1.8.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 +4 -4
- package/dist/assets/{api-I_KbuXHa.js → api-BpQC8dAw.js} +68 -33
- package/dist/assets/api-BpQC8dAw.js.map +1 -0
- package/dist/assets/{api-Dj1yn0px.js → api-CttDF-S5.js} +2 -2
- package/dist/assets/{apiKit-C-_PWZvy.js → apiKit-CSMeHKgo.js} +2 -2
- package/dist/assets/{apiKit-C-_PWZvy.js.map → apiKit-CSMeHKgo.js.map} +1 -1
- package/dist/assets/{apps-DKIe8VjF.js → apps-DqTyZ40T.js} +2 -2
- package/dist/assets/{apps-DKIe8VjF.js.map → apps-DqTyZ40T.js.map} +1 -1
- package/dist/assets/{apps-DbEfL_3b.js → apps-DzFMdVt6.js} +1 -1
- package/dist/assets/{arkade-k1bdSm70.js → arkade-Cu3TbPxC.js} +2 -2
- package/dist/assets/{arkade-k1bdSm70.js.map → arkade-Cu3TbPxC.js.map} +1 -1
- package/dist/assets/{backup-Cdd6-HNu.js → backup-CLZOORFC.js} +1 -1
- package/dist/assets/{backup-beKfbfNk.js → backup-CyTZhu28.js} +4 -4
- package/dist/assets/{backup-beKfbfNk.js.map → backup-CyTZhu28.js.map} +1 -1
- package/dist/assets/{buttons-ClI13rdv.js → buttons-Bd9fR31r.js} +173 -20
- package/dist/assets/buttons-Bd9fR31r.js.map +1 -0
- package/dist/assets/buttons-c4CJnL6i.js +2 -0
- package/dist/assets/{envelope-B88yiCQj.js → envelope-CGfUsR1m.js} +2 -2
- package/dist/assets/{envelope-B88yiCQj.js.map → envelope-CGfUsR1m.js.map} +1 -1
- package/dist/assets/fixedHosts-BiukTsd9.js +24 -0
- package/dist/assets/fixedHosts-BiukTsd9.js.map +1 -0
- package/dist/assets/{ghostly_iroh_web-CO0onry8.js → ghostly_iroh_web-BzAXJUYH.js} +10 -10
- package/dist/assets/{ghostly_iroh_web-CO0onry8.js.map → ghostly_iroh_web-BzAXJUYH.js.map} +1 -1
- package/dist/assets/ghostly_iroh_web_bg.wasm +0 -0
- package/dist/assets/{groupFiles-DjQc5XXv.js → groupFiles-CeF9nPv9.js} +631 -12
- package/dist/assets/groupFiles-CeF9nPv9.js.map +1 -0
- package/dist/assets/{host-CNWGB3-j.js → host-CKAehWP6.js} +30 -18
- package/dist/assets/host-CKAehWP6.js.map +1 -0
- package/dist/assets/hyperdhtRelay-1wzya_0L.js +25 -0
- package/dist/assets/hyperdhtRelay-1wzya_0L.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-g7eXzf5h.js → hyperdhtRelay-B8Pdykhg.js} +15 -3
- package/dist/assets/hyperdhtRelay-B8Pdykhg.js.map +1 -0
- package/dist/assets/{irohWeb-Bx8dI4be.js → irohWeb-D6tAPHZa.js} +11 -7
- package/dist/assets/{irohWeb-Bx8dI4be.js.map → irohWeb-D6tAPHZa.js.map} +1 -1
- package/dist/assets/{main-BRxhBctJ.js → main-BDY-pfpz.js} +17 -17
- package/dist/assets/{main-BRxhBctJ.js.map → main-BDY-pfpz.js.map} +1 -1
- package/dist/assets/{mainline-CwuS6ngj.js → mainline-3ueXpFQL.js} +2 -2
- package/dist/assets/{mainline-CwuS6ngj.js.map → mainline-3ueXpFQL.js.map} +1 -1
- package/dist/assets/{networkReason-CIAMieQm.js → networkReason-DhJYOomu.js} +2 -2
- package/dist/assets/{networkReason-CIAMieQm.js.map → networkReason-DhJYOomu.js.map} +1 -1
- package/dist/assets/{nwc-C9JLJJkL.js → nwc-B1Quqda-.js} +3 -3
- package/dist/assets/{nwc-C9JLJJkL.js.map → nwc-B1Quqda-.js.map} +1 -1
- package/dist/assets/{nwcProvider-pFMrsUJh.js → nwcProvider-DUB6xO-b.js} +2 -2
- package/dist/assets/{nwcProvider-pFMrsUJh.js.map → nwcProvider-DUB6xO-b.js.map} +1 -1
- package/dist/assets/ownDid-BfqHJdA6.js +281 -0
- package/dist/assets/ownDid-BfqHJdA6.js.map +1 -0
- package/dist/assets/{registry-DY2ixQfU.js → registry-CZTmtSws.js} +1 -1
- package/dist/assets/{registry-Cks7FA_o.js → registry-DwlTNQjr.js} +5 -246
- package/dist/assets/registry-DwlTNQjr.js.map +1 -0
- package/dist/assets/{resolve-C4Y2HPqQ.js → resolve-BVwhiYjj.js} +3 -280
- package/dist/assets/resolve-BVwhiYjj.js.map +1 -0
- package/dist/assets/{server-D9RAmGdm.js → server-Br3XPwFG.js} +365 -107
- package/dist/assets/server-Br3XPwFG.js.map +1 -0
- package/dist/assets/{src-1RU4TilT.js → src-C4sOH4zH.js} +233 -106
- package/dist/assets/src-C4sOH4zH.js.map +1 -0
- package/dist/assets/sshForges-CQQomStK.js +253 -0
- package/dist/assets/sshForges-CQQomStK.js.map +1 -0
- package/dist/assets/{translate-od5GbpvR.js → translate-C2aNyUkR.js} +11 -5
- package/dist/assets/translate-C2aNyUkR.js.map +1 -0
- package/dist/assets/{usdt-DldXV0MR.js → usdt-CMwatDnQ.js} +3 -3
- package/dist/assets/{usdt-DldXV0MR.js.map → usdt-CMwatDnQ.js.map} +1 -1
- package/dist/assets/{words-BS2qq_vV.js → words-CqN2KG1r.js} +2 -2
- package/dist/assets/{words-BS2qq_vV.js.map → words-CqN2KG1r.js.map} +1 -1
- package/dist/ghostly.mjs +1 -1
- package/package.json +1 -1
- package/dist/assets/api-I_KbuXHa.js.map +0 -1
- package/dist/assets/buttons-BO1_7V4L.js +0 -2
- package/dist/assets/buttons-ClI13rdv.js.map +0 -1
- package/dist/assets/groupFiles-DjQc5XXv.js.map +0 -1
- package/dist/assets/host-CNWGB3-j.js.map +0 -1
- package/dist/assets/hyperdhtRelay-BT_wRxab.js +0 -21
- package/dist/assets/hyperdhtRelay-BT_wRxab.js.map +0 -1
- package/dist/assets/hyperdhtRelay-g7eXzf5h.js.map +0 -1
- package/dist/assets/registry-Cks7FA_o.js.map +0 -1
- package/dist/assets/resolve-C4Y2HPqQ.js.map +0 -1
- package/dist/assets/server-D9RAmGdm.js.map +0 -1
- package/dist/assets/src-1RU4TilT.js.map +0 -1
- package/dist/assets/translate-od5GbpvR.js.map +0 -1
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { n as traceJoin } from "./joinTrace-CjRDFy85.js";
|
|
2
|
-
import { $
|
|
2
|
+
import { $i as validExternalKey, $l as turnStatedVerifier, $r as wakeRequest, $s as verifySetUpdate, $t as SEPOLIA_TEST_USDT, A as knockIdentity, Aa as parseLinkPreview, Ac as mergeContactKnocks, Al as deviceEchoFrame, An as fedimintRequestPayload, Ao as ratchetSessionOf, Ar as FILE_LIMITS, As as handoffManifestFrames, Ba as reactionIsNewer, Bc as appDigest, Bl as TURN_SETTLE_MS, Bn as pairedMessageFrame, Bo as formatLocalTarget, Bs as readHandoffDone, C as communityHasFrame, Ca as EDIT_RATE_WINDOW_MS, Cc as REQUEST_LIFETIME_MS, Cl as encodeInviteCode, Co as rosterAdmin, Cr as pickHubs, Cs as handoffCancelFrame, Cu as publicKeyFromZ32, D as decodeGroupEntryLink, Da as dhtEditId, Dc as knockSlotRecords, Dl as DEVICES_CAPABILITY, Dn as decodeBolt11, Do as RATCHET_CAPABILITY, Dr as readLobby, Ds as handoffDigest, Du as sanitizeDisplayText, Ea as RateWindow, Ec as knockSlotOf, Eo as edgeParams, Er as readBeaconHead, Es as handoffDataFrame, Eu as sanitizeAvatar, F as GroupWakeLimiter, Fa as REACTION_LIMITS, Fc as seenEntry, Fi as DHT_TEXT_CAPABILITY, Fl as newDeviceSetSecret, Fn as GhostLink, Fo as PRESENCE_WINDOW, Fs as handoffStreamKey, Fu as utf8Encode, Ga as readReply, Gc as pacer, Gl as firstDeviceSetSecret, Gn as GROUP_FILE_LIMITS, Go as encodeControl, Gr as pinNumberHolds, Gs as readHandoffVerified, Gt as encodeDidDhtDeactivated, H as GroupSession, Ha as validReactionNumber, Hl as turnPutSummary, Hn as engineError, Ho as webLocalFetch, Hr as mayPin, Hs as readHandoffHello, I as groupWakeFrame, Ia as ReactionWindow, Ic as APP_BUNDLE_LIMITS, Ii as capsDescriptors, Il as seedSigner, In as INVITE_TAKEN, Io as RELAY_POLL_INTERVALS, Is as handoffVersions, J as parseCommunityEdit, Jc as sha256Paced, Ji as receivedIdentityStatus, Jl as signTurnPacket, Jr as WakeLimiter, Jt as signDidDhtPacket, K as GROUP_EDIT_TEXT_BYTES, Ka as replySnippet, Kl as nextTurnPosition, Kr as readPin, Ks as sealHandoffPiece, Kt as encodeDidDhtPacket, L as groupWakes, La as nextReactionNumber, Lc as APP_BUNDLE_MAGIC, Li as dialDescriptors, Ll as webCryptoSigner, Ln as LIVENESS_PING_MS, Lo as WATCH_PEER_MS, Lr as TypingSender, Ls as newHandoffId, M as mergeKnocks, Ma as readForwarded, Mc as readKnockSlot, Ml as deviceKeyZ32, Mn as isFederationId, Mr as sentWhole, Ms as handoffPakeFrame, Mu as toBase64Url, N as readKnocks, Na as COMMUNITY_REACTION_FRAME, Nc as readLinkRecord, Nl as deviceLinkPairing, Nn as parseCashuRequestPayload, No as DHT_POLL_INTERVALS, Nr as transferEnded, Ns as handoffReleaseFrame, Nu as toZ32, O as encodeGroupEntryLink, Oc as linkRecords, Ol as ENROLL_CAPABILITY, On as ENDPOINT, Oo as RatchetBox, Or as shouldBeHub, Os as handoffEphemeral, Ou as bytesEqual, Pa as GROUP_REACTION_FRAME, Pc as requestRecords, Pi as CapsExchange, Pl as devicePingFrame, Pn as parseFedimintRequestPayload, Pr as transferStalled, Ps as handoffRetryAfter, Pu as utf8Decode, Qc as appRef, Qi as emptyProofLedger, Ql as turnName, Qn as readGroupFileMeta, Qo as contactRtcConfig, Qr as relayRequest, Qs as signTombstone, Qt as PaymentPreflightError, R as parseGroupWakeFrame, Ra as queueReaction, Rc as APP_ICON_PATH, Rn as PAIRED_FRAME_TOO_LARGE, Ro as presenceSeenAt, Rs as readHandoffAck, S as GROUP_READ_NOTE_COMMUNITY, Sa as EDIT_BUFFER_MS, Sc as ContactRequestError, Sl as decodeInviteCode, So as parseGroupCommit, Sr as newerHead, Ss as handoffBusyFrame, Su as identityFromSeedB64, T as encodeCommunityLink, Ta as REMOVED_TEXT, Tc as knockSlotIdentity, Tl as inviteOwnership, To as verifyCommitSignature, Tr as readBeacon, Ts as handoffContextProof, U as frameBytes, Ua as wireReaction, Ul as TURN_LAST_SEQUENCE, Un as engineText, Uo as LIMITS, Ur as nextPinNumber, Us as readHandoffPake, Ut as didDhtDocument, V as GROUP_READ_NOTE, Va as readReaction, Vc as appViewOf, Vl as classifyTurnRead, Vn as EngineError, Vo as parseLocalTarget, Vr as PIN_LIMITS, Vs as readHandoffHave, Wa as pairedReplyAuthor, Wc as isAppUrl, Wi as emptyIdentityLedger, Wl as TURN_MAX, Wn as parseEngineError, Wo as decodeControl, Wr as pinIsNewer, Ws as readHandoffTurnFrame, Wt as didDhtFromPublicKey, X as groupName, Xc as APP_STATEMENT_LIMITS, Xi as lastSharedWithMe, Xl as turnInstance, Xn as groupFileFallback, Xr as newWakeToken, Xs as setAckFrame, Xt as EVM_TEST_CHAINS, Y as mentionsMember, Yl as signTurnRelease, Yr as deviceWakeRequest, Ys as readSetUpdate, Yt as ETHEREUM_USDT, Zc as appFingerprint, Zi as PeerProofs, Zl as turnKeys, Zr as parseWakeFrame, Zs as setUpdateFrame, Zt as ONCHAIN_PROVIDER, _ as groupTypingEpoch, _a as fileMessageText, _c as newInbox, _i as isHoldUrl, _l as createDeviceInvite, _o as GROUP_ADMIN_OFF_ERROR, _r as freshHubs, _s as NO_ATTEMPTS, _t as normalizeAtprotoHandle, a as appRevocationFor, aa as DHT_MESSAGE_TTL, ac as enrollCancelReason, ai as chatAppId, an as assertTokenUnits, as as serviceIdFromName, b as COMMUNITY_LIMITS, bc as takeRequest, bl as OwnInviteError, bo as MEMBER_KEY, br as mergeBeacon, bs as handoffAttemptFailed, bu as createIdentity, c as checkAppBeforeRun, ca as dhtFileId, cc as enrollGrantFrame, ci as BUTTONS_CAPABILITY, cn as validatePaymentTarget, co as checkStatusCard, cr as readGroupSignal, cs as HANDOFF_DONE, cu as normalizeRelayUrl, da as sanitizeMime, dc as readEnrollGrant, di as UPGRADE_CAPABILITY, dl as canonicalJson, dn as SPARK_PROVIDER, do as statusCardText, dr as meshHubs, ds as HANDOFF_OFFER, du as budgetRetryMs, ea as TRANSPORTS, ei as checkPushEndpoint, el as isAppHash, es as parseCallSignal, eu as turnVerifierMark, fc as readEnrollHello, fi as HOLD_CAPABILITY, fn as sparkAddressKind, fo as arrivalKey, fr as pickMeshHubs, fs as HANDOFF_PAKE, fu as isDiscoveryBudgetError, g as GroupTypingBoard, gc as inboxRecord, gi as HoldRefusedError, gl as readContactLink, gn as isPubkyKey, go as shownTime, gr as doorHubs, gs as HANDOFF_VERIFIED, gt as isAtprotoDid, gu as createRelayPayload, hc as endedRequests, hi as HoldKeys, hl as encodeContactLink, ho as receivedTimestamp, hr as beaconRecords, hs as HANDOFF_TIMINGS, i as addedAppPermissions, ic as enrollCancelFrame, in as arkAddressPrefix, is as LEGACY_SERVICES, iu as RelayTransport, j as knockRecords, ja as forwardedAgain, jc as openRequest, jl as deviceEchoNonce, jn as findEndpoint, jo as DirectPathWatch, js as handoffOfferFrame, ju as randomBytes, k as entryParams, kc as makeStampPaced, kl as HANDOFF_CAPABILITY, kn as cashuRequestPayload, ko as emptyRatchetState, kr as ChatFiles, ks as handoffHelloFrame, ku as fromBase64Url, l as planAppUpdate, la as formatFileSize, lc as enrollHelloFrame, li as EDIT_CAPABILITY, ll as parseImageMeta, ln as walletNetworkOf, lo as sameButtonText, lr as MESH_HUBS, ls as HANDOFF_HAVE, mc as clearMissed, mi as HOLD_LIMITS, ml as createContactLink, mn as isBitcoinAddress, mo as heardTime, mr as beaconKeys, ms as HANDOFF_REQUEST, mu as PacketTooLargeError, n as readX401SdJwtVc, ni as APP_RANGE_LIMITS, nl as isAppRef, nn as USDT_PUBLIC_RPC, nr as CarriedTransport, ns as emptyLinkRecords, o as appStoreDecision, oa as peekDhtMailbox, oc as enrollDigits, oi as isAppVersion, on as assertWholeSats, os as HANDOFF_ACK, p as readAppStoreSteps, pc as verifyEnrollProof, pi as HOLD_DATED_BACK_MS, pl as readCanonicalJson, pn as sparkInvoiceDetails, po as claimedTime, pr as COMMUNITY_TOPOLOGY, ps as HANDOFF_PIECE_BYTES, pu as withRequestOptions, q as carryMentions, qa as BUTTON_ID, qc as readAppBundleAsync, ql as readTurnPacket, qo as RTC_CONFIG, qr as WAKE_CALL_INTERVAL_MS, r as sameX401HolderJwk, ri as isServeId, rl as readAppRevocation, rn as WALLET_NETWORKS, rs as HTTP_SERVICE_PROTO, s as appUpdateDecision, sa as DHT_FILE_CAPABILITY, sc as enrollDoneFrame, si as APPS_CAPABILITY, sn as formatPaymentAmount, sr as groupSignalFrame, ss as HANDOFF_CANCEL, su as currentRelays, t as newX401HolderKey, ta as automaticTransport, ti as vapidKeysMatch, tl as isAppKey, tn as TEST_USDT_FAUCET_AMOUNT, to as STATUS_CARD_LIMITS, tu as DEFAULT_RELAYS, u as APP_STORE_LIMITS, ua as sanitizeFileName, uc as enrollProofFrame, ui as STATUS_CARD_CAPABILITY, un as SPARK_NETWORKS, ur as mayBeHub, us as HANDOFF_HELLO, uu as traceLink, v as openGroupTyping, va as parseVoiceMeta, vc as planKnocks, vi as newMailbox, vl as deviceInviteJoinerParams, vo as GROUP_MEMBER_CAP, vr as lobbyKeys, vs as filePartName, w as decodeCommunityLink, wa as MAX_REMOVAL_NUMBER, wc as contactDay, wl as inviteLink, wo as rosterHas, wr as rankHubs, ws as handoffContext, wu as verify, x as CommunitySession, xa as parseVideoMeta, xc as turnOff, xl as createChatInvite, xo as commitHash, xr as mergeLobby, xs as handoffAttemptSucceeded, xu as identityFromSeed, y as sealGroupTyping, yc as settleRequest, yi as readManifest, yl as readDeviceInvite, yr as lobbyRecords, ys as handoffAttemptAllowed, z as GROUP_LIMITS, za as reactionEmoji, zl as TURN_RAISE_READ_TIMEOUT_MS, zn as pairedMessageFits, zo as GhostlyHttpError, zr as typingActivity, zs as readHandoffCancel } from "./src-C4sOH4zH.js";
|
|
3
|
+
import { $ as ModeChanged, A as IdentityProofs, B as INVOICE_PACE, C as FileAppender, D as streamStored, E as storedSize, F as LightningCards, G as cashuMint, H as ProviderSources, I as cardsKey, J as breezDatabasesFor, K as breezDatabase, L as isRecoveryPhrase, M as sealSecret, N as whenDataKeyDropped, P as CASHU_CARD, Q as relayOnlyProblem, R as normalizePhrase, S as WALLET_TYPES, T as removeStored, U as sourceKey, V as nextInvoiceAsk, W as CASHU_MINT_SOURCE, X as iceServerProblem, Y as dropBreezDatabase, Z as iceServerSetting, _ as crossNetwork, a as storedGroupFiles, at as requireTurn, b as walletInstances, c as receivedPairedReply, ct as NO_PICTURE_METADATA, d as paymentAlias, dt as stripPictureMetadata, et as ModeGate, f as paymentWireId, g as createTiming, h as createFailure, i as groupOfFile, it as refuseAway, j as openSecret, l as replyRef, lt as PICTURE_METADATA_LIMITS, m as assertConfirmedReal, n as groupFileId, nt as networkLabel, o as groupReply, ot as setAwayWallets, p as WALLET_NAMES, q as breezDatabaseInUse, r as groupFileText, rt as awayFrom, s as pairedWireReply, st as setSingleWriterGate, t as GroupFileDesk, tt as WrongNetworkError, u as replyTo, ut as isStrippedPicture, v as paymentNetwork, w as readStored$1, y as paymentNetworksOf, z as lightningPaying } from "./groupFiles-CeF9nPv9.js";
|
|
3
4
|
import { i as SourceUnreachableError, n as PROVIDER_PLATFORMS, o as isNothingSpentError, r as SourceConfigError, t as NothingSpentError, u as redact } from "./types-C4_KafL_.js";
|
|
4
5
|
import { t as bitcoindRpc } from "./bitcoindProvider-DGw3xBSa.js";
|
|
5
|
-
import { t as nwc } from "./nwcProvider-
|
|
6
|
+
import { t as nwc } from "./nwcProvider-DUB6xO-b.js";
|
|
6
7
|
import { a as clearProfileStores, c as deleteDatabase, d as newestWalletTx, f as openDb, g as wrap, h as transact, i as STORES$1, l as errorLine, m as store, n as APP_STORAGE_SCOPE_INDEX, o as committed, p as profileOpenFailure, r as CARD_INDEX, s as databaseName, t as APP_STORAGE_CHAT_INDEX, u as fileStore } from "./idb-BkOJES5_.js";
|
|
7
|
-
import { a as sealSeed, i as newDeviceKey, o as unsealSeed, r as intentRepository } from "./networkReason-
|
|
8
|
-
import {
|
|
9
|
-
import { i as fedimintDatabase, n as createIrohWebEndpoint, o as loadFedimintSdk, r as irohRelayProblem, t as DEFAULT_IROH_RELAYS } from "./irohWeb-Bx8dI4be.js";
|
|
8
|
+
import { a as sealSeed, i as newDeviceKey, o as unsealSeed, r as intentRepository } from "./networkReason-DhJYOomu.js";
|
|
9
|
+
import { i as fedimintDatabase, n as createIrohWebEndpoint, o as loadFedimintSdk, r as irohRelayProblem, t as DEFAULT_IROH_RELAYS } from "./irohWeb-D6tAPHZa.js";
|
|
10
10
|
import { c as isTestMint, d as mintUrlSpelling, f as paysItsOwnInvoices, l as isWorthlessMint, n as DEFAULT_MINTS, o as fakesLightning, r as TEST_MINT, t as BITCOIN_INVOICE_ON_TESTNET, u as mintNetwork } from "./mints-j5XAOk4f.js";
|
|
11
|
-
import {
|
|
12
|
-
import { n as MAX_BACKUP_BYTES, t as BACKUP_MEDIA_TYPE } from "./envelope-
|
|
11
|
+
import { a as registeredLightningProviders, c as boundedIdentityFetch, d as testSwitch, n as setOwnDidSource, o as registeredOnchainProviders, r as onAdaptersChanged, s as reserveAdapterIds, u as testBuild } from "./ownDid-BfqHJdA6.js";
|
|
12
|
+
import { n as MAX_BACKUP_BYTES, t as BACKUP_MEDIA_TYPE } from "./envelope-CGfUsR1m.js";
|
|
13
|
+
import { d as chosenResolver, r as resolveAtprotoDid, t as assertPublicServer } from "./resolve-BVwhiYjj.js";
|
|
13
14
|
import { c as fileSpace, f as FILE_BYTES_STEP, o as fileBytes, r as blobDigest, s as fileBytesOf, u as removeFileBytes } from "./fileBytes-DNgrRL0R.js";
|
|
14
|
-
import { t as hyperdhtRelayProblem } from "./hyperdhtRelay-
|
|
15
|
+
import { t as hyperdhtRelayProblem } from "./hyperdhtRelay-1wzya_0L.js";
|
|
15
16
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
16
17
|
import { hkdf } from "@noble/hashes/hkdf.js";
|
|
17
18
|
import { base64, base64url, base64urlnopad, bech32, hex } from "@scure/base";
|
|
@@ -198,7 +199,7 @@ function viewNews(before, after) {
|
|
|
198
199
|
//#endregion
|
|
199
200
|
//#region ../browser/src/engine/paymentAdapters/usdtWallet.ts
|
|
200
201
|
/** The Ethereum libraries, a large part of the app: loaded once a USDT wallet is made, opened or restored, not with the engine. */
|
|
201
|
-
var loadUsdt = () => import("./usdt-
|
|
202
|
+
var loadUsdt = () => import("./usdt-CMwatDnQ.js");
|
|
202
203
|
/** Every new profile starts with this wallet: an address to receive on, nothing to set up. */
|
|
203
204
|
var DEFAULT_USDT = {
|
|
204
205
|
network: "ethereum",
|
|
@@ -647,7 +648,7 @@ async function restoreArkDatabase(walletId, snapshot) {
|
|
|
647
648
|
//#endregion
|
|
648
649
|
//#region ../browser/src/engine/paymentAdapters/arkWallet.ts
|
|
649
650
|
/** The Ark SDK, a large part of the app: loaded once an Ark wallet is made, opened or restored, not with the engine. */
|
|
650
|
-
var loadArkade = () => import("./arkade-
|
|
651
|
+
var loadArkade = () => import("./arkade-Cu3TbPxC.js");
|
|
651
652
|
/** How long a Testnet wallet about to make way for another waits for its server to say what it holds. */
|
|
652
653
|
var RETIRE_READ_MS = 1e4;
|
|
653
654
|
/** Every new profile starts with this wallet: nothing to set up before receiving. */
|
|
@@ -9138,6 +9139,23 @@ var PUBKY_NEXUS = "https://nexus.pubky.app";
|
|
|
9138
9139
|
var BLUESKY_APPVIEW = "https://public.api.bsky.app";
|
|
9139
9140
|
/** Bluesky's avatar CDN: the AppView names avatars there. It sends no CORS header, so the picture is read from the account's own server. */
|
|
9140
9141
|
var BLUESKY_CDN_AVATAR = /^https:\/\/cdn\.bsky\.app\/img\/avatar\/plain\/(did:[a-z]+:[A-Za-z0-9._:%-]+)\/(b[a-z2-7]{20,100})(@(jpeg|png))?$/;
|
|
9142
|
+
/** A request the readers did not make: Hide my IP from contacts is on and the host is one the contact chose. */
|
|
9143
|
+
var HostNotContacted = class extends Error {};
|
|
9144
|
+
/**
|
|
9145
|
+
* `fetch`, limited to the hosts this app names (Bluesky's AppView, the Pubky index, and the identity checks' fixed
|
|
9146
|
+
* hosts): for a contact's identity while "Hide my IP from contacts" is on, so a server the contact chose (their AT
|
|
9147
|
+
* Protocol server, a did:web's web server) never sees this device's IP address. Anything else is refused unasked.
|
|
9148
|
+
*/
|
|
9149
|
+
function fixedHostsFetch(fetch) {
|
|
9150
|
+
return async (url, options) => {
|
|
9151
|
+
const { fixedIdentityHosts } = await import("./fixedHosts-BiukTsd9.js");
|
|
9152
|
+
const host = hostOf$1(url);
|
|
9153
|
+
if (!fixedIdentityHosts().has(host) && host !== hostOf$1("https://public.api.bsky.app") && host !== hostOf$1("https://nexus.pubky.app")) throw new HostNotContacted(`Hide my IP from contacts is on: ${host}, a server your contact chose, was not contacted`);
|
|
9154
|
+
return fetch(url, options);
|
|
9155
|
+
};
|
|
9156
|
+
}
|
|
9157
|
+
/** Why a picture was not read: the refusal above says so; anything else is `fallback`. */
|
|
9158
|
+
var pictureMiss = (e, fallback) => e instanceof HostNotContacted ? e.message : fallback;
|
|
9141
9159
|
var count$1 = (value) => Number.isSafeInteger(value) && value >= 0 && value <= MAX_COUNT ? value : void 0;
|
|
9142
9160
|
var hostOf$1 = (url) => new URL(url).host;
|
|
9143
9161
|
var pictureUnreachable = (host) => ({ miss: `${host} could not be reached, or the picture is larger than ${AVATAR_MAX_BYTES / 1024 / 1024} MiB` });
|
|
@@ -9313,8 +9331,8 @@ var PUBLIC_PROFILE_READERS = {
|
|
|
9313
9331
|
});
|
|
9314
9332
|
picture = blob.status === 200 ? await decodeAvatar(blob.bytes, 160) : { miss: `${server.host} answered ${blob.status}` };
|
|
9315
9333
|
hosts.push(server.host);
|
|
9316
|
-
} catch {
|
|
9317
|
-
picture = { miss: "the account's server could not be asked for it" };
|
|
9334
|
+
} catch (e) {
|
|
9335
|
+
picture = { miss: pictureMiss(e, "the account's server could not be asked for it") };
|
|
9318
9336
|
}
|
|
9319
9337
|
else if (typeof d.avatar === "string") picture = { miss: "Bluesky named it at an address this app does not read" };
|
|
9320
9338
|
return profile({
|
|
@@ -9337,6 +9355,14 @@ var KEY = "publicProfiles";
|
|
|
9337
9355
|
var PRUNE_MS = 6e5;
|
|
9338
9356
|
var keyOf$1 = (s) => `${s.provider}\n${s.subject}`;
|
|
9339
9357
|
/**
|
|
9358
|
+
* The fetch an identity's public data is read with: a contact's, while Hide my IP from contacts is on, reaches only
|
|
9359
|
+
* hosts this app names, so a server the contact chose (their AT Protocol server) never learns this device's IP address.
|
|
9360
|
+
*/
|
|
9361
|
+
function profileFetch(host, s, fetch) {
|
|
9362
|
+
if (!host.relayOnly?.() || host.own?.().some((o) => o.provider === s.provider && o.subject === s.subject)) return fetch;
|
|
9363
|
+
return fixedHostsFetch(fetch);
|
|
9364
|
+
}
|
|
9365
|
+
/**
|
|
9340
9366
|
* The public profiles of verified identities, engine side: asked for one identity at a time, when its card is on
|
|
9341
9367
|
* screen (the UI's `loadPublicProfile`), only for an identity with a current verified proof and only with the
|
|
9342
9368
|
* setting on and the network on. Kept in IndexedDB for offline use, asked again after a day (misses after five
|
|
@@ -9442,7 +9468,7 @@ var PublicProfiles = class {
|
|
|
9442
9468
|
const checkedAt = this.now;
|
|
9443
9469
|
try {
|
|
9444
9470
|
const data = await reader.read(s.subject, {
|
|
9445
|
-
fetch: this.fetch,
|
|
9471
|
+
fetch: profileFetch(this.host, s, this.fetch),
|
|
9446
9472
|
signal: AbortSignal.timeout(2e4),
|
|
9447
9473
|
relays: this.host.nostrRelays(),
|
|
9448
9474
|
makeSocket: this.host.makeSocket,
|
|
@@ -9978,19 +10004,26 @@ async function readPostImage(source, ctx) {
|
|
|
9978
10004
|
const doc = await resolveAtprotoDid(source.did, resolve);
|
|
9979
10005
|
server = new URL(doc.pds);
|
|
9980
10006
|
await assertPublicServer(server.hostname, resolve);
|
|
9981
|
-
} catch {
|
|
10007
|
+
} catch (e) {
|
|
9982
10008
|
return {
|
|
9983
|
-
miss: "the account's server could not be asked for it",
|
|
10009
|
+
miss: pictureMiss(e, "the account's server could not be asked for it"),
|
|
9984
10010
|
hosts: []
|
|
9985
10011
|
};
|
|
9986
10012
|
}
|
|
10013
|
+
let refused;
|
|
9987
10014
|
const r = await ctx.fetch(`${server.origin}/xrpc/com.atproto.sync.getBlob?${new URLSearchParams({
|
|
9988
10015
|
did: source.did,
|
|
9989
10016
|
cid: source.cid
|
|
9990
10017
|
})}`, {
|
|
9991
10018
|
maxBytes: AVATAR_MAX_BYTES,
|
|
9992
10019
|
signal: ctx.signal
|
|
9993
|
-
}).catch(() =>
|
|
10020
|
+
}).catch((e) => {
|
|
10021
|
+
refused = e;
|
|
10022
|
+
});
|
|
10023
|
+
if (refused instanceof HostNotContacted) return {
|
|
10024
|
+
miss: refused.message,
|
|
10025
|
+
hosts: []
|
|
10026
|
+
};
|
|
9994
10027
|
if (!r) return {
|
|
9995
10028
|
miss: `${server.host} could not be reached, or the picture is larger than ${AVATAR_MAX_BYTES / 1024 / 1024} MiB`,
|
|
9996
10029
|
hosts: [server.host]
|
|
@@ -10039,9 +10072,10 @@ var PublicActivity = class {
|
|
|
10039
10072
|
allowed(s) {
|
|
10040
10073
|
return this.host.enabled() && !!this.reader(s) && this.host.eligible().some((e) => e.provider === s.provider && e.subject === s.subject);
|
|
10041
10074
|
}
|
|
10042
|
-
|
|
10075
|
+
/** A contact's identity, while Hide my IP from contacts is on, is read only from hosts this app names (`profileFetch`). */
|
|
10076
|
+
ctx(s, signal = AbortSignal.timeout(ASK_TIMEOUT_MS)) {
|
|
10043
10077
|
return {
|
|
10044
|
-
fetch: this.fetch,
|
|
10078
|
+
fetch: profileFetch(this.host, s, this.fetch),
|
|
10045
10079
|
signal,
|
|
10046
10080
|
relays: this.host.nostrRelays(),
|
|
10047
10081
|
makeSocket: this.host.makeSocket,
|
|
@@ -10122,7 +10156,7 @@ var PublicActivity = class {
|
|
|
10122
10156
|
}
|
|
10123
10157
|
const reader = this.reader(s);
|
|
10124
10158
|
await this.once(`posts\n${key}${s.more ? "\nmore" : ""}`, async () => {
|
|
10125
|
-
const page = await reader.posts(s.subject, this.ctx(), s.more ? kept?.cursor : void 0);
|
|
10159
|
+
const page = await reader.posts(s.subject, this.ctx(s), s.more ? kept?.cursor : void 0);
|
|
10126
10160
|
if (!this.allowed(s)) return;
|
|
10127
10161
|
const before = s.more ? this.posts.get(key)?.posts ?? [] : [];
|
|
10128
10162
|
const seen = new Set(before.map((p) => p.id));
|
|
@@ -10215,7 +10249,7 @@ var PublicActivity = class {
|
|
|
10215
10249
|
}
|
|
10216
10250
|
const reader = this.reader(s);
|
|
10217
10251
|
await this.once(`graph\n${key}`, async () => {
|
|
10218
|
-
const g = await reader.graph(s.subject, this.ctx());
|
|
10252
|
+
const g = await reader.graph(s.subject, this.ctx(s));
|
|
10219
10253
|
if (!this.allowed(s)) return;
|
|
10220
10254
|
this.graphs.set(key, {
|
|
10221
10255
|
...g,
|
|
@@ -10240,7 +10274,7 @@ var PublicActivity = class {
|
|
|
10240
10274
|
}
|
|
10241
10275
|
if (!this.host.online()) throw new Error("Offline: turn the network on first");
|
|
10242
10276
|
return this.once(`image\n${key}`, async () => {
|
|
10243
|
-
const r = await readPostImage(image.source, this.ctx());
|
|
10277
|
+
const r = await readPostImage(image.source, this.ctx(s));
|
|
10244
10278
|
const view = {
|
|
10245
10279
|
hosts: r.hosts,
|
|
10246
10280
|
...r.avatar ? { src: r.avatar } : {},
|
|
@@ -10332,16 +10366,43 @@ async function bytesHere(file) {
|
|
|
10332
10366
|
return await (file.bytes ? await fileBytesOf(file.bytes) : null)?.size(file.id) ?? 0;
|
|
10333
10367
|
}
|
|
10334
10368
|
/**
|
|
10369
|
+
* A received picture as it goes on: without its metadata (one from an app that sent it with them keeps where its author
|
|
10370
|
+
* took it, the device, the time), read whole; undefined for any other file, copied as it is. Refused with
|
|
10371
|
+
* `NO_PICTURE_METADATA` when its metadata cannot be removed, as a picture sent from here is.
|
|
10372
|
+
*/
|
|
10373
|
+
async function withoutMetadata(source, size, file, read) {
|
|
10374
|
+
if (file.voice || file.video || !size) return void 0;
|
|
10375
|
+
if (!isStrippedPicture(await read(0, Math.min(PICTURE_METADATA_LIMITS.headBytes, size)), file.mime)) return void 0;
|
|
10376
|
+
if (size > PICTURE_METADATA_LIMITS.maxBytes) throw new Error(NO_PICTURE_METADATA);
|
|
10377
|
+
const whole = new Uint8Array(size);
|
|
10378
|
+
for (let offset = 0; offset < size;) {
|
|
10379
|
+
const part = await read(offset, Math.min(1048576, size - offset));
|
|
10380
|
+
if (!part.length) throw new Error("The file is shorter than it says");
|
|
10381
|
+
whole.set(part, offset);
|
|
10382
|
+
offset += part.length;
|
|
10383
|
+
}
|
|
10384
|
+
return new Blob(stripPictureMetadata(whole, file.mime), { type: source.blob?.type ?? file.mime });
|
|
10385
|
+
}
|
|
10386
|
+
/**
|
|
10335
10387
|
* A copy of a file on this device, for sending in another chat under `file.id`: a small one whole, a larger one a
|
|
10336
|
-
* step at a time, never whole in memory
|
|
10388
|
+
* step at a time, never whole in memory; a picture without its metadata, read whole. Refused while it is still
|
|
10389
|
+
* arriving, or when its bytes are gone. Resolves to `file` as it goes: a stripped picture's size is its copy's.
|
|
10337
10390
|
*/
|
|
10338
10391
|
async function copyForForward(sourceId, target) {
|
|
10339
10392
|
const source = await fileStore.get(sourceId);
|
|
10340
10393
|
if (!source?.metadata) throw new Error("The file is not on this device any more");
|
|
10341
|
-
const
|
|
10394
|
+
const stored = storedSize(source);
|
|
10342
10395
|
const checked = source.wire3 ? source.wire3.state === "done" : !source.group || source.transfer?.state === "done";
|
|
10343
|
-
if (source.direction === "in" && !checked || await bytesHere(source) !==
|
|
10344
|
-
const
|
|
10396
|
+
if (source.direction === "in" && !checked || await bytesHere(source) !== stored) throw new Error("The file has not arrived yet");
|
|
10397
|
+
const from = source.bytes ? await fileBytesOf(source.bytes) : null;
|
|
10398
|
+
const read = async (offset, length) => source.blob ? new Uint8Array(await source.blob.slice(offset, offset + length).arrayBuffer()) : from.read(source.id, offset, length);
|
|
10399
|
+
const stripped = await withoutMetadata(source, stored, target.file, read);
|
|
10400
|
+
const blob = stripped ?? source.blob, size = stripped?.size ?? stored;
|
|
10401
|
+
const known = stripped ? void 0 : source.digest;
|
|
10402
|
+
const { linkId, wireId, timestamp } = target, file = stripped ? {
|
|
10403
|
+
...target.file,
|
|
10404
|
+
size
|
|
10405
|
+
} : target.file;
|
|
10345
10406
|
const metadata = {
|
|
10346
10407
|
name: file.name,
|
|
10347
10408
|
size: file.size,
|
|
@@ -10364,32 +10425,33 @@ async function copyForForward(sourceId, target) {
|
|
|
10364
10425
|
size: file.size
|
|
10365
10426
|
}
|
|
10366
10427
|
};
|
|
10367
|
-
if (size <= 16777216 &&
|
|
10368
|
-
const copy = new Blob([await
|
|
10428
|
+
if (size <= 16777216 && blob) {
|
|
10429
|
+
const copy = new Blob([await blob.slice(0, size).arrayBuffer()], { type: blob.type });
|
|
10430
|
+
const digest = known ?? (stripped ? await blobDigest(copy) : void 0);
|
|
10369
10431
|
await fileStore.put({
|
|
10370
10432
|
...record,
|
|
10371
10433
|
blob: copy,
|
|
10372
|
-
...
|
|
10434
|
+
...digest && { digest }
|
|
10373
10435
|
});
|
|
10374
|
-
return;
|
|
10436
|
+
return file;
|
|
10375
10437
|
}
|
|
10376
10438
|
const bytes = await fileBytes();
|
|
10377
|
-
const from = source.bytes ? await fileBytesOf(source.bytes) : null;
|
|
10378
10439
|
try {
|
|
10379
10440
|
const appender = new FileAppender(bytes, file.id);
|
|
10380
10441
|
for (let offset = 0; offset < size;) {
|
|
10381
|
-
const part =
|
|
10442
|
+
const part = blob ? new Uint8Array(await blob.slice(offset, offset + 1048576).arrayBuffer()) : await read(offset, Math.min(1048576, size - offset));
|
|
10382
10443
|
if (!part.length) throw new Error("The file is shorter than it says");
|
|
10383
10444
|
await appender.append(part);
|
|
10384
10445
|
offset += part.length;
|
|
10385
10446
|
}
|
|
10386
10447
|
await appender.close();
|
|
10387
|
-
const digest =
|
|
10448
|
+
const digest = known ?? await bytes.digest(file.id);
|
|
10388
10449
|
await fileStore.put({
|
|
10389
10450
|
...record,
|
|
10390
10451
|
bytes: bytes.kind,
|
|
10391
10452
|
digest
|
|
10392
10453
|
});
|
|
10454
|
+
return file;
|
|
10393
10455
|
} catch (error) {
|
|
10394
10456
|
await bytes.remove(file.id).catch(() => {});
|
|
10395
10457
|
throw error;
|
|
@@ -10972,6 +11034,21 @@ function notReadable(url, words) {
|
|
|
10972
11034
|
if (typeof url === "string" && isGitHubPage(url)) fail("github-link", "Paste the repository's link, or the link to its app file");
|
|
10973
11035
|
fail("host", words);
|
|
10974
11036
|
}
|
|
11037
|
+
/**
|
|
11038
|
+
* A pasted link Ghostly reads, with a query or a fragment, is refused (`private-link`): a private repository's file link
|
|
11039
|
+
* carries its read token in the query, and the link an app is installed from goes on the card a contact receives. A
|
|
11040
|
+
* github.com page's query never reaches the file read (`appPasteUrl` makes that link anew).
|
|
11041
|
+
*/
|
|
11042
|
+
function refusePrivateLink(url) {
|
|
11043
|
+
if (typeof url !== "string" || isGitHubPage(url)) return;
|
|
11044
|
+
let href;
|
|
11045
|
+
try {
|
|
11046
|
+
href = new URL(url.trim()).href;
|
|
11047
|
+
} catch {
|
|
11048
|
+
return;
|
|
11049
|
+
}
|
|
11050
|
+
if (/[?#]/.test(href)) fail("private-link", "This link carries a query or a fragment, as a private repository's file link does: publish the app in a public repository and paste its link");
|
|
11051
|
+
}
|
|
10975
11052
|
var versionOf = (manifest, digest) => ({
|
|
10976
11053
|
ref: appRef(manifest.publisher, manifest.name),
|
|
10977
11054
|
sequence: manifest.sequence,
|
|
@@ -11712,7 +11789,9 @@ var Apps = class {
|
|
|
11712
11789
|
return (await this.stores()).sort((a, b) => a.addedAt - b.addedAt).map((s) => this.summary(s));
|
|
11713
11790
|
}
|
|
11714
11791
|
storeUrl(url) {
|
|
11715
|
-
|
|
11792
|
+
const at = typeof url === "string" && appPasteUrl(url, "ghostly-store.json") || notReadable(url, "Stores are read only from raw.githubusercontent.com, or from cdn.jsdelivr.net at a commit, over HTTPS");
|
|
11793
|
+
refusePrivateLink(url);
|
|
11794
|
+
return at;
|
|
11716
11795
|
}
|
|
11717
11796
|
keepPreviewed(previewed) {
|
|
11718
11797
|
if (this.previewedSweep) clearTimeout(this.previewedSweep);
|
|
@@ -11899,8 +11978,10 @@ var Apps = class {
|
|
|
11899
11978
|
const { bundle, bytes } = await this.bundled(app);
|
|
11900
11979
|
return this.stage(bundle, bytes, app.url, void 0, true);
|
|
11901
11980
|
}
|
|
11902
|
-
if ("url" in source)
|
|
11903
|
-
|
|
11981
|
+
if ("url" in source) {
|
|
11982
|
+
urls = [typeof source.url === "string" && appPasteUrl(source.url, "app.ghostlyapp") || notReadable(source.url, "Apps are read only from raw.githubusercontent.com, or from cdn.jsdelivr.net at a commit, over HTTPS")];
|
|
11983
|
+
refusePrivateLink(source.url);
|
|
11984
|
+
} else if ("store" in source) {
|
|
11904
11985
|
const s = await this.storeRecord(source.store);
|
|
11905
11986
|
const listing = s && !s.removed ? s.index?.apps.find((a) => a.ref === source.ref) : void 0;
|
|
11906
11987
|
if (!listing) fail("not-listed", "This store does not list this app");
|
|
@@ -11953,19 +12034,21 @@ var Apps = class {
|
|
|
11953
12034
|
if (oldest) this.sweep = setTimeout(() => this.sweepStaged(), STAGED.ms - (this.now() - oldest.at));
|
|
11954
12035
|
}
|
|
11955
12036
|
async stage(bundle, bytes, from, fromStore, carried = false) {
|
|
11956
|
-
|
|
11957
|
-
|
|
12037
|
+
const { manifest, digest } = bundle;
|
|
12038
|
+
const version = versionOf(manifest, digest);
|
|
12039
|
+
const revocations = carried ? [] : await this.readRevocations(version.ref, [from, ...manifest.sources ?? []]) ?? [];
|
|
12040
|
+
for (const [d, s] of this.staged) if (this.now() - s.at > STAGED.ms) this.staged.delete(d);
|
|
12041
|
+
this.staged.delete(digest);
|
|
11958
12042
|
while (this.staged.size >= STAGED.max) this.staged.delete(this.staged.keys().next().value);
|
|
11959
|
-
this.staged.set(
|
|
12043
|
+
this.staged.set(digest, {
|
|
11960
12044
|
bundle,
|
|
11961
12045
|
bytes,
|
|
11962
12046
|
from,
|
|
11963
12047
|
...fromStore !== void 0 && { store: fromStore },
|
|
12048
|
+
revocations,
|
|
11964
12049
|
at: this.now()
|
|
11965
12050
|
});
|
|
11966
12051
|
if (!this.sweep) this.sweepStaged();
|
|
11967
|
-
const { manifest, digest } = bundle;
|
|
11968
|
-
const version = versionOf(manifest, digest);
|
|
11969
12052
|
const [installed, stores] = await Promise.all([this.app(version.ref), this.stores()]);
|
|
11970
12053
|
const decision = installDecision(installed, version);
|
|
11971
12054
|
const install = decision === "other-app" ? "new" : decision;
|
|
@@ -11981,7 +12064,7 @@ var Apps = class {
|
|
|
11981
12064
|
icon: bundle.files.get("icon.png")?.slice() ?? null,
|
|
11982
12065
|
install,
|
|
11983
12066
|
asks,
|
|
11984
|
-
run: this.runStatus(version, this.storeViews(stores), installed?.revocations),
|
|
12067
|
+
run: this.runStatus(version, this.storeViews(stores), [...installed?.revocations ?? [], ...revocations]),
|
|
11985
12068
|
listedBy,
|
|
11986
12069
|
unknownPublisher: !listedBy.some((s) => s.kind === "curated"),
|
|
11987
12070
|
...carried && { carried: true }
|
|
@@ -11998,7 +12081,7 @@ var Apps = class {
|
|
|
11998
12081
|
this.staged.delete(digest);
|
|
11999
12082
|
fail("expired", "Fetch the app again");
|
|
12000
12083
|
}
|
|
12001
|
-
const { bundle, bytes, from, store: fromStore } = staged;
|
|
12084
|
+
const { bundle, bytes, from, store: fromStore, revocations } = staged;
|
|
12002
12085
|
const { manifest } = bundle;
|
|
12003
12086
|
if (!Array.isArray(grant) || !manifest.permissions.every((p) => grant.includes(p))) fail("permissions", "Every permission the app asks for must be granted");
|
|
12004
12087
|
const version = versionOf(manifest, digest);
|
|
@@ -12006,7 +12089,7 @@ var Apps = class {
|
|
|
12006
12089
|
try {
|
|
12007
12090
|
for (;;) {
|
|
12008
12091
|
const [installed, stores] = await Promise.all([this.app(version.ref), this.stores()]);
|
|
12009
|
-
const run = this.runStatus(version, this.storeViews(stores), installed?.revocations);
|
|
12092
|
+
const run = this.runStatus(version, this.storeViews(stores), [...installed?.revocations ?? [], ...revocations]);
|
|
12010
12093
|
if (run.status === "revoked") fail("revoked", "Its publisher revoked this version");
|
|
12011
12094
|
if (run.status === "removed") fail("removed", `Removed by ${run.by[0].name}: ${run.by[0].reason}`);
|
|
12012
12095
|
const decision = installDecision(installed, version);
|
|
@@ -12038,7 +12121,7 @@ var Apps = class {
|
|
|
12038
12121
|
return this.view(await this.app(version.ref), stores);
|
|
12039
12122
|
}
|
|
12040
12123
|
const kind = wrote = await this.writeBundle(digest, bytes);
|
|
12041
|
-
const next = this.versionRecord(installed, bundle, kind, from, fromStore);
|
|
12124
|
+
const next = withRevocations(this.versionRecord(installed, bundle, kind, from, fromStore), revocations);
|
|
12042
12125
|
if (!await this.putAppIfUnchanged(next, installed)) continue;
|
|
12043
12126
|
if (!installed && this.builtIn(version.ref)) await this.keepBuiltIn(version.ref);
|
|
12044
12127
|
if (installed && installed.digest !== digest) await this.removeBundle(installed.bytes, installed.digest);
|
|
@@ -12882,6 +12965,7 @@ function transition(from, profile, to, patch = {}) {
|
|
|
12882
12965
|
state: to
|
|
12883
12966
|
};
|
|
12884
12967
|
if (failed) delete next.breezDatabases;
|
|
12968
|
+
if (to === "active" && !("heldFiles" in patch)) delete next.heldFiles;
|
|
12885
12969
|
return checked(rising(from, next));
|
|
12886
12970
|
}
|
|
12887
12971
|
/** The record with some fields changed and its state kept. */
|
|
@@ -16193,6 +16277,17 @@ async function planSetMove(record, signer, options = {}) {
|
|
|
16193
16277
|
const earlier = [];
|
|
16194
16278
|
for (const set of record.earlierSets) {
|
|
16195
16279
|
const pending = staying(set.pending);
|
|
16280
|
+
let by;
|
|
16281
|
+
try {
|
|
16282
|
+
by = readSetUpdate(JSON.parse(set.setUpdate))?.by;
|
|
16283
|
+
} catch {}
|
|
16284
|
+
if (!by || !bytesEqual(by, signer.publicKey)) {
|
|
16285
|
+
earlier.push({
|
|
16286
|
+
...set,
|
|
16287
|
+
pending
|
|
16288
|
+
});
|
|
16289
|
+
continue;
|
|
16290
|
+
}
|
|
16196
16291
|
let oldRec;
|
|
16197
16292
|
try {
|
|
16198
16293
|
const was = JSON.parse(set.setUpdate);
|
|
@@ -17002,6 +17097,8 @@ var DeviceLinks = class {
|
|
|
17002
17097
|
turnQueue = Promise.resolve();
|
|
17003
17098
|
turnTimer = null;
|
|
17004
17099
|
lastHintRead = 0;
|
|
17100
|
+
/** When a link closing by the other side's doing last made this standby read the turn (`linkLost`). */
|
|
17101
|
+
lastLossRead = 0;
|
|
17005
17102
|
timers = /* @__PURE__ */ new Set();
|
|
17006
17103
|
constructor(options) {
|
|
17007
17104
|
this.options = options;
|
|
@@ -17232,6 +17329,7 @@ var DeviceLinks = class {
|
|
|
17232
17329
|
running.rtcWait = void 0;
|
|
17233
17330
|
}
|
|
17234
17331
|
if (state !== "open") {
|
|
17332
|
+
if (running.agreed && !running.earlier && this.running.get(running.id) === running) this.linkLost().catch(() => {});
|
|
17235
17333
|
running.agreed = false;
|
|
17236
17334
|
this.failPings(running, "The device link closed");
|
|
17237
17335
|
if (running.handoff) {
|
|
@@ -17552,6 +17650,19 @@ var DeviceLinks = class {
|
|
|
17552
17650
|
this.lastHintRead = Date.now();
|
|
17553
17651
|
await this.checkAndShow().catch(() => null);
|
|
17554
17652
|
}
|
|
17653
|
+
/**
|
|
17654
|
+
* A standby's live link to another device of its set closed by that device's doing. A removal does this right after
|
|
17655
|
+
* it puts the tombstone, and nothing else tells a screen left in front (no focus, no visibility change) before its
|
|
17656
|
+
* next read, up to 10 minutes away: it would go on offering Use here, which must fail. Read once, as a hint is, at
|
|
17657
|
+
* most once in `TURN_HINT_EVERY_MS`: a network that drops every link at once costs one read.
|
|
17658
|
+
*/
|
|
17659
|
+
async linkLost() {
|
|
17660
|
+
if (!this.options.watchTurn || this.stopped || Date.now() - this.lastLossRead < 3e4) return;
|
|
17661
|
+
this.lastLossRead = Date.now();
|
|
17662
|
+
const record = await this.record();
|
|
17663
|
+
if (!record || record.state === "active" || record.state === "removed") return;
|
|
17664
|
+
await this.checkAndShow();
|
|
17665
|
+
}
|
|
17555
17666
|
/** `key` holds the set under `d` (or the current one): its pending frame is done, and the old link goes. */
|
|
17556
17667
|
async acked(key, d) {
|
|
17557
17668
|
if (!acknowledged(await this.record(), key, d)) return;
|
|
@@ -19593,6 +19704,34 @@ async function writeWalletHomes(wallets) {
|
|
|
19593
19704
|
});
|
|
19594
19705
|
}
|
|
19595
19706
|
//#endregion
|
|
19707
|
+
//#region ../browser/src/shared/refusals.ts
|
|
19708
|
+
/**
|
|
19709
|
+
* The ids the engine writes these lines under. A contact's frame names its own id, and one of these shapes fits what a
|
|
19710
|
+
* paired text (22 characters) or a held one may name: the engine stores no frame of a contact's under one
|
|
19711
|
+
* (`GhostlyNode.storeNewMessage`) and takes no edit of one (`receiveEdit`).
|
|
19712
|
+
*/
|
|
19713
|
+
var REFUSAL_ID = /^peer_(?:\d+_refused|spent_[0-9a-f]{32})$/;
|
|
19714
|
+
/** Whether a chat row's id is one a refusal line is written under. */
|
|
19715
|
+
var isRefusalId = (id) => REFUSAL_ID.test(id);
|
|
19716
|
+
/** The English line for `notice`, stored as the row's `text`. */
|
|
19717
|
+
function refusedText(notice) {
|
|
19718
|
+
return `Could not receive ${notice.method === "fedimint" ? "Fedimint ecash" : notice.amount === void 0 ? "a payment" : `${notice.amount.toLocaleString("en-US")} ${notice.network === "testnet" ? "test sats" : "sats"}`}: ${notice.reason}`;
|
|
19719
|
+
}
|
|
19720
|
+
/** The row the engine stores for a refusal: the values, and their English as the text. */
|
|
19721
|
+
function refusedRow(notice) {
|
|
19722
|
+
const values = {
|
|
19723
|
+
type: "paymentRefused",
|
|
19724
|
+
...notice.amount !== void 0 && { amount: notice.amount },
|
|
19725
|
+
...notice.network && { network: notice.network },
|
|
19726
|
+
...notice.method && { method: notice.method },
|
|
19727
|
+
reason: notice.reason
|
|
19728
|
+
};
|
|
19729
|
+
return {
|
|
19730
|
+
text: refusedText(values),
|
|
19731
|
+
notice: values
|
|
19732
|
+
};
|
|
19733
|
+
}
|
|
19734
|
+
//#endregion
|
|
19596
19735
|
//#region ../browser/src/engine/messageDetails.ts
|
|
19597
19736
|
/**
|
|
19598
19737
|
* What the engine remembers about a message's travels (WISP 400 § Message details), and how the details view is put
|
|
@@ -19827,7 +19966,8 @@ var FileDesk = class {
|
|
|
19827
19966
|
kept: () => made.saving,
|
|
19828
19967
|
room: async () => (await fileBytes()).room(),
|
|
19829
19968
|
...this.deps.sendData && { sendData: (id, offset, data) => this.deps.sendData(linkId, id, offset, data) },
|
|
19830
|
-
writable: () => this.deps.writable?.(linkId)
|
|
19969
|
+
writable: () => this.deps.writable?.(linkId),
|
|
19970
|
+
batchConfirms: true
|
|
19831
19971
|
});
|
|
19832
19972
|
this.chats.set(linkId, made);
|
|
19833
19973
|
chat = made;
|
|
@@ -22701,8 +22841,8 @@ var Reactions = class {
|
|
|
22701
22841
|
const e = emoji === "" ? "" : reactionEmoji(emoji);
|
|
22702
22842
|
if (e === null) return { error: "A reaction is one emoji" };
|
|
22703
22843
|
const target = await this.named(chat, messageId);
|
|
22704
|
-
const id = target && replyRef(target,
|
|
22705
|
-
if (!target || !id) return { error:
|
|
22844
|
+
const group = isGroup$1(chat), id = target && replyRef(target, group);
|
|
22845
|
+
if (!target || !id) return { error: `That message is not in this ${group ? "group" : "chat"}, or takes no reaction` };
|
|
22706
22846
|
const current = target.reactions?.me;
|
|
22707
22847
|
if (!e && !current?.e) return { error: "No reaction of yours to take back" };
|
|
22708
22848
|
let last = this.last.get(chat) ?? lastMine(await this.host.messages(chat));
|
|
@@ -23019,17 +23159,17 @@ async function pinnedRow(host, chat, id) {
|
|
|
23019
23159
|
*/
|
|
23020
23160
|
async function myPin(host, chat, messageId, remove, current, now = Date.now()) {
|
|
23021
23161
|
const n = nextPinNumber(current?.n, now);
|
|
23162
|
+
const group = isGroup(chat);
|
|
23022
23163
|
if (remove) return current?.id ? {
|
|
23023
23164
|
id: "",
|
|
23024
23165
|
n,
|
|
23025
23166
|
by: "me",
|
|
23026
23167
|
at: now
|
|
23027
|
-
} : { error:
|
|
23168
|
+
} : { error: `Nothing is pinned in this ${group ? "group" : "chat"}` };
|
|
23028
23169
|
if (typeof messageId !== "string" || !messageId) return { error: "No message to pin" };
|
|
23029
|
-
const group = isGroup(chat);
|
|
23030
23170
|
const target = host.message ? await host.message(chat, messageId) ?? await pinnedRow(host, chat, messageId) : (await host.messages(chat)).find((m) => m.id === messageId) ?? await pinnedRow(host, chat, messageId);
|
|
23031
23171
|
const id = target && replyRef(target, group);
|
|
23032
|
-
if (!target || !id) return { error:
|
|
23172
|
+
if (!target || !id) return { error: `That message is not in this ${group ? "group" : "chat"}, or cannot be pinned` };
|
|
23033
23173
|
return {
|
|
23034
23174
|
id,
|
|
23035
23175
|
n,
|
|
@@ -25121,10 +25261,12 @@ var Communities = class {
|
|
|
25121
25261
|
case "group-welcome": {
|
|
25122
25262
|
const joining = group.joining;
|
|
25123
25263
|
if (!joining || joining.linkId !== linkId || !joining.inviter) return;
|
|
25124
|
-
const
|
|
25264
|
+
const inviter = joining.inviter;
|
|
25265
|
+
const joined = await CommunitySession.joinPaced({
|
|
25125
25266
|
g,
|
|
25126
25267
|
host: joining.host
|
|
25127
25268
|
}, joining.pieces, frame, joining.seedB64);
|
|
25269
|
+
if (this.stored.get(g) !== group || group.joining !== joining || joining.linkId !== linkId || joining.inviter !== inviter) return;
|
|
25128
25270
|
if ("error" in joined && joined.error === LINK_REPLACED && !joining.check) {
|
|
25129
25271
|
joining.replaced = true;
|
|
25130
25272
|
joining.inviter = "";
|
|
@@ -26276,13 +26418,13 @@ var MeshSignals = class {
|
|
|
26276
26418
|
* one of them is a link of the two of us, or reaches the admin (`CarriedHooks.carry`).
|
|
26277
26419
|
*/
|
|
26278
26420
|
carry(groupId, to, payload) {
|
|
26279
|
-
const
|
|
26280
|
-
if (!
|
|
26421
|
+
const carriers = this.carriers(groupId, to);
|
|
26422
|
+
if (!carriers) return {
|
|
26281
26423
|
taken: 0,
|
|
26282
26424
|
sure: false
|
|
26283
26425
|
};
|
|
26284
|
-
const frame = groupSignalFrame(groupId, session.myKey, to, payload);
|
|
26285
|
-
const { links, sure } =
|
|
26426
|
+
const frame = groupSignalFrame(groupId, carriers.session.myKey, to, payload);
|
|
26427
|
+
const { links, sure } = carriers;
|
|
26286
26428
|
let taken = 0;
|
|
26287
26429
|
for (const linkId of links) try {
|
|
26288
26430
|
this.host.sendOnLink(linkId, frame);
|
|
@@ -26293,6 +26435,18 @@ var MeshSignals = class {
|
|
|
26293
26435
|
sure: sure && taken > 0
|
|
26294
26436
|
};
|
|
26295
26437
|
}
|
|
26438
|
+
/** Whether `carry` would hand my packet for the edge to `to` to any link now (`CarriedHooks.canCarry`). */
|
|
26439
|
+
canCarry(groupId, to) {
|
|
26440
|
+
return !!this.carriers(groupId, to)?.links.length;
|
|
26441
|
+
}
|
|
26442
|
+
carriers(groupId, to) {
|
|
26443
|
+
const session = this.scope.session(groupId), group = this.scope.stored(groupId);
|
|
26444
|
+
if (!session || !group || group.left || session.status !== "active" || to === session.myKey || !rosterHas(session.roster, to)) return void 0;
|
|
26445
|
+
return {
|
|
26446
|
+
session,
|
|
26447
|
+
...this.links(groupId, session, group, to)
|
|
26448
|
+
};
|
|
26449
|
+
}
|
|
26296
26450
|
/**
|
|
26297
26451
|
* A `group-signal` that came on `linkId`, whose other end is the member `via` (none: an entry session's admin side
|
|
26298
26452
|
* as the joiner sees it). For me: the edge takes it, and my own packet goes back the same way when theirs was news.
|
|
@@ -27463,6 +27617,7 @@ var Groups = class {
|
|
|
27463
27617
|
return {
|
|
27464
27618
|
me: session.myKey,
|
|
27465
27619
|
community: false,
|
|
27620
|
+
onHubs: this.hubs.active(groupId, session, this.now()),
|
|
27466
27621
|
inRoster: (key) => rosterHas(session.roster, key),
|
|
27467
27622
|
couldRead: (key, messageId, ts) => session.couldRead(key, messageId, ts)
|
|
27468
27623
|
};
|
|
@@ -27874,7 +28029,10 @@ var Groups = class {
|
|
|
27874
28029
|
return;
|
|
27875
28030
|
}
|
|
27876
28031
|
const group = this.stored.get(groupId);
|
|
27877
|
-
if (!group?.entry)
|
|
28032
|
+
if (!group?.entry) {
|
|
28033
|
+
if (!this.sessions.get(groupId)?.isAdmin) throw new Error("Only the admin can replace or turn off the group's link");
|
|
28034
|
+
return;
|
|
28035
|
+
}
|
|
27878
28036
|
delete group.entry;
|
|
27879
28037
|
await this.store.putGroup(group);
|
|
27880
28038
|
await this.closeEntries(groupId);
|
|
@@ -28133,6 +28291,10 @@ var Groups = class {
|
|
|
28133
28291
|
sure: false
|
|
28134
28292
|
} : this.signals.carry(groupId, to, payload);
|
|
28135
28293
|
}
|
|
28294
|
+
/** Whether `carrySignal` would hand my packet for the edge to `to` to any link now. */
|
|
28295
|
+
canCarrySignal(groupId, to) {
|
|
28296
|
+
return !this.isCommunity(groupId) && this.signals.canCarry(groupId, to);
|
|
28297
|
+
}
|
|
28136
28298
|
/** My packet for the edge to `to`, over that edge itself while it is up (`MeshSignals.direct`). */
|
|
28137
28299
|
directSignal(groupId, to, linkId, payload) {
|
|
28138
28300
|
return !this.isCommunity(groupId) && this.signals.direct(groupId, to, linkId, payload);
|
|
@@ -29449,7 +29611,7 @@ function edgeView(live, now = Date.now(), noSlot = false) {
|
|
|
29449
29611
|
linkId: live.stored.id,
|
|
29450
29612
|
state,
|
|
29451
29613
|
...open && live.pairing?.transport ? { transport: live.pairing.transport } : {},
|
|
29452
|
-
lastSeenAt:
|
|
29614
|
+
lastSeenAt: heardAt,
|
|
29453
29615
|
...error ? {
|
|
29454
29616
|
error,
|
|
29455
29617
|
cause
|
|
@@ -29889,7 +30051,7 @@ var GroupEdits = class {
|
|
|
29889
30051
|
refused: true
|
|
29890
30052
|
});
|
|
29891
30053
|
const membership = this.host.membership(groupId);
|
|
29892
|
-
if (!membership) return refuse(
|
|
30054
|
+
if (!membership) return refuse(this.notMember(groupId));
|
|
29893
30055
|
if (typeof messageId !== "string" || typeof raw !== "string") return refuse("No message to edit");
|
|
29894
30056
|
const chat = chatOf(groupId);
|
|
29895
30057
|
const message = await this.find(chat, messageId);
|
|
@@ -29939,7 +30101,7 @@ var GroupEdits = class {
|
|
|
29939
30101
|
error,
|
|
29940
30102
|
refused: true
|
|
29941
30103
|
});
|
|
29942
|
-
if (!this.host.membership(groupId)) return refuse(
|
|
30104
|
+
if (!this.host.membership(groupId)) return refuse(this.notMember(groupId));
|
|
29943
30105
|
const chat = chatOf(groupId);
|
|
29944
30106
|
const message = typeof messageId === "string" ? await this.find(chat, messageId) : void 0;
|
|
29945
30107
|
if (!message || message.removed || message.sender !== "me" || !GROUP_MESSAGE_ID.test(message.id)) return refuse("Only your own messages can be deleted for everyone");
|
|
@@ -29957,6 +30119,10 @@ var GroupEdits = class {
|
|
|
29957
30119
|
messageId
|
|
29958
30120
|
};
|
|
29959
30121
|
}
|
|
30122
|
+
/** What an edit or a removal in a group I am not in is refused with: the group's reason, as a message or a reaction is. */
|
|
30123
|
+
notMember(groupId) {
|
|
30124
|
+
return this.host.notMember?.(groupId) ?? "You are not in this group";
|
|
30125
|
+
}
|
|
29960
30126
|
/** Says my pending edits in a group, oldest first, at the pace allowed; what waits goes when the window has room. */
|
|
29961
30127
|
flush(groupId) {
|
|
29962
30128
|
const running = this.flushing.get(groupId);
|
|
@@ -30747,6 +30913,14 @@ var REPUBLISH_MS = 36e5;
|
|
|
30747
30913
|
var HOLD_FETCH_MS = 2e4;
|
|
30748
30914
|
var HOLD_FETCH_BYTES_PER_S = 65536;
|
|
30749
30915
|
var holdFetchTimeoutMs = (max) => HOLD_FETCH_MS + Math.ceil(max / HOLD_FETCH_BYTES_PER_S) * 1e3;
|
|
30916
|
+
/** Why a pickup waits: its storage would see this device's address, which the person hides from contacts. */
|
|
30917
|
+
var HOLD_HIDDEN_IP = "Hide my IP from contacts is on: what your contact held for you waits on their storage until you turn it off.";
|
|
30918
|
+
/** Thrown where an address is about to be read, so a pickup stops there and starts again once it may. */
|
|
30919
|
+
var HiddenIpError = class extends Error {
|
|
30920
|
+
constructor() {
|
|
30921
|
+
super(HOLD_HIDDEN_IP);
|
|
30922
|
+
}
|
|
30923
|
+
};
|
|
30750
30924
|
var hex$2 = (bytes) => Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
30751
30925
|
/**
|
|
30752
30926
|
* Store-and-forward for away contacts (WISP 404, `hold/1`), on both ends of every chat that turned it
|
|
@@ -31329,8 +31503,11 @@ var HoldEngine = class {
|
|
|
31329
31503
|
...hold,
|
|
31330
31504
|
peerAck: pointer.ack
|
|
31331
31505
|
});
|
|
31506
|
+
const wasHidden = this.errors.get(linkId) === HOLD_HIDDEN_IP;
|
|
31507
|
+
if (wasHidden) this.errors.delete(linkId);
|
|
31332
31508
|
if (pointer.top <= hold.inSeq) {
|
|
31333
31509
|
this.expecting.delete(linkId);
|
|
31510
|
+
if (wasHidden) this.host.changed();
|
|
31334
31511
|
return;
|
|
31335
31512
|
}
|
|
31336
31513
|
if (!pointer.manifestUrl || pointer.expires <= now) {
|
|
@@ -31356,7 +31533,8 @@ var HoldEngine = class {
|
|
|
31356
31533
|
refused: this.state(linkId).refused + 1
|
|
31357
31534
|
});
|
|
31358
31535
|
this.errors.set(linkId, `Refused what the contact's storage offered: ${error.message}`);
|
|
31359
|
-
} else this.errors.set(linkId,
|
|
31536
|
+
} else if (error instanceof HiddenIpError) this.errors.set(linkId, HOLD_HIDDEN_IP);
|
|
31537
|
+
else this.errors.set(linkId, `Could not pick up held items: ${error instanceof Error ? error.message : String(error)}`);
|
|
31360
31538
|
this.host.changed();
|
|
31361
31539
|
return;
|
|
31362
31540
|
}
|
|
@@ -31490,7 +31668,7 @@ var HoldEngine = class {
|
|
|
31490
31668
|
this.errors.set(linkId, `Refused a held item from the contact: ${error.message}`);
|
|
31491
31669
|
changed = true;
|
|
31492
31670
|
} else {
|
|
31493
|
-
this.errors.set(linkId, `Could not pick up held items: ${error instanceof Error ? error.message : String(error)}`);
|
|
31671
|
+
this.errors.set(linkId, error instanceof HiddenIpError ? HOLD_HIDDEN_IP : `Could not pick up held items: ${error instanceof Error ? error.message : String(error)}`);
|
|
31494
31672
|
stop = true;
|
|
31495
31673
|
}
|
|
31496
31674
|
}
|
|
@@ -31526,6 +31704,8 @@ var HoldEngine = class {
|
|
|
31526
31704
|
}
|
|
31527
31705
|
async readBytes(url, max, signal) {
|
|
31528
31706
|
if (!isHoldUrl(url, this.host.loopbackStorage?.())) throw new Error("The storage address is not one this app reads");
|
|
31707
|
+
const hosts = this.host.hiddenIpHosts?.();
|
|
31708
|
+
if (hosts && !hosts.includes(new URL(url).host.toLowerCase())) throw new HiddenIpError();
|
|
31529
31709
|
const response = await (this.host.fetch ?? ((...args) => fetch(...args)))(url, {
|
|
31530
31710
|
cache: "no-store",
|
|
31531
31711
|
credentials: "omit",
|
|
@@ -32670,26 +32850,6 @@ var S3Store = class {
|
|
|
32670
32850
|
}
|
|
32671
32851
|
};
|
|
32672
32852
|
//#endregion
|
|
32673
|
-
//#region ../browser/src/shared/refusals.ts
|
|
32674
|
-
/** The English line for `notice`, stored as the row's `text`. */
|
|
32675
|
-
function refusedText(notice) {
|
|
32676
|
-
return `Could not receive ${notice.method === "fedimint" ? "Fedimint ecash" : notice.amount === void 0 ? "a payment" : `${notice.amount.toLocaleString("en-US")} ${notice.network === "testnet" ? "test sats" : "sats"}`}: ${notice.reason}`;
|
|
32677
|
-
}
|
|
32678
|
-
/** The row the engine stores for a refusal: the values, and their English as the text. */
|
|
32679
|
-
function refusedRow(notice) {
|
|
32680
|
-
const values = {
|
|
32681
|
-
type: "paymentRefused",
|
|
32682
|
-
...notice.amount !== void 0 && { amount: notice.amount },
|
|
32683
|
-
...notice.network && { network: notice.network },
|
|
32684
|
-
...notice.method && { method: notice.method },
|
|
32685
|
-
reason: notice.reason
|
|
32686
|
-
};
|
|
32687
|
-
return {
|
|
32688
|
-
text: refusedText(values),
|
|
32689
|
-
notice: values
|
|
32690
|
-
};
|
|
32691
|
-
}
|
|
32692
|
-
//#endregion
|
|
32693
32853
|
//#region ../browser/src/engine/wallet.ts
|
|
32694
32854
|
/**
|
|
32695
32855
|
* The peer's Cashu wallet. Ecash is custodial: the mint holds the sats and the
|
|
@@ -37747,6 +37907,13 @@ var REACTION_RESEND_MS = 3e4;
|
|
|
37747
37907
|
var pkarrSeenAt = (messages) => messages.reduce((max, m) => m.sender === "peer" && m.via === "pkarr" ? Math.max(max, m.sentAt ?? m.timestamp) : max, 0);
|
|
37748
37908
|
/** A file or a payment request of mine that waits for the chat to be live (a text that waits is its outbox's). */
|
|
37749
37909
|
var waitsForLive = (m) => m.sender === "me" && m.delivery === "waiting" && (!!m.file || !!m.paymentId);
|
|
37910
|
+
/** A message of mine whose card went as its text alone and is due to go again live (`restoreCards`). */
|
|
37911
|
+
var cardDue = (m) => m.sender === "me" && (m.cardRestore ?? m.buttonsRestore) === "due";
|
|
37912
|
+
/** The id a 1:1 chat's row goes by on both sides when its own row is not `peer_`/`me_` and that id (`resolveReply`). */
|
|
37913
|
+
var unkeyedRef = (m) => {
|
|
37914
|
+
const ref = replyRef(m, false);
|
|
37915
|
+
return ref && m.id !== `peer_${ref}` && m.id !== `me_${ref}` ? ref : void 0;
|
|
37916
|
+
};
|
|
37750
37917
|
/** This side's participation key in a chat: derived from its seed once, not at every state built. */
|
|
37751
37918
|
/** A read of the contact's packet that found it as the last one did: online the same, the same packet, name and services. */
|
|
37752
37919
|
var samePresence = (a, b) => a.online === b.online && a.lastPacketAt === b.lastPacketAt && a.seenAt === b.seenAt && a.nick === b.nick && JSON.stringify(a.services) === JSON.stringify(b.services);
|
|
@@ -37993,6 +38160,8 @@ var GhostlyNode = class GhostlyNode {
|
|
|
37993
38160
|
* Not one queue for all: a transport slow to start held every other chat's listeners of every kind behind it.
|
|
37994
38161
|
*/
|
|
37995
38162
|
nativeQueues = /* @__PURE__ */ new Map();
|
|
38163
|
+
/** Per transport, whether a start is under way, and the starts waiting their turn (`nativeTurn`). */
|
|
38164
|
+
nativeTurns = /* @__PURE__ */ new Map();
|
|
37996
38165
|
/** Every listener start asked for so far has ended. */
|
|
37997
38166
|
get nativeQueue() {
|
|
37998
38167
|
return Promise.all(this.nativeQueues.values()).then(() => {});
|
|
@@ -38636,6 +38805,14 @@ var GhostlyNode = class GhostlyNode {
|
|
|
38636
38805
|
changed: () => this.emitState(),
|
|
38637
38806
|
fetch: (...request) => (this.options.holdFetch ?? globalThis.fetch)(...request),
|
|
38638
38807
|
loopbackStorage: () => this.options.holdLoopback === true,
|
|
38808
|
+
hiddenIpHosts: () => {
|
|
38809
|
+
if (this.settings.relayOnly !== true) return null;
|
|
38810
|
+
try {
|
|
38811
|
+
return this.settings.holdStorage?.s3 ? [new URL(this.settings.holdStorage.s3.endpoint.trim()).host.toLowerCase()] : [];
|
|
38812
|
+
} catch {
|
|
38813
|
+
return [];
|
|
38814
|
+
}
|
|
38815
|
+
},
|
|
38639
38816
|
ttlMs: () => {
|
|
38640
38817
|
const raw = testSwitch("ghostly-test-hold-ttl");
|
|
38641
38818
|
const ms = raw ? Number(raw) : NaN;
|
|
@@ -38689,6 +38866,7 @@ var GhostlyNode = class GhostlyNode {
|
|
|
38689
38866
|
},
|
|
38690
38867
|
linkIds: () => [...this.links.keys()],
|
|
38691
38868
|
online: () => this.networkOn,
|
|
38869
|
+
relayOnly: () => this.settings.relayOnly === true,
|
|
38692
38870
|
emit: () => {
|
|
38693
38871
|
this.emitState();
|
|
38694
38872
|
this.did.changed();
|
|
@@ -38814,7 +38992,9 @@ var GhostlyNode = class GhostlyNode {
|
|
|
38814
38992
|
online: () => this.networkOn,
|
|
38815
38993
|
emit: () => this.emitState(),
|
|
38816
38994
|
eligible: () => this.profileSubjects(),
|
|
38817
|
-
nostrRelays: () => effectiveNostrSettings(this.settings.nostr).relays
|
|
38995
|
+
nostrRelays: () => effectiveNostrSettings(this.settings.nostr).relays,
|
|
38996
|
+
relayOnly: () => this.settings.relayOnly === true,
|
|
38997
|
+
own: () => this.ownProfileSubjects()
|
|
38818
38998
|
});
|
|
38819
38999
|
/** A contact's verified identity's posts and follows, asked when its card is chosen (PUBLIC-PROFILES.md, "Posts and follows"). */
|
|
38820
39000
|
publicActivity = new PublicActivity({
|
|
@@ -38822,17 +39002,20 @@ var GhostlyNode = class GhostlyNode {
|
|
|
38822
39002
|
online: () => this.networkOn,
|
|
38823
39003
|
eligible: () => this.profileSubjects(),
|
|
38824
39004
|
nostrRelays: () => effectiveNostrSettings(this.settings.nostr).relays,
|
|
38825
|
-
own: () =>
|
|
38826
|
-
|
|
38827
|
-
return this.identities.views().filter((p) => p.expiresAt > t).map((p) => ({
|
|
38828
|
-
provider: p.provider,
|
|
38829
|
-
subject: p.verified.subject
|
|
38830
|
-
}));
|
|
38831
|
-
},
|
|
39005
|
+
own: () => this.ownProfileSubjects(),
|
|
39006
|
+
relayOnly: () => this.settings.relayOnly === true,
|
|
38832
39007
|
contacts: () => this.contactSubjects(),
|
|
38833
39008
|
ownNostrFollows: () => this.nostrSocial.ownFollows(),
|
|
38834
39009
|
nostrMuted: (note, author) => this.nostrSocial.hides(note, author)
|
|
38835
39010
|
});
|
|
39011
|
+
/** The profile's own identities with a current proof. */
|
|
39012
|
+
ownProfileSubjects() {
|
|
39013
|
+
const t = Math.floor(Date.now() / 1e3);
|
|
39014
|
+
return this.identities.views().filter((p) => p.expiresAt > t).map((p) => ({
|
|
39015
|
+
provider: p.provider,
|
|
39016
|
+
subject: p.verified.subject
|
|
39017
|
+
}));
|
|
39018
|
+
}
|
|
38836
39019
|
/** What contacts shared that verifies now, with the chat it came in (paired chats only). */
|
|
38837
39020
|
contactSubjects() {
|
|
38838
39021
|
const t = Math.floor(Date.now() / 1e3);
|
|
@@ -39102,6 +39285,7 @@ var GhostlyNode = class GhostlyNode {
|
|
|
39102
39285
|
admin: !!view?.isAdmin
|
|
39103
39286
|
};
|
|
39104
39287
|
},
|
|
39288
|
+
notMember: (groupId) => this.groups.view(groupId)?.statusReason,
|
|
39105
39289
|
send: (groupId, edit, to) => this.groups.sendEdit(groupId, edit, to),
|
|
39106
39290
|
remove: (chat, id) => this.forgetGroupMessage(chat, id),
|
|
39107
39291
|
removeMine: async (chat, message, removal) => {
|
|
@@ -39545,6 +39729,7 @@ var GhostlyNode = class GhostlyNode {
|
|
|
39545
39729
|
const files = linkFilesFrom(stored.id, storedFiles, messages);
|
|
39546
39730
|
this.links.set(stored.id, newLiveLink(stored, messages[messages.length - 1]?.timestamp ?? 0, files));
|
|
39547
39731
|
this.links.get(stored.id).waitingSends = Promise.resolve(new Set(messages.filter(waitsForLive).map((m) => m.id)));
|
|
39732
|
+
this.links.get(stored.id).cardsDue = Promise.resolve(new Set(messages.filter(cardDue).map((m) => m.id)));
|
|
39548
39733
|
this.links.get(stored.id).pkarrSeenAt = pkarrSeenAt(messages);
|
|
39549
39734
|
for (const message of messages.slice(-20)) this.clockSample(message);
|
|
39550
39735
|
const note = latestReaction(messages);
|
|
@@ -41469,7 +41654,11 @@ var GhostlyNode = class GhostlyNode {
|
|
|
41469
41654
|
}
|
|
41470
41655
|
};
|
|
41471
41656
|
}
|
|
41472
|
-
if (!original && !group) {
|
|
41657
|
+
if (!original && !group && live) {
|
|
41658
|
+
const id = (await this.unkeyedRowsOf(this.links.get(message.linkId))).get(reply.id);
|
|
41659
|
+
const row = id === void 0 || id === message.id ? void 0 : await db.getMessage(message.linkId, id);
|
|
41660
|
+
if (row && replyRef(row) === reply.id) original = row;
|
|
41661
|
+
} else if (!original && !group) {
|
|
41473
41662
|
history = await db.getMessages(message.linkId);
|
|
41474
41663
|
original = history.find((m) => m.id !== message.id && replyRef(m) === reply.id);
|
|
41475
41664
|
}
|
|
@@ -41644,6 +41833,7 @@ var GhostlyNode = class GhostlyNode {
|
|
|
41644
41833
|
const live = this.links.get(linkId);
|
|
41645
41834
|
if (!live?.stored.profile || live.stored.group) return false;
|
|
41646
41835
|
const id = `peer_${edit.id}`;
|
|
41836
|
+
if (isRefusalId(id)) return true;
|
|
41647
41837
|
const ref = edit.rm && !await this.namesMine(linkId, edit.id);
|
|
41648
41838
|
if (live.stored.deletedIds?.includes(id)) {
|
|
41649
41839
|
if (ref) {
|
|
@@ -41713,7 +41903,14 @@ var GhostlyNode = class GhostlyNode {
|
|
|
41713
41903
|
*/
|
|
41714
41904
|
async cardWentBare(linkId, message) {
|
|
41715
41905
|
if (!message.card || message.cardRestore || message.buttonsRestore) return;
|
|
41716
|
-
await db.patchMessage(linkId, message.id, (current) => current.sender === "me" && current.card && !current.cardRestore && !current.buttonsRestore ? { cardRestore: "due" } : null);
|
|
41906
|
+
if (await db.patchMessage(linkId, message.id, (current) => current.sender === "me" && current.card && !current.cardRestore && !current.buttonsRestore ? { cardRestore: "due" } : null)) this.links.get(linkId)?.cardsDue?.then((known) => known.add(message.id), () => {});
|
|
41907
|
+
}
|
|
41908
|
+
/** `cardsDue`: a chat loaded at the start has them from that read; any other reads its history once in a run. */
|
|
41909
|
+
cardsDueOf(live) {
|
|
41910
|
+
return live.cardsDue ??= db.getMessages(live.stored.id).then((history) => new Set(history.filter(cardDue).map((m) => m.id)), (error) => {
|
|
41911
|
+
live.cardsDue = void 0;
|
|
41912
|
+
throw error;
|
|
41913
|
+
});
|
|
41717
41914
|
}
|
|
41718
41915
|
/** The session capability a contact's app lists when it shows a card of this kind, so a restore edit reads as a card there. */
|
|
41719
41916
|
static cardCapability(card) {
|
|
@@ -41737,7 +41934,12 @@ var GhostlyNode = class GhostlyNode {
|
|
|
41737
41934
|
const live = this.links.get(linkId), link = live?.link;
|
|
41738
41935
|
const offers = link?.sessionOffers.peer;
|
|
41739
41936
|
if (!live?.stored.profile || live.stored.group || !link?.supportsEdits || !offers) return;
|
|
41937
|
+
const due = await this.cardsDueOf(live);
|
|
41938
|
+
if (!due.size) return;
|
|
41939
|
+
const asked = new Set(due);
|
|
41740
41940
|
const mine = (await db.getMessages(linkId)).filter((m) => m.sender === "me").sort((a, b) => b.timestamp - a.timestamp);
|
|
41941
|
+
for (const id of asked) due.delete(id);
|
|
41942
|
+
for (const message of mine) if (cardDue(message)) due.add(message.id);
|
|
41741
41943
|
const since = Date.now() - CARD_RESTORE_MS;
|
|
41742
41944
|
const changed = [];
|
|
41743
41945
|
const cards = /* @__PURE__ */ new Set();
|
|
@@ -41750,7 +41952,7 @@ var GhostlyNode = class GhostlyNode {
|
|
|
41750
41952
|
const stale = superseded || kept++ >= CARD_RESTORE_MOST || message.timestamp < since;
|
|
41751
41953
|
if (!stale && message.card && !offers.includes(GhostlyNode.cardCapability(message.card))) continue;
|
|
41752
41954
|
const at = Date.now();
|
|
41753
|
-
|
|
41955
|
+
const patched = await db.patchMessage(linkId, message.id, (current) => {
|
|
41754
41956
|
if (current.sender !== "me" || (current.cardRestore ?? current.buttonsRestore) !== "due") return null;
|
|
41755
41957
|
const done = {
|
|
41756
41958
|
cardRestore: "sent",
|
|
@@ -41773,7 +41975,9 @@ var GhostlyNode = class GhostlyNode {
|
|
|
41773
41975
|
},
|
|
41774
41976
|
...done
|
|
41775
41977
|
};
|
|
41776
|
-
})
|
|
41978
|
+
});
|
|
41979
|
+
due.delete(message.id);
|
|
41980
|
+
if (patched?.edit?.pending) {
|
|
41777
41981
|
changed.push(message.id);
|
|
41778
41982
|
this.editsFor(linkId).edited(message.id);
|
|
41779
41983
|
}
|
|
@@ -42835,6 +43039,16 @@ var GhostlyNode = class GhostlyNode {
|
|
|
42835
43039
|
}
|
|
42836
43040
|
if (waiting.length) await this.messagesChanged(linkId, waiting.map((m) => m.id));
|
|
42837
43041
|
}
|
|
43042
|
+
/** The rows of a chat a reply names by another id than their own (`unkeyedRef`), read once in a run. */
|
|
43043
|
+
unkeyedRowsOf(live) {
|
|
43044
|
+
return live.unkeyedRows ??= db.getMessages(live.stored.id).then((history) => new Map(history.flatMap((m) => {
|
|
43045
|
+
const ref = unkeyedRef(m);
|
|
43046
|
+
return ref ? [[ref, m.id]] : [];
|
|
43047
|
+
})), (error) => {
|
|
43048
|
+
live.unkeyedRows = void 0;
|
|
43049
|
+
throw error;
|
|
43050
|
+
});
|
|
43051
|
+
}
|
|
42838
43052
|
/**
|
|
42839
43053
|
* The ids of my messages that wait for the live link (`waitsForLive`). A chat loaded at the start has them from that
|
|
42840
43054
|
* read; any other reads its history once in a run. A session that opens then reads those rows, however long the chat.
|
|
@@ -43473,7 +43687,7 @@ var GhostlyNode = class GhostlyNode {
|
|
|
43473
43687
|
note(check.error);
|
|
43474
43688
|
continue;
|
|
43475
43689
|
}
|
|
43476
|
-
const original = message.file,
|
|
43690
|
+
const original = message.file, picked = {
|
|
43477
43691
|
id: groupFileId(groupId, "out"),
|
|
43478
43692
|
name: original.name,
|
|
43479
43693
|
size: original.size,
|
|
@@ -43482,11 +43696,11 @@ var GhostlyNode = class GhostlyNode {
|
|
|
43482
43696
|
...original.video && { video: original.video },
|
|
43483
43697
|
...original.image && { image: original.image }
|
|
43484
43698
|
};
|
|
43485
|
-
await copyForForward(original.id, {
|
|
43699
|
+
const file = await copyForForward(original.id, {
|
|
43486
43700
|
linkId: to,
|
|
43487
|
-
wireId:
|
|
43701
|
+
wireId: picked.id.slice(`group-${groupId}-out-`.length),
|
|
43488
43702
|
timestamp: now(),
|
|
43489
|
-
file
|
|
43703
|
+
file: picked
|
|
43490
43704
|
});
|
|
43491
43705
|
const sent = await this.sendGroupFile({
|
|
43492
43706
|
groupId,
|
|
@@ -43507,7 +43721,7 @@ var GhostlyNode = class GhostlyNode {
|
|
|
43507
43721
|
continue;
|
|
43508
43722
|
}
|
|
43509
43723
|
const original = message.file, wireId = toBase64Url(randomBytes(12)), timestamp = now();
|
|
43510
|
-
const
|
|
43724
|
+
const picked = {
|
|
43511
43725
|
id: GhostlyNode.outgoingFileId(to, wireId),
|
|
43512
43726
|
name: original.name,
|
|
43513
43727
|
size: original.size,
|
|
@@ -43516,11 +43730,11 @@ var GhostlyNode = class GhostlyNode {
|
|
|
43516
43730
|
...original.video && { video: original.video },
|
|
43517
43731
|
...original.image && { image: original.image }
|
|
43518
43732
|
};
|
|
43519
|
-
await copyForForward(original.id, {
|
|
43733
|
+
const file = await copyForForward(original.id, {
|
|
43520
43734
|
linkId: to,
|
|
43521
43735
|
wireId,
|
|
43522
43736
|
timestamp,
|
|
43523
|
-
file
|
|
43737
|
+
file: picked
|
|
43524
43738
|
});
|
|
43525
43739
|
try {
|
|
43526
43740
|
await this.sendFile({
|
|
@@ -45115,7 +45329,7 @@ var GhostlyNode = class GhostlyNode {
|
|
|
45115
45329
|
if (settings.relays && (this.relays || this.transport.configure) && !settings.relays.some((relay) => normalizeRelayUrl(relay))) throw new Error("Enter at least one relay address (https://…)");
|
|
45116
45330
|
if (settings.readRelays !== void 0 && typeof settings.readRelays !== "boolean") throw new Error("readRelays is on or off");
|
|
45117
45331
|
if (settings.irohRelays) {
|
|
45118
|
-
if (settings.irohRelays.length >
|
|
45332
|
+
if (settings.irohRelays.length > 5) throw new Error("Use at most five Iroh relays");
|
|
45119
45333
|
for (const relay of settings.irohRelays) {
|
|
45120
45334
|
const problem = irohRelayProblem(relay);
|
|
45121
45335
|
if (problem) throw new Error(problem);
|
|
@@ -45241,6 +45455,7 @@ var GhostlyNode = class GhostlyNode {
|
|
|
45241
45455
|
this.did.publishNow().catch(() => {});
|
|
45242
45456
|
if (!this.options.singleDevice && knownDeviceGate()?.state === "active") this.startDeviceSet({ justRead: true }).catch(() => {});
|
|
45243
45457
|
} else if (wasOnline && this.networkOn && relayOnlyChanged) await this.restartLinksForRelayOnly();
|
|
45458
|
+
if (relayOnlyChanged && this.settings.relayOnly !== true) this.hold.wake();
|
|
45244
45459
|
if (wasOnline && !this.networkOn) this.stopGroupEntries();
|
|
45245
45460
|
if (wasOnline && !this.networkOn) await this.hold.stop();
|
|
45246
45461
|
const gate = knownDeviceGate();
|
|
@@ -46283,6 +46498,7 @@ var GhostlyNode = class GhostlyNode {
|
|
|
46283
46498
|
live.carried?.stop();
|
|
46284
46499
|
live.carried = entry || this.groups.isCommunityGroup(group) ? void 0 : new CarriedTransport(this.groupTransport, live.myPubKeyZ32, stored.peerPubKeyZ32, {
|
|
46285
46500
|
carry: (payload) => this.groups.carrySignal(group, peer, payload),
|
|
46501
|
+
canCarry: () => this.groups.canCarrySignal(group, peer),
|
|
46286
46502
|
open: () => !!live.link?.isDataLinkOpen,
|
|
46287
46503
|
look: () => live.link?.look(),
|
|
46288
46504
|
direct: (payload) => this.groups.directSignal(group, peer, linkId, payload),
|
|
@@ -47118,7 +47334,7 @@ var GhostlyNode = class GhostlyNode {
|
|
|
47118
47334
|
nativeFactoriesFor(relayOnly) {
|
|
47119
47335
|
const relay = relayOnly || this.relaysHyperdhtNatively ? this.hyperdhtRelay : "";
|
|
47120
47336
|
return {
|
|
47121
|
-
...relay ? { "hyperdht/1": async (seedB64) => (await import("./hyperdhtRelay-
|
|
47337
|
+
...relay ? { "hyperdht/1": async (seedB64) => (await import("./hyperdhtRelay-B8Pdykhg.js")).createRelayedHyperEndpoint(seedB64, relay) } : {},
|
|
47122
47338
|
...relayOnly ? {} : this.options.nativeTransports,
|
|
47123
47339
|
...this.ownIrohRelays && !relayOnly ? { "iroh/1": (seedB64) => this.options.nativeTransports["iroh/1"](seedB64, this.settings.irohRelays?.length ? { relays: [...this.settings.irohRelays] } : {}) } : {},
|
|
47124
47340
|
...this.options.irohWeb ? { "iroh/1": (seedB64) => createIrohWebEndpoint(seedB64, { relays: this.irohRelays }) } : {}
|
|
@@ -47340,8 +47556,8 @@ var GhostlyNode = class GhostlyNode {
|
|
|
47340
47556
|
const expected = this.links.get(linkId)?.link;
|
|
47341
47557
|
const starts = Object.entries(this.nativeFactories).map(([transport, factory]) => {
|
|
47342
47558
|
const key = transport;
|
|
47343
|
-
const operation =
|
|
47344
|
-
this.nativeQueues.set(key, operation.then(() => {}, () => {}));
|
|
47559
|
+
const operation = this.nativeTurn(key, linkId, inUse).then(() => factory ? this.startNativeEndpoint(linkId, expected, key, factory, inUse) : false).finally(() => this.nextNativeTurn(key, true));
|
|
47560
|
+
this.nativeQueues.set(key, Promise.all([this.nativeQueues.get(key), operation.then(() => {}, () => {})]).then(() => {}));
|
|
47345
47561
|
return operation;
|
|
47346
47562
|
});
|
|
47347
47563
|
return Promise.all(starts).then((full) => {
|
|
@@ -47362,6 +47578,41 @@ var GhostlyNode = class GhostlyNode {
|
|
|
47362
47578
|
this.emitState();
|
|
47363
47579
|
});
|
|
47364
47580
|
}
|
|
47581
|
+
/**
|
|
47582
|
+
* A start's turn in its transport's queue: one at a time, in the order asked, but the chat in use (on screen, a text
|
|
47583
|
+
* going or coming in it, an edge of the group on screen) goes before the others waiting. With the relay out of reach
|
|
47584
|
+
* each start takes 10 s to fail, and the chat opened waited for every other chat's retry before its own started or
|
|
47585
|
+
* said why: 331 s with 40 chats.
|
|
47586
|
+
*/
|
|
47587
|
+
nativeTurn(key, linkId, inUse) {
|
|
47588
|
+
let lane = this.nativeTurns.get(key);
|
|
47589
|
+
if (!lane) this.nativeTurns.set(key, lane = {
|
|
47590
|
+
busy: false,
|
|
47591
|
+
waiting: []
|
|
47592
|
+
});
|
|
47593
|
+
const turn = new Promise((go) => lane.waiting.push({
|
|
47594
|
+
linkId,
|
|
47595
|
+
inUse,
|
|
47596
|
+
go
|
|
47597
|
+
}));
|
|
47598
|
+
this.nextNativeTurn(key);
|
|
47599
|
+
return turn;
|
|
47600
|
+
}
|
|
47601
|
+
/** `ended`: the start under way ended. The next one waiting starts: the first in use, or else the first asked. */
|
|
47602
|
+
nextNativeTurn(key, ended = false) {
|
|
47603
|
+
const lane = this.nativeTurns.get(key);
|
|
47604
|
+
if (!lane) return;
|
|
47605
|
+
if (ended) lane.busy = false;
|
|
47606
|
+
if (lane.busy || !lane.waiting.length) return;
|
|
47607
|
+
const onScreen = (linkId) => {
|
|
47608
|
+
const stored = this.links.get(linkId)?.stored;
|
|
47609
|
+
return !!stored && (stored.group ? `group:${stored.group}` : stored.id) === this.activeLinkId;
|
|
47610
|
+
};
|
|
47611
|
+
const next = lane.waiting.findIndex((start) => start.inUse || onScreen(start.linkId));
|
|
47612
|
+
const [start] = lane.waiting.splice(Math.max(next, 0), 1);
|
|
47613
|
+
lane.busy = true;
|
|
47614
|
+
start.go();
|
|
47615
|
+
}
|
|
47365
47616
|
/** The listeners this app may hold for a transport: sixteen for Iroh's browser build (`IROH_WEB_SLOTS`), eight for the others. */
|
|
47366
47617
|
nativeSlots(key) {
|
|
47367
47618
|
return key === "iroh/1" && this.options.irohWeb ? IROH_WEB_SLOTS : NATIVE_SLOTS;
|
|
@@ -47557,6 +47808,8 @@ var GhostlyNode = class GhostlyNode {
|
|
|
47557
47808
|
groupNativeRetryAt = 0;
|
|
47558
47809
|
/** Chats and group links whose native listener failed to start, by link id: when each tries again, and how long it waited last. */
|
|
47559
47810
|
nativeFailed = /* @__PURE__ */ new Map();
|
|
47811
|
+
/** Of those, the ones whose start is queued or under way: a transport's starts go one after another. */
|
|
47812
|
+
nativeRetrying = /* @__PURE__ */ new Set();
|
|
47560
47813
|
/**
|
|
47561
47814
|
* Now and then, the group links that found no free native slot try again: a chat or another group may have let one go.
|
|
47562
47815
|
* Chats and group links whose listener failed to start try again once their wait is over.
|
|
@@ -47565,13 +47818,14 @@ var GhostlyNode = class GhostlyNode {
|
|
|
47565
47818
|
this.groupAnchorsAnswered();
|
|
47566
47819
|
const now = Date.now();
|
|
47567
47820
|
for (const [linkId, failed] of this.nativeFailed) {
|
|
47568
|
-
if (now < failed.at) continue;
|
|
47821
|
+
if (now < failed.at || this.nativeRetrying.has(linkId)) continue;
|
|
47569
47822
|
if (!this.links.get(linkId)?.link) {
|
|
47570
47823
|
this.nativeFailed.delete(linkId);
|
|
47571
47824
|
continue;
|
|
47572
47825
|
}
|
|
47573
47826
|
failed.at = now + failed.wait;
|
|
47574
|
-
this.
|
|
47827
|
+
this.nativeRetrying.add(linkId);
|
|
47828
|
+
this.ensureNativeEndpoints(linkId).finally(() => this.nativeRetrying.delete(linkId));
|
|
47575
47829
|
}
|
|
47576
47830
|
if (!this.groupNativeWaiting.size || Date.now() < this.groupNativeRetryAt) return;
|
|
47577
47831
|
this.groupNativeRetryAt = Date.now() + NATIVE_RETRY_MS;
|
|
@@ -47735,6 +47989,7 @@ var GhostlyNode = class GhostlyNode {
|
|
|
47735
47989
|
* straight from its author (`clockSample`). `place`: as `placed`.
|
|
47736
47990
|
*/
|
|
47737
47991
|
async storeNewMessage(message, straight = false, place) {
|
|
47992
|
+
if (message.sender === "peer" && !message.notice && isRefusalId(message.id)) return false;
|
|
47738
47993
|
const edge = this.links.get(message.linkId)?.stored;
|
|
47739
47994
|
if (edge?.group && edge.groupPeer && !edge.groupEntry) message = {
|
|
47740
47995
|
...message,
|
|
@@ -47780,6 +48035,9 @@ var GhostlyNode = class GhostlyNode {
|
|
|
47780
48035
|
}
|
|
47781
48036
|
if (!await db.addMessage(message)) return false;
|
|
47782
48037
|
if (live && waitsForLive(message)) live.waitingSends?.then((known) => known.add(message.id), () => {});
|
|
48038
|
+
const unkeyed = live && !live.stored.group && unkeyedRef(message);
|
|
48039
|
+
if (unkeyed) live.unkeyedRows?.then((rows) => rows.set(unkeyed, message.id), () => {});
|
|
48040
|
+
if (live && cardDue(message)) live.cardsDue?.then((due) => due.add(message.id), () => {});
|
|
47783
48041
|
this.clockSample(message, straight);
|
|
47784
48042
|
const newest = this.newestAt.get(message.linkId);
|
|
47785
48043
|
if (!message.event) this.newestAt.set(message.linkId, Math.max(newest ?? 0, writtenAt(message, this.clockLeads.get(this.clockOf(message)))));
|
|
@@ -48247,4 +48505,4 @@ function signalKind(signal) {
|
|
|
48247
48505
|
//#endregion
|
|
48248
48506
|
export { EngineServer };
|
|
48249
48507
|
|
|
48250
|
-
//# sourceMappingURL=server-
|
|
48508
|
+
//# sourceMappingURL=server-Br3XPwFG.js.map
|