@pkcprotocol/pkc-js 0.0.73 → 0.0.74
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 +1 -0
- package/dist/browser/clients/base-client-manager.d.ts +1 -0
- package/dist/browser/clients/base-client-manager.js +9 -2
- package/dist/browser/clients/base-client-manager.js.map +1 -1
- package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +1 -0
- package/dist/browser/clients/rpc-client/schema.d.ts +1 -0
- package/dist/browser/community/community-client-manager.d.ts +1 -0
- package/dist/browser/community/community-client-manager.js +7 -0
- package/dist/browser/community/community-client-manager.js.map +1 -1
- package/dist/browser/community/remote-community.js +18 -9
- package/dist/browser/community/remote-community.js.map +1 -1
- package/dist/browser/community/schema.d.ts +6 -0
- package/dist/browser/community/schema.js +4 -1
- package/dist/browser/community/schema.js.map +1 -1
- package/dist/browser/community/types.d.ts +1 -0
- package/dist/browser/errors.d.ts +2 -0
- package/dist/browser/errors.js +2 -0
- package/dist/browser/errors.js.map +1 -1
- package/dist/browser/generated-version.d.ts +1 -1
- package/dist/browser/generated-version.js +1 -1
- package/dist/browser/pkc-error.d.ts +1 -1
- package/dist/browser/publications/community-edit/schema.d.ts +4 -0
- package/dist/browser/publications/publication.d.ts +2 -1
- package/dist/browser/publications/publication.js +63 -24
- package/dist/browser/publications/publication.js.map +1 -1
- package/dist/browser/pubsub-messages/schema.d.ts +2 -0
- package/dist/browser/runtime/node/community/db-handler.d.ts +1 -0
- package/dist/browser/runtime/node/community/local-community/challenges.js +26 -25
- package/dist/browser/runtime/node/community/local-community/challenges.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/comment-updates.d.ts +2 -1
- package/dist/browser/runtime/node/community/local-community/comment-updates.js +14 -2
- package/dist/browser/runtime/node/community/local-community/comment-updates.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/db-state.js +12 -1
- package/dist/browser/runtime/node/community/local-community/db-state.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/ipns-publishing.js +22 -1
- package/dist/browser/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/lifecycle.js +17 -5
- package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/pubsub.js +42 -4
- package/dist/browser/runtime/node/community/local-community/pubsub.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community.d.ts +1 -0
- package/dist/browser/runtime/node/community/local-community.js +10 -1
- package/dist/browser/runtime/node/community/local-community.js.map +1 -1
- package/dist/browser/schema/schema-util.d.ts +4 -0
- package/dist/browser/signer/signatures.d.ts +4 -4
- package/dist/browser/signer/signatures.js +23 -4
- package/dist/browser/signer/signatures.js.map +1 -1
- package/dist/browser/test/test-util.d.ts +3 -0
- package/dist/browser/test/test-util.js +15 -1
- package/dist/browser/test/test-util.js.map +1 -1
- package/dist/bundled/bundle-manifest.json +25 -25
- package/dist/bundled/chunks/{helia-for-pkc-DooZDxJi.js → helia-for-pkc-B-75U9z9.js} +2 -2
- package/dist/bundled/chunks/{local-community-DLVCXKMM.js → local-community-Br1ipu1Z.js} +92 -55
- package/dist/bundled/chunks/{local-community-EFv2VpQI.js → local-community-CIVs_iuS.js} +1 -1
- package/dist/bundled/chunks/{node-Dpuw7iSW.js → node-Cn7VaPDJ.js} +53 -27
- package/dist/bundled/chunks/{rpc-local-community-8CqOzaX3.js → rpc-local-community-DtdeJBOq.js} +38 -27
- package/dist/bundled/chunks/{schema-DMHTAMSM.js → schema-B1Ot-kux.js} +5 -2
- package/dist/bundled/chunks/{util-hdyyy-HI.js → util-B6v5HAdy.js} +1 -1
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/rpc/src/index.js +4 -4
- package/dist/node/clients/base-client-manager.d.ts +1 -0
- package/dist/node/clients/base-client-manager.js +9 -2
- package/dist/node/clients/base-client-manager.js.map +1 -1
- package/dist/node/clients/rpc-client/rpc-schema-util.d.ts +1 -0
- package/dist/node/clients/rpc-client/schema.d.ts +1 -0
- package/dist/node/community/community-client-manager.d.ts +1 -0
- package/dist/node/community/community-client-manager.js +7 -0
- package/dist/node/community/community-client-manager.js.map +1 -1
- package/dist/node/community/remote-community.js +18 -9
- package/dist/node/community/remote-community.js.map +1 -1
- package/dist/node/community/schema.d.ts +6 -0
- package/dist/node/community/schema.js +4 -1
- package/dist/node/community/schema.js.map +1 -1
- package/dist/node/community/types.d.ts +1 -0
- package/dist/node/errors.d.ts +2 -0
- package/dist/node/errors.js +2 -0
- package/dist/node/errors.js.map +1 -1
- package/dist/node/generated-version.d.ts +1 -1
- package/dist/node/generated-version.js +1 -1
- package/dist/node/pkc-error.d.ts +1 -1
- package/dist/node/publications/community-edit/schema.d.ts +4 -0
- package/dist/node/publications/publication.d.ts +2 -1
- package/dist/node/publications/publication.js +63 -24
- package/dist/node/publications/publication.js.map +1 -1
- package/dist/node/pubsub-messages/schema.d.ts +2 -0
- package/dist/node/runtime/node/community/db-handler.d.ts +1 -0
- package/dist/node/runtime/node/community/local-community/challenges.js +26 -25
- package/dist/node/runtime/node/community/local-community/challenges.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/comment-updates.d.ts +2 -1
- package/dist/node/runtime/node/community/local-community/comment-updates.js +14 -2
- package/dist/node/runtime/node/community/local-community/comment-updates.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/db-state.js +12 -1
- package/dist/node/runtime/node/community/local-community/db-state.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/ipns-publishing.js +22 -1
- package/dist/node/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/lifecycle.js +17 -5
- package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/pubsub.js +42 -4
- package/dist/node/runtime/node/community/local-community/pubsub.js.map +1 -1
- package/dist/node/runtime/node/community/local-community.d.ts +1 -0
- package/dist/node/runtime/node/community/local-community.js +10 -1
- package/dist/node/runtime/node/community/local-community.js.map +1 -1
- package/dist/node/schema/schema-util.d.ts +4 -0
- package/dist/node/signer/signatures.d.ts +4 -4
- package/dist/node/signer/signatures.js +23 -4
- package/dist/node/signer/signatures.js.map +1 -1
- package/dist/node/test/test-util.d.ts +3 -0
- package/dist/node/test/test-util.js +15 -1
- package/dist/node/test/test-util.js.map +1 -1
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"node:module"
|
|
15
15
|
],
|
|
16
16
|
"dynamicImports": [
|
|
17
|
-
"chunks/node-
|
|
17
|
+
"chunks/node-Cn7VaPDJ.js"
|
|
18
18
|
],
|
|
19
19
|
"inputs": [
|
|
20
20
|
"dist/node/runtime/node/compile-cache.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"index.js": {
|
|
25
25
|
"isEntry": true,
|
|
26
26
|
"imports": [
|
|
27
|
-
"chunks/node-
|
|
27
|
+
"chunks/node-Cn7VaPDJ.js"
|
|
28
28
|
],
|
|
29
29
|
"dynamicImports": [],
|
|
30
30
|
"inputs": []
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"rpc/src/index.js": {
|
|
33
33
|
"isEntry": true,
|
|
34
34
|
"imports": [
|
|
35
|
-
"chunks/rpc-local-community-
|
|
36
|
-
"chunks/node-
|
|
37
|
-
"chunks/schema-
|
|
38
|
-
"chunks/local-community-
|
|
35
|
+
"chunks/rpc-local-community-DtdeJBOq.js",
|
|
36
|
+
"chunks/node-Cn7VaPDJ.js",
|
|
37
|
+
"chunks/schema-B1Ot-kux.js",
|
|
38
|
+
"chunks/local-community-Br1ipu1Z.js",
|
|
39
39
|
"node:url",
|
|
40
40
|
"path",
|
|
41
41
|
"assert",
|
|
@@ -64,11 +64,11 @@
|
|
|
64
64
|
"\u0000rolldown/runtime.js"
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
|
-
"chunks/helia-for-pkc-
|
|
67
|
+
"chunks/helia-for-pkc-B-75U9z9.js": {
|
|
68
68
|
"isEntry": false,
|
|
69
69
|
"imports": [
|
|
70
|
-
"chunks/schema-
|
|
71
|
-
"chunks/util-
|
|
70
|
+
"chunks/schema-B1Ot-kux.js",
|
|
71
|
+
"chunks/util-B6v5HAdy.js",
|
|
72
72
|
"multiformats/cid",
|
|
73
73
|
"@libp2p/peer-id",
|
|
74
74
|
"events",
|
|
@@ -94,12 +94,12 @@
|
|
|
94
94
|
"dist/node/helia/helia-for-pkc.js"
|
|
95
95
|
]
|
|
96
96
|
},
|
|
97
|
-
"chunks/local-community-
|
|
97
|
+
"chunks/local-community-Br1ipu1Z.js": {
|
|
98
98
|
"isEntry": false,
|
|
99
99
|
"imports": [
|
|
100
100
|
"chunks/chunk-2rV9d50f.js",
|
|
101
|
-
"chunks/rpc-local-community-
|
|
102
|
-
"chunks/schema-
|
|
101
|
+
"chunks/rpc-local-community-DtdeJBOq.js",
|
|
102
|
+
"chunks/schema-B1Ot-kux.js",
|
|
103
103
|
"node:crypto",
|
|
104
104
|
"node:url",
|
|
105
105
|
"node:path",
|
|
@@ -152,21 +152,21 @@
|
|
|
152
152
|
"dist/node/runtime/node/community/local-community.js"
|
|
153
153
|
]
|
|
154
154
|
},
|
|
155
|
-
"chunks/local-community-
|
|
155
|
+
"chunks/local-community-CIVs_iuS.js": {
|
|
156
156
|
"isEntry": false,
|
|
157
157
|
"imports": [
|
|
158
|
-
"chunks/local-community-
|
|
158
|
+
"chunks/local-community-Br1ipu1Z.js"
|
|
159
159
|
],
|
|
160
160
|
"dynamicImports": [],
|
|
161
161
|
"inputs": []
|
|
162
162
|
},
|
|
163
|
-
"chunks/node-
|
|
163
|
+
"chunks/node-Cn7VaPDJ.js": {
|
|
164
164
|
"isEntry": false,
|
|
165
165
|
"imports": [
|
|
166
166
|
"chunks/chunk-2rV9d50f.js",
|
|
167
|
-
"chunks/rpc-local-community-
|
|
168
|
-
"chunks/schema-
|
|
169
|
-
"chunks/util-
|
|
167
|
+
"chunks/rpc-local-community-DtdeJBOq.js",
|
|
168
|
+
"chunks/schema-B1Ot-kux.js",
|
|
169
|
+
"chunks/util-B6v5HAdy.js",
|
|
170
170
|
"path",
|
|
171
171
|
"assert",
|
|
172
172
|
"fs",
|
|
@@ -177,8 +177,8 @@
|
|
|
177
177
|
"rpc-websockets"
|
|
178
178
|
],
|
|
179
179
|
"dynamicImports": [
|
|
180
|
-
"chunks/helia-for-pkc-
|
|
181
|
-
"chunks/local-community-
|
|
180
|
+
"chunks/helia-for-pkc-B-75U9z9.js",
|
|
181
|
+
"chunks/local-community-Br1ipu1Z.js"
|
|
182
182
|
],
|
|
183
183
|
"inputs": [
|
|
184
184
|
"node_modules/zod/v4/locales/en.js",
|
|
@@ -231,11 +231,11 @@
|
|
|
231
231
|
"dist/node/index.js"
|
|
232
232
|
]
|
|
233
233
|
},
|
|
234
|
-
"chunks/rpc-local-community-
|
|
234
|
+
"chunks/rpc-local-community-DtdeJBOq.js": {
|
|
235
235
|
"isEntry": false,
|
|
236
236
|
"imports": [
|
|
237
237
|
"chunks/chunk-2rV9d50f.js",
|
|
238
|
-
"chunks/schema-
|
|
238
|
+
"chunks/schema-B1Ot-kux.js",
|
|
239
239
|
"chunks/src-CYIMjhjK.js",
|
|
240
240
|
"node:http",
|
|
241
241
|
"node:crypto",
|
|
@@ -791,7 +791,7 @@
|
|
|
791
791
|
"dist/node/community/rpc-local-community.js"
|
|
792
792
|
]
|
|
793
793
|
},
|
|
794
|
-
"chunks/schema-
|
|
794
|
+
"chunks/schema-B1Ot-kux.js": {
|
|
795
795
|
"isEntry": false,
|
|
796
796
|
"imports": [
|
|
797
797
|
"chunks/chunk-2rV9d50f.js",
|
|
@@ -1228,10 +1228,10 @@
|
|
|
1228
1228
|
"node_modules/ipfs-unixfs-importer/dist/src/index.js"
|
|
1229
1229
|
]
|
|
1230
1230
|
},
|
|
1231
|
-
"chunks/util-
|
|
1231
|
+
"chunks/util-B6v5HAdy.js": {
|
|
1232
1232
|
"isEntry": false,
|
|
1233
1233
|
"imports": [
|
|
1234
|
-
"chunks/schema-
|
|
1234
|
+
"chunks/schema-B1Ot-kux.js",
|
|
1235
1235
|
"ipns/selector",
|
|
1236
1236
|
"uint8arrays/equals"
|
|
1237
1237
|
],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, _r as PKCError, yr as logger_default } from "./schema-
|
|
2
|
-
import { a as fetchBlockWithStalledSessionFailover, i as directFetchIpnsRecordFromProviders, n as cacheIpnsRecordInPubsubLocalStore, o as getHeliaDebugContext, r as connectToPubsubPeers, s as selectBitswapSessionSeedPeers } from "./util-
|
|
1
|
+
import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, _r as PKCError, yr as logger_default } from "./schema-B1Ot-kux.js";
|
|
2
|
+
import { a as fetchBlockWithStalledSessionFailover, i as directFetchIpnsRecordFromProviders, n as cacheIpnsRecordInPubsubLocalStore, o as getHeliaDebugContext, r as connectToPubsubPeers, s as selectBitswapSessionSeedPeers } from "./util-B6v5HAdy.js";
|
|
3
3
|
import { CID } from "multiformats/cid";
|
|
4
4
|
import { peerIdFromString } from "@libp2p/peer-id";
|
|
5
5
|
import { EventEmitter as EventEmitter$1 } from "events";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $ as pubsubTopicToDhtKey, $n as t$7, At as trackStartedCommunity, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, En as CommentUpdateSchema, F as getIpnsRecordInLocalKuboNode, Fn as CommentEditPubsubMessagePublicationSchema, Ft as untrackUpdatingCommunity, G as isLinkOfAudio, Gt as CommentModerationPubsubMessagePublicationSchema, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256, J as isLinkOfVideo, Jt as CommentModerationsTableRowSchema, K as isLinkOfImage, Kt as CommentModerationReservedFields, L as hideClassPrivateProps, Ln as CommentEditReservedFields, M as genToArray, Mr as ZodError, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateTableRowSchema, P as getErrorCodeFromMessage, Q as isStringDomain, Qn as n$3, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, Un as AuthorReservedFields, W as isLinkOfAnimatedImage, Xn as n$4, Y as isLinkValid, Zn as t$8, _r as PKCError, _t as timestamp, a as ChallengeRequestMessageSchema, ar as t$4, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bt as findCommunityInRegistry, cr as t$5, d as DecryptedChallengeRequestSchema, dr as require_retry, dt as retryKuboIpfsAddAndProvide, er as t$6, fn as VotePubsubMessagePublicationSchema, hn as VoteTablesRowSchema, ht as statMfsPathSafely, ir as r$1, k as doesDomainAddressHaveCapitalLetter, kn as CommentsTableRowSchema, kt as syncCommunityRegistryEntry, lr as t$3, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nr as e$1, nt as removeBlocksFromKuboNode, pn as VotePubsubReservedFields, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunitySignedPropertyNames, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, t as ChallengeAnswerMessageSchema, tr as e, u as DecryptedChallengeRequestPublicationSchema, vn as CommentIpfsSchema, vr as messages, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xt as findStartedCommunity, y as version_default, yn as CommentPubsubMessageReservedFields, yr as logger_default, yt as writeKuboFilesWithTimeout, zn as CommentEditsTableRowSchema } from "./schema-
|
|
3
|
-
import { $n as t$10, A as deriveDbPosts, At as verifyCommunityEdit, Bt as getCommunityPublicKeyFromWire, C as BackupAbortError, Dt as verifyCommentPubsubMessage, E as calculateInlineRepliesBudget, Et as verifyCommentModeration, F as importSignerIntoKuboNode, Ft as getAuthorNameFromWire, G as REPLY_REPLIES_SORT_TYPES, Gt as getIpfsKeyFromPrivateKey, Ht as decode, Jn as r$2, Jt as getPublicKeyFromPrivateKey, K as TIMEFRAMES_TO_SECONDS, Kn as t$9, Kt as getPKCAddressFromPublicKey, M as getDefaultCommunityDbConfig, Mt as buildRuntimeAuthor, Nt as cleanWireAuthor, O as deleteOldCommunityInWindows, Ot as verifyCommentUpdate, P as getThumbnailPropsOfLink, R as moveCommunityDbToDeletedDirectory, S as encryptEd25519AesGcmPublicKeyBuffer, St as verifyChallengeRequest, T as calculateExpectedSignatureSize, Tt as verifyCommentIpfs, U as POSTS_SORT_TYPES, Ut as encode, W as POST_REPLIES_SORT_TYPES, Xn as n$6, Yn as t$11, Yt as createSchemaRowParser, Z as iterateOverPageCidsToFindAllCids, Zn as n$5, _ as SignerWithPublicKeyAddress, _t as signCommunity, a as pkcJsChallenges, b as decryptEd25519AesGcmPublicKeyBuffer, bt as verifyChallengeAnswer, cn as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, d as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, dt as signChallengeVerification, er as stringify, f as KeyvBetterSqlite3, ft as signComment, gt as signCommentUpdateForChallengeVerification, ht as signCommentUpdate, i as getCommunityChallengeFromCommunityChallengeSettings, it as pLimit, j as deriveDbReplies, jt as verifyVote, k as deriveCommentIpfsFromCommentTableRow, kt as verifyCommunity, l as normalizeSelfAddrsForProvider, lt as signChallengeMessage, nr as require_lodash_merge, o as TrackedInstanceRegistry, on as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, pt as signCommentEdit, qn as t$12, qt as getPKCAddressFromPublicKeySync, r as getChallengeVerification, s as LRUCache, st as cleanUpBeforePublishing, t as RpcLocalCommunity, tr as STORAGE_KEYS, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, w as backupCommunityDb, wt as verifyCommentEdit, xn as parseJsonWithPKCErrorIfFails, z as resolveDbPostsCidRefs, zt as getCommunityNameFromWire } from "./rpc-local-community-
|
|
2
|
+
import { $ as pubsubTopicToDhtKey, $n as t$7, At as trackStartedCommunity, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, En as CommentUpdateSchema, F as getIpnsRecordInLocalKuboNode, Fn as CommentEditPubsubMessagePublicationSchema, Ft as untrackUpdatingCommunity, G as isLinkOfAudio, Gt as CommentModerationPubsubMessagePublicationSchema, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256, J as isLinkOfVideo, Jt as CommentModerationsTableRowSchema, K as isLinkOfImage, Kt as CommentModerationReservedFields, L as hideClassPrivateProps, Ln as CommentEditReservedFields, M as genToArray, Mr as ZodError, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateTableRowSchema, P as getErrorCodeFromMessage, Q as isStringDomain, Qn as n$3, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, Un as AuthorReservedFields, W as isLinkOfAnimatedImage, Xn as n$4, Y as isLinkValid, Zn as t$8, _r as PKCError, _t as timestamp, a as ChallengeRequestMessageSchema, ar as t$4, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bt as findCommunityInRegistry, cr as t$5, d as DecryptedChallengeRequestSchema, dr as require_retry, dt as retryKuboIpfsAddAndProvide, er as t$6, fn as VotePubsubMessagePublicationSchema, hn as VoteTablesRowSchema, ht as statMfsPathSafely, ir as r$1, k as doesDomainAddressHaveCapitalLetter, kn as CommentsTableRowSchema, kt as syncCommunityRegistryEntry, lr as t$3, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nr as e$1, nt as removeBlocksFromKuboNode, pn as VotePubsubReservedFields, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunitySignedPropertyNames, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, t as ChallengeAnswerMessageSchema, tr as e, u as DecryptedChallengeRequestPublicationSchema, vn as CommentIpfsSchema, vr as messages, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xt as findStartedCommunity, y as version_default, yn as CommentPubsubMessageReservedFields, yr as logger_default, yt as writeKuboFilesWithTimeout, zn as CommentEditsTableRowSchema } from "./schema-B1Ot-kux.js";
|
|
3
|
+
import { $n as t$10, A as deriveDbPosts, At as verifyCommunityEdit, Bt as getCommunityPublicKeyFromWire, C as BackupAbortError, Dt as verifyCommentPubsubMessage, E as calculateInlineRepliesBudget, Et as verifyCommentModeration, F as importSignerIntoKuboNode, Ft as getAuthorNameFromWire, G as REPLY_REPLIES_SORT_TYPES, Gt as getIpfsKeyFromPrivateKey, Ht as decode, Jn as r$2, Jt as getPublicKeyFromPrivateKey, K as TIMEFRAMES_TO_SECONDS, Kn as t$9, Kt as getPKCAddressFromPublicKey, M as getDefaultCommunityDbConfig, Mt as buildRuntimeAuthor, Nt as cleanWireAuthor, O as deleteOldCommunityInWindows, Ot as verifyCommentUpdate, P as getThumbnailPropsOfLink, R as moveCommunityDbToDeletedDirectory, S as encryptEd25519AesGcmPublicKeyBuffer, St as verifyChallengeRequest, T as calculateExpectedSignatureSize, Tt as verifyCommentIpfs, U as POSTS_SORT_TYPES, Ut as encode, W as POST_REPLIES_SORT_TYPES, Xn as n$6, Yn as t$11, Yt as createSchemaRowParser, Z as iterateOverPageCidsToFindAllCids, Zn as n$5, _ as SignerWithPublicKeyAddress, _t as signCommunity, a as pkcJsChallenges, b as decryptEd25519AesGcmPublicKeyBuffer, bt as verifyChallengeAnswer, cn as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, d as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, dt as signChallengeVerification, er as stringify, f as KeyvBetterSqlite3, ft as signComment, gt as signCommentUpdateForChallengeVerification, ht as signCommentUpdate, i as getCommunityChallengeFromCommunityChallengeSettings, it as pLimit, j as deriveDbReplies, jt as verifyVote, k as deriveCommentIpfsFromCommentTableRow, kt as verifyCommunity, l as normalizeSelfAddrsForProvider, lt as signChallengeMessage, nr as require_lodash_merge, o as TrackedInstanceRegistry, on as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, pt as signCommentEdit, qn as t$12, qt as getPKCAddressFromPublicKeySync, r as getChallengeVerification, s as LRUCache, st as cleanUpBeforePublishing, t as RpcLocalCommunity, tr as STORAGE_KEYS, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, w as backupCommunityDb, wt as verifyCommentEdit, xn as parseJsonWithPKCErrorIfFails, z as resolveDbPostsCidRefs, zt as getCommunityNameFromWire } from "./rpc-local-community-DtdeJBOq.js";
|
|
4
4
|
import { randomFillSync, randomUUID } from "node:crypto";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
|
-
import
|
|
6
|
+
import path from "node:path";
|
|
7
7
|
import os from "os";
|
|
8
8
|
import { existsSync, promises } from "node:fs";
|
|
9
|
-
import path from "path";
|
|
9
|
+
import path$1 from "path";
|
|
10
10
|
import assert from "assert";
|
|
11
11
|
import fs from "fs";
|
|
12
12
|
import Database from "better-sqlite3";
|
|
@@ -65,8 +65,12 @@ function r(t) {
|
|
|
65
65
|
}
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region dist/node/runtime/node/community/local-community/comment-updates.js
|
|
68
|
-
function
|
|
69
|
-
return community.pubsubTopic || community.address;
|
|
68
|
+
function communityChallengePubsubTopic(community) {
|
|
69
|
+
return community.pubsubTopic || community.signer?.address;
|
|
70
|
+
}
|
|
71
|
+
function challengeExchangePubsubTopic(community) {
|
|
72
|
+
if (community.settings?.disablePubsubChallengeExchange) return void 0;
|
|
73
|
+
return communityChallengePubsubTopic(community);
|
|
70
74
|
}
|
|
71
75
|
function calculateLocalMfsPathForCommentUpdate(community, postDbComment, timestampRange) {
|
|
72
76
|
return [
|
|
@@ -480,11 +484,11 @@ async function publishChallenges(community, challenges, request) {
|
|
|
480
484
|
signer: community.signer
|
|
481
485
|
})
|
|
482
486
|
};
|
|
483
|
-
|
|
484
|
-
community
|
|
485
|
-
if (!community._challengeExchangesFromLocalPublishers[request.challengeRequestId.toString()]) await community._clientsManager.pubsubPublish(
|
|
486
|
-
log(`Community ${community.address} with pubsub topic ${
|
|
487
|
-
community._clientsManager.
|
|
487
|
+
community._clientsManager.updateKuboRpcPubsubStateIfProviderExists("publishing-challenge");
|
|
488
|
+
const challengeTopic = challengeExchangePubsubTopic(community);
|
|
489
|
+
if (challengeTopic && !community._challengeExchangesFromLocalPublishers[request.challengeRequestId.toString()]) await community._clientsManager.pubsubPublish(challengeTopic, challengeMessage);
|
|
490
|
+
log(`Community ${community.address} with pubsub topic ${challengeTopic} published ${challengeMessage.type} over pubsub: `, t$9(toSignChallenge, ["timestamp"]), toEncryptChallenge.challenges.map((challenge) => challenge.type));
|
|
491
|
+
community._clientsManager.updateKuboRpcPubsubStateIfProviderExists("waiting-challenge-answers");
|
|
488
492
|
community.emit("challenge", {
|
|
489
493
|
...challengeMessage,
|
|
490
494
|
challenges
|
|
@@ -509,11 +513,11 @@ async function publishFailedChallengeVerification(community, result, challengeRe
|
|
|
509
513
|
signer: community.signer
|
|
510
514
|
})
|
|
511
515
|
};
|
|
512
|
-
|
|
513
|
-
community
|
|
514
|
-
log(`Will publish ${challengeVerification.type} over pubsub topic ${
|
|
515
|
-
if (!community._challengeExchangesFromLocalPublishers[challengeRequestId.toString()]) await community._clientsManager.pubsubPublish(
|
|
516
|
-
community._clientsManager.
|
|
516
|
+
community._clientsManager.updateKuboRpcPubsubStateIfProviderExists("publishing-challenge-verification");
|
|
517
|
+
const challengeTopic = challengeExchangePubsubTopic(community);
|
|
518
|
+
log(`Will publish ${challengeVerification.type} over pubsub topic ${challengeTopic} on community ${community.address}:`, n$3(toSignVerification, ["challengeRequestId"]));
|
|
519
|
+
if (challengeTopic && !community._challengeExchangesFromLocalPublishers[challengeRequestId.toString()]) await community._clientsManager.pubsubPublish(challengeTopic, challengeVerification);
|
|
520
|
+
community._clientsManager.updateKuboRpcPubsubStateIfProviderExists("waiting-challenge-requests");
|
|
517
521
|
community.emit("challengeverification", challengeVerification);
|
|
518
522
|
community._ongoingChallengeExchanges.delete(challengeRequestId.toString());
|
|
519
523
|
delete community._challengeExchangesFromLocalPublishers[challengeRequestId.toString()];
|
|
@@ -568,10 +572,10 @@ async function publishIdempotentDuplicateVerification(community, request, challe
|
|
|
568
572
|
signer: community.signer
|
|
569
573
|
})
|
|
570
574
|
};
|
|
571
|
-
|
|
572
|
-
community
|
|
573
|
-
if (!community._challengeExchangesFromLocalPublishers[challengeRequestId.toString()]) await community._clientsManager.pubsubPublish(
|
|
574
|
-
community._clientsManager.
|
|
575
|
+
community._clientsManager.updateKuboRpcPubsubStateIfProviderExists("publishing-challenge-verification");
|
|
576
|
+
const challengeTopic = challengeExchangePubsubTopic(community);
|
|
577
|
+
if (challengeTopic && !community._challengeExchangesFromLocalPublishers[challengeRequestId.toString()]) await community._clientsManager.pubsubPublish(challengeTopic, challengeVerification);
|
|
578
|
+
community._clientsManager.updateKuboRpcPubsubStateIfProviderExists("waiting-challenge-requests");
|
|
575
579
|
const objectToEmit = {
|
|
576
580
|
...challengeVerification,
|
|
577
581
|
...toEncryptDecrypted
|
|
@@ -649,10 +653,10 @@ async function publishChallengeVerification(community, challengeResult, request,
|
|
|
649
653
|
signer: community.signer
|
|
650
654
|
})
|
|
651
655
|
};
|
|
652
|
-
|
|
653
|
-
community
|
|
654
|
-
if (!community._challengeExchangesFromLocalPublishers[request.challengeRequestId.toString()]) await community._clientsManager.pubsubPublish(
|
|
655
|
-
community._clientsManager.
|
|
656
|
+
community._clientsManager.updateKuboRpcPubsubStateIfProviderExists("publishing-challenge-verification");
|
|
657
|
+
const challengeTopic = challengeExchangePubsubTopic(community);
|
|
658
|
+
if (challengeTopic && !community._challengeExchangesFromLocalPublishers[request.challengeRequestId.toString()]) await community._clientsManager.pubsubPublish(challengeTopic, challengeVerification);
|
|
659
|
+
community._clientsManager.updateKuboRpcPubsubStateIfProviderExists("waiting-challenge-requests");
|
|
656
660
|
const objectToEmit = {
|
|
657
661
|
...challengeVerification,
|
|
658
662
|
...toEncrypt
|
|
@@ -661,7 +665,7 @@ async function publishChallengeVerification(community, challengeResult, request,
|
|
|
661
665
|
community._ongoingChallengeExchanges.delete(request.challengeRequestId.toString());
|
|
662
666
|
delete community._challengeExchangesFromLocalPublishers[request.challengeRequestId.toString()];
|
|
663
667
|
cleanUpChallengeAnswerPromise(community, request.challengeRequestId.toString());
|
|
664
|
-
log.trace(`Published ${challengeVerification.type} over pubsub topic ${
|
|
668
|
+
log.trace(`Published ${challengeVerification.type} over pubsub topic ${challengeTopic}:`, n$3(objectToEmit, [
|
|
665
669
|
"signature",
|
|
666
670
|
"encrypted",
|
|
667
671
|
"challengeRequestId"
|
|
@@ -3279,9 +3283,9 @@ var DbHandler = class {
|
|
|
3279
3283
|
if (needToMigrate) {
|
|
3280
3284
|
if (dbExistsAlready && currentDbVersion > 0) {
|
|
3281
3285
|
this.destoryConnection();
|
|
3282
|
-
backupDbPath = path.join(path.dirname(dbPath), ".backup_before_migration", `${path.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
|
|
3283
|
-
log(`Copying db ${path.basename(dbPath)} to ${backupDbPath} before migration`);
|
|
3284
|
-
if (!fs.existsSync(path.dirname(backupDbPath))) await fs.promises.mkdir(path.dirname(backupDbPath), { recursive: true });
|
|
3286
|
+
backupDbPath = path$1.join(path$1.dirname(dbPath), ".backup_before_migration", `${path$1.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
|
|
3287
|
+
log(`Copying db ${path$1.basename(dbPath)} to ${backupDbPath} before migration`);
|
|
3288
|
+
if (!fs.existsSync(path$1.dirname(backupDbPath))) await fs.promises.mkdir(path$1.dirname(backupDbPath), { recursive: true });
|
|
3285
3289
|
const sourceDb = new Database(dbPath, { fileMustExist: true });
|
|
3286
3290
|
await sourceDb.backup(backupDbPath);
|
|
3287
3291
|
sourceDb.close();
|
|
@@ -5092,10 +5096,10 @@ var DbHandler = class {
|
|
|
5092
5096
|
if (this._db || this._keyv) await this.destoryConnection();
|
|
5093
5097
|
this._transactionDepth = 0;
|
|
5094
5098
|
const dataPath = this._community._pkc.dataPath;
|
|
5095
|
-
const oldPathString = path.join(dataPath, "communities", oldDbName);
|
|
5096
|
-
const newPathString = path.join(dataPath, "communities", newDbName);
|
|
5097
|
-
await fs.promises.mkdir(path.dirname(oldPathString), { recursive: true });
|
|
5098
|
-
await fs.promises.mkdir(path.dirname(newPathString), { recursive: true });
|
|
5099
|
+
const oldPathString = path$1.join(dataPath, "communities", oldDbName);
|
|
5100
|
+
const newPathString = path$1.join(dataPath, "communities", newDbName);
|
|
5101
|
+
await fs.promises.mkdir(path$1.dirname(oldPathString), { recursive: true });
|
|
5102
|
+
await fs.promises.mkdir(path$1.dirname(newPathString), { recursive: true });
|
|
5099
5103
|
try {
|
|
5100
5104
|
if (!fs.existsSync(oldPathString)) log(`Old DB file ${oldPathString} does not exist. Cannot backup/rename.`);
|
|
5101
5105
|
else {
|
|
@@ -5117,8 +5121,8 @@ var DbHandler = class {
|
|
|
5117
5121
|
}
|
|
5118
5122
|
async lockCommunityStart(communityAddress = this._community.address) {
|
|
5119
5123
|
const log = logger_default("pkc-js:local-community:db-handler:lock:start");
|
|
5120
|
-
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
5121
|
-
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
5124
|
+
const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
5125
|
+
const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
5122
5126
|
try {
|
|
5123
5127
|
await import_src.default.lock(communityDbPath, {
|
|
5124
5128
|
lockfilePath,
|
|
@@ -5139,8 +5143,8 @@ var DbHandler = class {
|
|
|
5139
5143
|
async unlockCommunityStart(communityAddress = this._community.address) {
|
|
5140
5144
|
const log = logger_default("pkc-js:local-community:db-handler:unlock:start");
|
|
5141
5145
|
log.trace(`Attempting to unlock the start of community (${communityAddress})`);
|
|
5142
|
-
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
5143
|
-
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
5146
|
+
const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
5147
|
+
const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
5144
5148
|
if (!fs.existsSync(lockfilePath) || !fs.existsSync(communityDbPath)) return;
|
|
5145
5149
|
try {
|
|
5146
5150
|
await import_src.default.unlock(communityDbPath, { lockfilePath });
|
|
@@ -5151,8 +5155,8 @@ var DbHandler = class {
|
|
|
5151
5155
|
}
|
|
5152
5156
|
}
|
|
5153
5157
|
async isCommunityStartLocked(communityAddress = this._community.address) {
|
|
5154
|
-
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
5155
|
-
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
5158
|
+
const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
5159
|
+
const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
5156
5160
|
return await import_src.default.check(communityDbPath, {
|
|
5157
5161
|
lockfilePath,
|
|
5158
5162
|
realpath: false,
|
|
@@ -5161,8 +5165,8 @@ var DbHandler = class {
|
|
|
5161
5165
|
}
|
|
5162
5166
|
async lockCommunityState() {
|
|
5163
5167
|
const log = logger_default("pkc-js:local-community:db-handler:lock:lockCommunityState");
|
|
5164
|
-
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
|
|
5165
|
-
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
5168
|
+
const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
|
|
5169
|
+
const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
5166
5170
|
try {
|
|
5167
5171
|
await import_src.default.lock(communityDbPath, {
|
|
5168
5172
|
lockfilePath,
|
|
@@ -5179,8 +5183,8 @@ var DbHandler = class {
|
|
|
5179
5183
|
}
|
|
5180
5184
|
async unlockCommunityState() {
|
|
5181
5185
|
const log = logger_default("pkc-js:local-community:db-handler:lock:unlockCommunityState");
|
|
5182
|
-
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
|
|
5183
|
-
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
5186
|
+
const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
|
|
5187
|
+
const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
5184
5188
|
if (!fs.existsSync(lockfilePath)) return;
|
|
5185
5189
|
try {
|
|
5186
5190
|
await import_src.default.unlock(communityDbPath, { lockfilePath });
|
|
@@ -5190,7 +5194,7 @@ var DbHandler = class {
|
|
|
5190
5194
|
}
|
|
5191
5195
|
}
|
|
5192
5196
|
communityDbExists() {
|
|
5193
|
-
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
5197
|
+
const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
5194
5198
|
return fs.existsSync(communityDbPath);
|
|
5195
5199
|
}
|
|
5196
5200
|
markCommentsAsPublishedToPostUpdates(commentCids) {
|
|
@@ -5861,7 +5865,7 @@ async function createNewLocalCommunityDb(community) {
|
|
|
5861
5865
|
await community._dbHandler.initDbIfNeeded({ fileMustExist: false });
|
|
5862
5866
|
await community._dbHandler.createOrMigrateTablesIfNeeded();
|
|
5863
5867
|
await initSignerProps(community, community.signer);
|
|
5864
|
-
if (!community.pubsubTopic) community.pubsubTopic = t$10(community.signer.address);
|
|
5868
|
+
if (!community.pubsubTopic && !community.settings?.disablePubsubChallengeExchange) community.pubsubTopic = t$10(community.signer.address);
|
|
5865
5869
|
if (typeof community.createdAt !== "number") community.createdAt = timestamp();
|
|
5866
5870
|
if (!community.protocolVersion) community.protocolVersion = version_default.PROTOCOL_VERSION;
|
|
5867
5871
|
if (!community.settings?.maxPendingApprovalCount) community.settings = {
|
|
@@ -5940,6 +5944,7 @@ async function initInternalCommunityAfterFirstUpdateNoMerge(community, newProps)
|
|
|
5940
5944
|
},
|
|
5941
5945
|
runtimeFields: { updateCid: newProps.updateCid }
|
|
5942
5946
|
});
|
|
5947
|
+
if (!newProps.pubsubTopic && newProps._configuredPubsubTopic) community.pubsubTopic = newProps._configuredPubsubTopic;
|
|
5943
5948
|
await initSignerProps(community, newProps.signer);
|
|
5944
5949
|
community._internalStateUpdateId = newProps._internalStateUpdateId;
|
|
5945
5950
|
if (Array.isArray(newProps._cidsToUnPin)) newProps._cidsToUnPin.forEach((cid) => community._cidsToUnPin.add(cid));
|
|
@@ -5984,22 +5989,42 @@ async function initDbHandlerIfNeeded(community) {
|
|
|
5984
5989
|
//#region dist/node/runtime/node/community/local-community/pubsub.js
|
|
5985
5990
|
async function listenToIncomingRequests(community) {
|
|
5986
5991
|
const log = logger_default("pkc-js:local-community:sync:_listenToIncomingRequests");
|
|
5987
|
-
const
|
|
5992
|
+
const topic = challengeExchangePubsubTopic(community);
|
|
5993
|
+
const pubsubClient = topic ? community._clientsManager.getDefaultKuboPubsubClient() : community._clientsManager.getDefaultKuboPubsubClientIfAny();
|
|
5994
|
+
if (!pubsubClient) return;
|
|
5988
5995
|
const subscribedTopics = await pubsubClient._client.pubsub.ls();
|
|
5989
|
-
const
|
|
5996
|
+
const staleTopic = community._subscribedChallengePubsubTopic;
|
|
5997
|
+
const unsubscribeStaleTopicIfNeeded = async (currentTopic) => {
|
|
5998
|
+
if (!staleTopic || staleTopic === currentTopic) return;
|
|
5999
|
+
if (subscribedTopics.includes(staleTopic)) await community._clientsManager.pubsubUnsubscribe(staleTopic, community.handleChallengeExchange);
|
|
6000
|
+
community._subscribedChallengePubsubTopic = void 0;
|
|
6001
|
+
log(`Stopped listening on the previous challenge exchange pubsub topic (${staleTopic})`);
|
|
6002
|
+
};
|
|
6003
|
+
if (!topic) {
|
|
6004
|
+
const disabledTopic = communityChallengePubsubTopic(community);
|
|
6005
|
+
if (disabledTopic && subscribedTopics.includes(disabledTopic)) {
|
|
6006
|
+
await community._clientsManager.pubsubUnsubscribe(disabledTopic, community.handleChallengeExchange);
|
|
6007
|
+
if (community._subscribedChallengePubsubTopic === disabledTopic) community._subscribedChallengePubsubTopic = void 0;
|
|
6008
|
+
log(`Challenge exchange is disabled, unsubscribed from pubsub topic (${disabledTopic})`);
|
|
6009
|
+
}
|
|
6010
|
+
await unsubscribeStaleTopicIfNeeded(void 0);
|
|
6011
|
+
return;
|
|
6012
|
+
}
|
|
6013
|
+
await unsubscribeStaleTopicIfNeeded(topic);
|
|
5990
6014
|
if (!subscribedTopics.includes(topic)) {
|
|
5991
6015
|
await community._clientsManager.pubsubUnsubscribe(topic, community.handleChallengeExchange);
|
|
5992
6016
|
await community._clientsManager.pubsubSubscribe(topic, community.handleChallengeExchange);
|
|
5993
6017
|
community._clientsManager.updateKuboRpcPubsubState("waiting-challenge-requests", pubsubClient.url);
|
|
5994
6018
|
log(`Waiting for publications on pubsub topic (${topic})`);
|
|
5995
6019
|
}
|
|
6020
|
+
community._subscribedChallengePubsubTopic = topic;
|
|
5996
6021
|
}
|
|
5997
6022
|
async function providePubsubTopicRoutingCidsIfNeeded(community, force = false) {
|
|
5998
6023
|
const log = logger_default("pkc-js:local-community:_providePubsubTopicRoutingCidsIfNeeded");
|
|
5999
6024
|
const reprovideIntervalMs = 3600 * 1e3;
|
|
6000
6025
|
const now = Date.now();
|
|
6001
6026
|
if (!force && community._lastPubsubTopicRoutingProvideAt && now - community._lastPubsubTopicRoutingProvideAt < reprovideIntervalMs) return;
|
|
6002
|
-
const topics = [
|
|
6027
|
+
const topics = [challengeExchangePubsubTopic(community), community.ipnsPubsubTopic].filter((topic) => typeof topic === "string");
|
|
6003
6028
|
if (topics.length === 0) return;
|
|
6004
6029
|
community._lastPubsubTopicRoutingProvideAt = now;
|
|
6005
6030
|
const kuboRpcClient = community._clientsManager.getDefaultKuboRpcClient()._client;
|
|
@@ -6124,6 +6149,7 @@ async function calculateNextCommunityRecord(community, commentUpdateRowsToPublis
|
|
|
6124
6149
|
const newIpns = { ...cleanUpBeforePublishing({
|
|
6125
6150
|
...n$3(community._toJSONIpfsBaseNoPosts(), ["signature"]),
|
|
6126
6151
|
...pendingCommunityIpfsEditProps,
|
|
6152
|
+
pubsubTopic: challengeExchangePubsubTopic(community),
|
|
6127
6153
|
lastPostCid: latestPost?.cid,
|
|
6128
6154
|
lastCommentCid: latestComment?.cid,
|
|
6129
6155
|
statsCid,
|
|
@@ -6222,7 +6248,13 @@ async function publishCommunityRecordToIpns(community, build, newCommunityRecord
|
|
|
6222
6248
|
community._blocksToRm = community._blocksToRm.filter((blockCid) => !removedBlocks.includes(blockCid));
|
|
6223
6249
|
}
|
|
6224
6250
|
if (community.updateCid) community._cidsToUnPin.add(community.updateCid);
|
|
6251
|
+
const configuredPubsubTopic = community.pubsubTopic;
|
|
6252
|
+
const editedPubsubTopic = community._pendingEditProps.filter((editProps) => editProps.editId && editIdsToIncludeInNextUpdate.includes(editProps.editId)).map((editProps) => editProps.pubsubTopic).filter((topic) => typeof topic === "string").pop();
|
|
6225
6253
|
community.initCommunityIpfsPropsNoMerge(newCommunityRecord);
|
|
6254
|
+
if (!newCommunityRecord.pubsubTopic) {
|
|
6255
|
+
const topicToKeep = editedPubsubTopic ?? configuredPubsubTopic;
|
|
6256
|
+
if (topicToKeep) community.pubsubTopic = topicToKeep;
|
|
6257
|
+
}
|
|
6226
6258
|
community.updateCid = file.path;
|
|
6227
6259
|
community._pendingEditProps = community._pendingEditProps.filter((editProps) => !editIdsToIncludeInNextUpdate.includes(editProps.editId));
|
|
6228
6260
|
if (community._pendingEditProps.length > 0) {
|
|
@@ -6595,7 +6627,9 @@ async function stop(community) {
|
|
|
6595
6627
|
if (community.state === "started") {
|
|
6596
6628
|
log("Stopping running community", community.address);
|
|
6597
6629
|
try {
|
|
6598
|
-
|
|
6630
|
+
const challengeTopics = new Set([communityChallengePubsubTopic(community), community._subscribedChallengePubsubTopic].filter((topic) => typeof topic === "string"));
|
|
6631
|
+
for (const challengeTopic of challengeTopics) await community._clientsManager.pubsubUnsubscribe(challengeTopic, community.handleChallengeExchange);
|
|
6632
|
+
community._subscribedChallengePubsubTopic = void 0;
|
|
6599
6633
|
} catch (e) {
|
|
6600
6634
|
log.error("Failed to unsubscribe from challenge exchange pubsub when stopping community", e);
|
|
6601
6635
|
}
|
|
@@ -6623,7 +6657,6 @@ async function stop(community) {
|
|
|
6623
6657
|
log.error(`Failed to unlock start lock on community (${community.address})`, e);
|
|
6624
6658
|
}
|
|
6625
6659
|
const kuboRpcClient = community._clientsManager.getDefaultKuboRpcClient();
|
|
6626
|
-
const pubsubClient = community._clientsManager.getDefaultKuboPubsubClient();
|
|
6627
6660
|
community._setStartedStateWithEmission("stopped");
|
|
6628
6661
|
untrackStartedCommunity(community._pkc, community);
|
|
6629
6662
|
processStartedCommunities.untrack(community);
|
|
@@ -6632,7 +6665,7 @@ async function stop(community) {
|
|
|
6632
6665
|
await community._dbHandler.unlockCommunityState();
|
|
6633
6666
|
await community._updateStartedValue();
|
|
6634
6667
|
community._clientsManager.updateKuboRpcState("stopped", kuboRpcClient.url);
|
|
6635
|
-
community._clientsManager.
|
|
6668
|
+
community._clientsManager.updateKuboRpcPubsubStateIfProviderExists("stopped");
|
|
6636
6669
|
if (community._dbHandler) community._dbHandler.destoryConnection();
|
|
6637
6670
|
log(`Stopped the running of local community (${community.address})`);
|
|
6638
6671
|
community._setState("stopped");
|
|
@@ -6691,6 +6724,8 @@ async function deleteCommunity(community) {
|
|
|
6691
6724
|
log.error("Failed to add old page cids from community.posts to be unpinned", e);
|
|
6692
6725
|
}
|
|
6693
6726
|
if (community.ipnsPubsubTopicRoutingCid) community._cidsToUnPin.add(community.ipnsPubsubTopicRoutingCid);
|
|
6727
|
+
const configuredChallengeTopic = communityChallengePubsubTopic(community);
|
|
6728
|
+
if (configuredChallengeTopic) community._cidsToUnPin.add(pubsubTopicToDhtKey(configuredChallengeTopic));
|
|
6694
6729
|
if (community.pubsubTopicRoutingCid) community._cidsToUnPin.add(community.pubsubTopicRoutingCid);
|
|
6695
6730
|
try {
|
|
6696
6731
|
await community.initDbHandlerIfNeeded();
|
|
@@ -6881,11 +6916,11 @@ async function edit(community, newCommunityOptions) {
|
|
|
6881
6916
|
const EXPORTS_KEY = STORAGE_KEYS[STORAGE_KEYS.EXPORTS];
|
|
6882
6917
|
function defaultExportPathFor(community, exportId) {
|
|
6883
6918
|
if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
|
|
6884
|
-
return
|
|
6919
|
+
return path.join(community._pkc.dataPath, "exports", `${exportId}.sqlite`);
|
|
6885
6920
|
}
|
|
6886
6921
|
function sourceDbPathFor(community) {
|
|
6887
6922
|
if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
|
|
6888
|
-
return
|
|
6923
|
+
return path.join(community._pkc.dataPath, "communities", community.address);
|
|
6889
6924
|
}
|
|
6890
6925
|
async function persistExports(community) {
|
|
6891
6926
|
if (!community._dbHandler) return;
|
|
@@ -6961,9 +6996,9 @@ async function runExportTask(community, exportId, opts) {
|
|
|
6961
6996
|
async function exportCommunityEmbedded(community, options = {}) {
|
|
6962
6997
|
if (options.signal?.aborted) throw options.signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
6963
6998
|
const exportId = v4();
|
|
6964
|
-
const destPath = options.exportPath ?
|
|
6999
|
+
const destPath = options.exportPath ? path.resolve(options.exportPath) : defaultExportPathFor(community, exportId);
|
|
6965
7000
|
const includePrivateKey = options.includePrivateKey === true;
|
|
6966
|
-
if (
|
|
7001
|
+
if (path.resolve(destPath) === path.resolve(sourceDbPathFor(community))) throw new PKCError("ERR_EXPORT_PATH_TARGETS_LIVE_DB", {
|
|
6967
7002
|
communityAddress: community.address,
|
|
6968
7003
|
exportPath: destPath
|
|
6969
7004
|
});
|
|
@@ -7089,6 +7124,7 @@ var LocalCommunity = class extends RpcLocalCommunity {
|
|
|
7089
7124
|
this._firstUpdateAfterStart = true;
|
|
7090
7125
|
this._internalStateUpdateId = "";
|
|
7091
7126
|
this._lastPubsubTopicRoutingProvideAt = void 0;
|
|
7127
|
+
this._subscribedChallengePubsubTopic = void 0;
|
|
7092
7128
|
this._lastProvidedBrowserDialableSelfAddrs = void 0;
|
|
7093
7129
|
this._lastAddressReprovideCheckAt = void 0;
|
|
7094
7130
|
this._mirroredStartedOrUpdatingCommunity = void 0;
|
|
@@ -7127,7 +7163,8 @@ var LocalCommunity = class extends RpcLocalCommunity {
|
|
|
7127
7163
|
_internalStateUpdateId: this._internalStateUpdateId,
|
|
7128
7164
|
_cidsToUnPin: [...this._cidsToUnPin],
|
|
7129
7165
|
_mfsPathsToRemove: [...this._mfsPathsToRemove],
|
|
7130
|
-
_pendingEditProps: this._pendingEditProps
|
|
7166
|
+
_pendingEditProps: this._pendingEditProps,
|
|
7167
|
+
_configuredPubsubTopic: this.pubsubTopic
|
|
7131
7168
|
};
|
|
7132
7169
|
}
|
|
7133
7170
|
toJSONInternalBeforeFirstUpdate() {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-
|
|
1
|
+
import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-Br1ipu1Z.js";
|
|
2
2
|
export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
|