@pkcprotocol/pkc-js 0.0.56 → 0.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/errors.d.ts +1 -1
- package/dist/browser/errors.js +1 -1
- 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/runtime/node/community/local-community/lifecycle.js +10 -0
- package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/publication-validation.js +8 -2
- package/dist/browser/runtime/node/community/local-community/publication-validation.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/pubsub.js +1 -1
- package/dist/browser/runtime/node/community/local-community/pubsub.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.d.ts +60 -0
- package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.js +95 -0
- package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.js.map +1 -0
- package/dist/browser/runtime/node/community/local-community.d.ts +2 -0
- package/dist/browser/runtime/node/community/local-community.js +5 -0
- package/dist/browser/runtime/node/community/local-community.js.map +1 -1
- package/dist/bundled/bundle-manifest.json +39 -37
- package/dist/bundled/chunks/{helia-for-pkc-CcmiATPg.js → helia-for-pkc-Dy66yFBq.js} +2 -2
- package/dist/bundled/chunks/{local-community-DzFaedmf.js → local-community-CpqhUYOZ.js} +1 -1
- package/dist/bundled/chunks/{local-community-DdB4oPEw.js → local-community-D1BZqTaY.js} +92 -4
- package/dist/bundled/chunks/{node-DNJqRHLq.js → node-OomQx4kQ.js} +10 -533
- package/dist/bundled/chunks/{rpc-local-community-OVRYzYQ3.js → rpc-local-community-XVq4w0ZG.js} +563 -40
- package/dist/bundled/chunks/{schema-lNZ3-tdE.js → schema-C03N0i5R.js} +2 -2
- package/dist/bundled/chunks/{util-MtD9fpa8.js → util-DFDVE6vH.js} +1 -1
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/rpc/src/index.js +4 -4
- package/dist/node/errors.d.ts +1 -1
- package/dist/node/errors.js +1 -1
- 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/runtime/node/community/local-community/lifecycle.js +10 -0
- package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/publication-validation.js +8 -2
- package/dist/node/runtime/node/community/local-community/publication-validation.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/pubsub.js +1 -1
- package/dist/node/runtime/node/community/local-community/pubsub.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.d.ts +60 -0
- package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.js +95 -0
- package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.js.map +1 -0
- package/dist/node/runtime/node/community/local-community.d.ts +2 -0
- package/dist/node/runtime/node/community/local-community.js +5 -0
- package/dist/node/runtime/node/community/local-community.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-OomQx4kQ.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-OomQx4kQ.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/schema-
|
|
36
|
-
"chunks/rpc-local-community-
|
|
37
|
-
"chunks/node-
|
|
38
|
-
"chunks/local-community-
|
|
35
|
+
"chunks/schema-C03N0i5R.js",
|
|
36
|
+
"chunks/rpc-local-community-XVq4w0ZG.js",
|
|
37
|
+
"chunks/node-OomQx4kQ.js",
|
|
38
|
+
"chunks/local-community-D1BZqTaY.js",
|
|
39
39
|
"node:url",
|
|
40
40
|
"path",
|
|
41
41
|
"assert",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
"dist/node/rpc/src/index.js"
|
|
55
55
|
]
|
|
56
56
|
},
|
|
57
|
-
"chunks/helia-for-pkc-
|
|
57
|
+
"chunks/helia-for-pkc-Dy66yFBq.js": {
|
|
58
58
|
"isEntry": false,
|
|
59
59
|
"imports": [
|
|
60
|
-
"chunks/schema-
|
|
61
|
-
"chunks/util-
|
|
60
|
+
"chunks/schema-C03N0i5R.js",
|
|
61
|
+
"chunks/util-DFDVE6vH.js",
|
|
62
62
|
"multiformats/cid",
|
|
63
63
|
"@libp2p/interface",
|
|
64
64
|
"@libp2p/peer-id",
|
|
@@ -83,11 +83,19 @@
|
|
|
83
83
|
"dist/node/helia/helia-for-pkc.js"
|
|
84
84
|
]
|
|
85
85
|
},
|
|
86
|
-
"chunks/local-community-
|
|
86
|
+
"chunks/local-community-CpqhUYOZ.js": {
|
|
87
87
|
"isEntry": false,
|
|
88
88
|
"imports": [
|
|
89
|
-
"chunks/
|
|
90
|
-
|
|
89
|
+
"chunks/local-community-D1BZqTaY.js"
|
|
90
|
+
],
|
|
91
|
+
"dynamicImports": [],
|
|
92
|
+
"inputs": []
|
|
93
|
+
},
|
|
94
|
+
"chunks/local-community-D1BZqTaY.js": {
|
|
95
|
+
"isEntry": false,
|
|
96
|
+
"imports": [
|
|
97
|
+
"chunks/schema-C03N0i5R.js",
|
|
98
|
+
"chunks/rpc-local-community-XVq4w0ZG.js",
|
|
91
99
|
"node:crypto",
|
|
92
100
|
"node:url",
|
|
93
101
|
"node:path",
|
|
@@ -96,6 +104,7 @@
|
|
|
96
104
|
"path",
|
|
97
105
|
"assert",
|
|
98
106
|
"fs",
|
|
107
|
+
"multiformats/cid",
|
|
99
108
|
"better-sqlite3",
|
|
100
109
|
"typestub-ipfs-only-hash"
|
|
101
110
|
],
|
|
@@ -128,41 +137,30 @@
|
|
|
128
137
|
"dist/node/runtime/node/community/local-community/db-state.js",
|
|
129
138
|
"dist/node/runtime/node/community/local-community/pubsub.js",
|
|
130
139
|
"dist/node/runtime/node/community/local-community/ipns-publishing.js",
|
|
140
|
+
"dist/node/runtime/node/community/local-community/reprovide-on-address-change.js",
|
|
131
141
|
"dist/node/runtime/node/community/local-community/lifecycle.js",
|
|
132
142
|
"dist/node/runtime/node/community/local-community/editing.js",
|
|
133
143
|
"dist/node/runtime/node/community/local-community/export.js",
|
|
134
144
|
"dist/node/runtime/node/community/local-community.js"
|
|
135
145
|
]
|
|
136
146
|
},
|
|
137
|
-
"chunks/
|
|
138
|
-
"isEntry": false,
|
|
139
|
-
"imports": [
|
|
140
|
-
"chunks/local-community-DdB4oPEw.js"
|
|
141
|
-
],
|
|
142
|
-
"dynamicImports": [],
|
|
143
|
-
"inputs": []
|
|
144
|
-
},
|
|
145
|
-
"chunks/node-DNJqRHLq.js": {
|
|
147
|
+
"chunks/node-OomQx4kQ.js": {
|
|
146
148
|
"isEntry": false,
|
|
147
149
|
"imports": [
|
|
148
|
-
"chunks/schema-
|
|
149
|
-
"chunks/rpc-local-community-
|
|
150
|
-
"chunks/util-
|
|
151
|
-
"node:http",
|
|
152
|
-
"node:fs/promises",
|
|
153
|
-
"node:path",
|
|
150
|
+
"chunks/schema-C03N0i5R.js",
|
|
151
|
+
"chunks/rpc-local-community-XVq4w0ZG.js",
|
|
152
|
+
"chunks/util-DFDVE6vH.js",
|
|
154
153
|
"path",
|
|
155
154
|
"assert",
|
|
156
155
|
"fs",
|
|
157
|
-
"node:https",
|
|
158
156
|
"better-sqlite3",
|
|
159
157
|
"typestub-ipfs-only-hash",
|
|
160
158
|
"events",
|
|
161
159
|
"rpc-websockets"
|
|
162
160
|
],
|
|
163
161
|
"dynamicImports": [
|
|
164
|
-
"chunks/helia-for-pkc-
|
|
165
|
-
"chunks/local-community-
|
|
162
|
+
"chunks/helia-for-pkc-Dy66yFBq.js",
|
|
163
|
+
"chunks/local-community-D1BZqTaY.js"
|
|
166
164
|
],
|
|
167
165
|
"inputs": [
|
|
168
166
|
"node_modules/zod/v4/locales/en.js",
|
|
@@ -195,8 +193,6 @@
|
|
|
195
193
|
"dist/node/runtime/node/sqlite-lru-cache.js",
|
|
196
194
|
"dist/node/runtime/node/lru-storage.js",
|
|
197
195
|
"dist/node/publications/comment-moderation/comment-moderation.js",
|
|
198
|
-
"dist/node/runtime/node/address-rewriter-db.js",
|
|
199
|
-
"dist/node/runtime/node/addresses-rewriter-proxy-server.js",
|
|
200
196
|
"node_modules/deep-is/index.js",
|
|
201
197
|
"node_modules/is2/node_modules/ip-regex/index.js",
|
|
202
198
|
"node_modules/is2/package.json",
|
|
@@ -216,12 +212,15 @@
|
|
|
216
212
|
"dist/node/index.js"
|
|
217
213
|
]
|
|
218
214
|
},
|
|
219
|
-
"chunks/rpc-local-community-
|
|
215
|
+
"chunks/rpc-local-community-XVq4w0ZG.js": {
|
|
220
216
|
"isEntry": false,
|
|
221
217
|
"imports": [
|
|
222
|
-
"chunks/schema-
|
|
218
|
+
"chunks/schema-C03N0i5R.js",
|
|
219
|
+
"node:http",
|
|
223
220
|
"node:crypto",
|
|
224
221
|
"node:url",
|
|
222
|
+
"node:fs/promises",
|
|
223
|
+
"node:path",
|
|
225
224
|
"node:dns",
|
|
226
225
|
"os",
|
|
227
226
|
"node:fs",
|
|
@@ -233,6 +232,7 @@
|
|
|
233
232
|
"multiformats/basics",
|
|
234
233
|
"uint8arrays/from-string",
|
|
235
234
|
"@libp2p/peer-id",
|
|
235
|
+
"node:https",
|
|
236
236
|
"uint8arrays/to-string",
|
|
237
237
|
"@libp2p/crypto/keys",
|
|
238
238
|
"better-sqlite3",
|
|
@@ -725,6 +725,8 @@
|
|
|
725
725
|
"dist/node/community/community-gateway-selection.js",
|
|
726
726
|
"dist/node/community/community-client-manager.js",
|
|
727
727
|
"dist/node/community/remote-community.js",
|
|
728
|
+
"dist/node/runtime/node/address-rewriter-db.js",
|
|
729
|
+
"dist/node/runtime/node/addresses-rewriter-proxy-server.js",
|
|
728
730
|
"node_modules/lru-cache/dist/esm/index.js",
|
|
729
731
|
"dist/node/pkc/tracked-instance-registry.js",
|
|
730
732
|
"node_modules/js-sizeof/index.js",
|
|
@@ -751,7 +753,7 @@
|
|
|
751
753
|
"dist/node/community/rpc-local-community.js"
|
|
752
754
|
]
|
|
753
755
|
},
|
|
754
|
-
"chunks/schema-
|
|
756
|
+
"chunks/schema-C03N0i5R.js": {
|
|
755
757
|
"isEntry": false,
|
|
756
758
|
"imports": [
|
|
757
759
|
"node:module",
|
|
@@ -1295,10 +1297,10 @@
|
|
|
1295
1297
|
"dist/node/pubsub-messages/schema.js"
|
|
1296
1298
|
]
|
|
1297
1299
|
},
|
|
1298
|
-
"chunks/util-
|
|
1300
|
+
"chunks/util-DFDVE6vH.js": {
|
|
1299
1301
|
"isEntry": false,
|
|
1300
1302
|
"imports": [
|
|
1301
|
-
"chunks/schema-
|
|
1303
|
+
"chunks/schema-C03N0i5R.js"
|
|
1302
1304
|
],
|
|
1303
1305
|
"dynamicImports": [],
|
|
1304
1306
|
"inputs": [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, cr as logger_default, or as PKCError } from "./schema-
|
|
2
|
-
import { n as getHeliaDebugContext, t as connectToPubsubPeers } from "./util-
|
|
1
|
+
import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, cr as logger_default, or as PKCError } from "./schema-C03N0i5R.js";
|
|
2
|
+
import { n as getHeliaDebugContext, t as connectToPubsubPeers } from "./util-DFDVE6vH.js";
|
|
3
3
|
import { CID } from "multiformats/cid";
|
|
4
4
|
import { NotFoundError } from "@libp2p/interface";
|
|
5
5
|
import { peerIdFromString } from "@libp2p/peer-id";
|
|
@@ -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-D1BZqTaY.js";
|
|
2
2
|
export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as pubsubTopicToDhtKey, At as trackStartedCommunity, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, Dr as __require, 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, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateTableRowSchema, Or as __toESM, P as getErrorCodeFromMessage, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, Tr as __commonJSMin, Un as AuthorReservedFields, W as isLinkOfAnimatedImage, Xn as require_commonjs, Y as isLinkValid, Zn as require_retry, _t as timestamp, a as ChallengeRequestMessageSchema, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bt as findCommunityInRegistry, cr as logger_default, d as DecryptedChallengeRequestSchema, dt as retryKuboIpfsAddAndProvide, fn as VotePubsubMessagePublicationSchema, hn as VoteTablesRowSchema, ht as statMfsPathSafely, k as doesDomainAddressHaveCapitalLetter, kn as CommentsTableRowSchema, kt as syncCommunityRegistryEntry, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nt as removeBlocksFromKuboNode, or as PKCError, pn as VotePubsubReservedFields, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunitySignedPropertyNames, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, sr as messages, t as ChallengeAnswerMessageSchema, u as DecryptedChallengeRequestPublicationSchema, vn as CommentIpfsSchema, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xr as ZodError, xt as findStartedCommunity, y as version_default, yn as CommentPubsubMessageReservedFields, yt as writeKuboFilesWithTimeout, zn as CommentEditsTableRowSchema } from "./schema-
|
|
2
|
-
import { A as
|
|
1
|
+
import { $ as pubsubTopicToDhtKey, At as trackStartedCommunity, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, Dr as __require, 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, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateTableRowSchema, Or as __toESM, P as getErrorCodeFromMessage, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, Tr as __commonJSMin, Un as AuthorReservedFields, W as isLinkOfAnimatedImage, Xn as require_commonjs, Y as isLinkValid, Zn as require_retry, _t as timestamp, a as ChallengeRequestMessageSchema, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bt as findCommunityInRegistry, cr as logger_default, d as DecryptedChallengeRequestSchema, dt as retryKuboIpfsAddAndProvide, fn as VotePubsubMessagePublicationSchema, hn as VoteTablesRowSchema, ht as statMfsPathSafely, k as doesDomainAddressHaveCapitalLetter, kn as CommentsTableRowSchema, kt as syncCommunityRegistryEntry, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nt as removeBlocksFromKuboNode, or as PKCError, pn as VotePubsubReservedFields, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunitySignedPropertyNames, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, sr as messages, t as ChallengeAnswerMessageSchema, u as DecryptedChallengeRequestPublicationSchema, vn as CommentIpfsSchema, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xr as ZodError, xt as findStartedCommunity, y as version_default, yn as CommentPubsubMessageReservedFields, yt as writeKuboFilesWithTimeout, zn as CommentEditsTableRowSchema } from "./schema-C03N0i5R.js";
|
|
2
|
+
import { 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 require_lodash_merge, Jt as getPublicKeyFromPrivateKey, K as TIMEFRAMES_TO_SECONDS, Kn as stringify, 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, Yt as createSchemaRowParser, Z as iterateOverPageCidsToFindAllCids, _ 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, 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, o as TrackedInstanceRegistry, on as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, pt as signCommentEdit, qn as STORAGE_KEYS, qt as getPKCAddressFromPublicKeySync, r as getChallengeVerification, s as LRUCache, st as cleanUpBeforePublishing, t as RpcLocalCommunity, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, w as backupCommunityDb, wt as verifyCommentEdit, xn as parseJsonWithPKCErrorIfFails, z as resolveDbPostsCidRefs, zt as getCommunityNameFromWire } from "./rpc-local-community-XVq4w0ZG.js";
|
|
3
3
|
import { randomFillSync, randomUUID } from "node:crypto";
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
5
|
import path from "node:path";
|
|
@@ -8,6 +8,7 @@ import { existsSync, promises } from "node:fs";
|
|
|
8
8
|
import path$1 from "path";
|
|
9
9
|
import assert from "assert";
|
|
10
10
|
import fs from "fs";
|
|
11
|
+
import { CID } from "multiformats/cid";
|
|
11
12
|
import Database from "better-sqlite3";
|
|
12
13
|
import { of } from "typestub-ipfs-only-hash";
|
|
13
14
|
//#region dist/node/runtime/node/community/local-community/comment-updates.js
|
|
@@ -992,7 +993,13 @@ async function checkParentAndPostState(community, request, publication) {
|
|
|
992
993
|
const postFlags = community._dbHandler.queryCommentFlagsSetByMod(parent.postCid);
|
|
993
994
|
if (postFlags.removed && !request.commentModeration) return messages.ERR_COMMUNITY_PUBLICATION_POST_HAS_BEEN_REMOVED;
|
|
994
995
|
if (community._dbHandler.queryAuthorEditDeleted(parent.postCid)?.deleted && !request.commentModeration) return messages.ERR_COMMUNITY_PUBLICATION_POST_HAS_BEEN_DELETED;
|
|
995
|
-
if (postFlags.locked && !request.commentModeration)
|
|
996
|
+
if (postFlags.locked && !request.commentModeration) {
|
|
997
|
+
if (!(!request.vote && await isPublicationAuthorPartOfRoles(community, publication, [
|
|
998
|
+
"owner",
|
|
999
|
+
"admin",
|
|
1000
|
+
"moderator"
|
|
1001
|
+
]))) return messages.ERR_COMMUNITY_PUBLICATION_POST_IS_LOCKED;
|
|
1002
|
+
}
|
|
996
1003
|
if (postFlags.archived && !request.commentModeration) return messages.ERR_COMMUNITY_PUBLICATION_POST_IS_ARCHIVED;
|
|
997
1004
|
if (parent.timestamp > publication.timestamp) return messages.ERR_COMMUNITY_COMMENT_TIMESTAMP_IS_EARLIER_THAN_PARENT;
|
|
998
1005
|
if (parent.pendingApproval && !("commentModeration" in request) && !(request.commentEdit?.deleted === true)) return messages.ERR_USER_PUBLISHED_UNDER_PENDING_COMMENT;
|
|
@@ -5923,7 +5930,7 @@ async function listenToIncomingRequests(community) {
|
|
|
5923
5930
|
}
|
|
5924
5931
|
async function providePubsubTopicRoutingCidsIfNeeded(community, force = false) {
|
|
5925
5932
|
const log = logger_default("pkc-js:local-community:_providePubsubTopicRoutingCidsIfNeeded");
|
|
5926
|
-
const reprovideIntervalMs =
|
|
5933
|
+
const reprovideIntervalMs = 3600 * 1e3;
|
|
5927
5934
|
const now = Date.now();
|
|
5928
5935
|
if (!force && community._lastPubsubTopicRoutingProvideAt && now - community._lastPubsubTopicRoutingProvideAt < reprovideIntervalMs) return;
|
|
5929
5936
|
const topics = [pubsubTopicWithfallback(community), community.ipnsPubsubTopic].filter((topic) => typeof topic === "string");
|
|
@@ -6208,6 +6215,82 @@ async function syncIpnsWithDb(community) {
|
|
|
6208
6215
|
throw e;
|
|
6209
6216
|
}
|
|
6210
6217
|
}
|
|
6218
|
+
function isBrowserDialableAddr(addr) {
|
|
6219
|
+
return addr.includes("/webrtc") || addr.includes("/ws");
|
|
6220
|
+
}
|
|
6221
|
+
async function getBrowserDialableSelfAddrs(client) {
|
|
6222
|
+
const idRes = await client.id();
|
|
6223
|
+
const peerId = idRes.id.toString();
|
|
6224
|
+
const swarmListeningAddresses = (await client.swarm.addrs()).filter((swarmAddr) => swarmAddr.id.toString() === peerId);
|
|
6225
|
+
const normalized = normalizeSelfAddrsForProvider([...idRes.addresses.map((addr) => addr.toString()), ...import_commonjs.flatten(swarmListeningAddresses.map((swarmAddr) => swarmAddr.addrs.map((addr) => addr.toString())))], peerId);
|
|
6226
|
+
return import_commonjs.unique(normalized.filter(isBrowserDialableAddr)).sort();
|
|
6227
|
+
}
|
|
6228
|
+
function connectionCriticalCids(community) {
|
|
6229
|
+
return import_commonjs.unique([community.pubsubTopicRoutingCid, community.ipnsPubsubTopicRoutingCid].filter((cid) => typeof cid === "string"));
|
|
6230
|
+
}
|
|
6231
|
+
/**
|
|
6232
|
+
* Re-provide the connection-critical CIDs when the node's browser-dialable (WSS/WebRTC) self-addresses
|
|
6233
|
+
* have changed since the last provide. This pushes the current addresses to the HTTP routers (via the
|
|
6234
|
+
* address-rewriter proxy) so browsers don't get NoValidAddressesError against stale/dead addresses.
|
|
6235
|
+
*
|
|
6236
|
+
* The first observation only establishes a baseline (start() already force-provides these CIDs with fresh
|
|
6237
|
+
* addresses via providePubsubTopicRoutingCidsIfNeeded); subsequent changes trigger a re-provide.
|
|
6238
|
+
*/
|
|
6239
|
+
async function reprovideConnectionCidsIfBrowserAddrsChanged(community) {
|
|
6240
|
+
const log = logger_default("pkc-js:local-community:_reprovideConnectionCidsIfBrowserAddrsChanged");
|
|
6241
|
+
const client = community._clientsManager.getDefaultKuboRpcClient()._client;
|
|
6242
|
+
const current = await getBrowserDialableSelfAddrs(client);
|
|
6243
|
+
const previous = community._lastProvidedBrowserDialableSelfAddrs;
|
|
6244
|
+
if (previous === void 0) {
|
|
6245
|
+
community._lastProvidedBrowserDialableSelfAddrs = current;
|
|
6246
|
+
return {
|
|
6247
|
+
reprovided: false,
|
|
6248
|
+
providedCids: [],
|
|
6249
|
+
browserAddrs: current
|
|
6250
|
+
};
|
|
6251
|
+
}
|
|
6252
|
+
if (import_commonjs.isDeepEqual(previous, current)) return {
|
|
6253
|
+
reprovided: false,
|
|
6254
|
+
providedCids: [],
|
|
6255
|
+
browserAddrs: current
|
|
6256
|
+
};
|
|
6257
|
+
community._lastProvidedBrowserDialableSelfAddrs = current;
|
|
6258
|
+
const cidStrings = connectionCriticalCids(community);
|
|
6259
|
+
const providedCids = [];
|
|
6260
|
+
for (const cidString of cidStrings) {
|
|
6261
|
+
let cid;
|
|
6262
|
+
try {
|
|
6263
|
+
cid = CID.parse(cidString);
|
|
6264
|
+
} catch (e) {
|
|
6265
|
+
log.error(`Failed to parse connection-critical CID (${cidString}) for community (${community.address})`, e);
|
|
6266
|
+
continue;
|
|
6267
|
+
}
|
|
6268
|
+
try {
|
|
6269
|
+
const provideEvents = client.routing.provide(cid, { recursive: true });
|
|
6270
|
+
for await (const event of provideEvents) log.trace(`Provide event for ${cidString}:`, event);
|
|
6271
|
+
providedCids.push(cidString);
|
|
6272
|
+
} catch (e) {
|
|
6273
|
+
log.error(`Failed to re-provide connection-critical CID (${cidString}) for community (${community.address})`, e);
|
|
6274
|
+
}
|
|
6275
|
+
}
|
|
6276
|
+
log(`Browser-dialable addresses of community (${community.address}) changed; re-provided ${providedCids.length}/${cidStrings.length} connection-critical CIDs`, { browserAddrs: current });
|
|
6277
|
+
return {
|
|
6278
|
+
reprovided: providedCids.length > 0,
|
|
6279
|
+
providedCids,
|
|
6280
|
+
browserAddrs: current
|
|
6281
|
+
};
|
|
6282
|
+
}
|
|
6283
|
+
/**
|
|
6284
|
+
* Publish-loop entry point. The publish loop runs once per sync cycle (and faster during bursts), so this
|
|
6285
|
+
* throttles the kubo id()/swarm.addrs() poll to ADDRESS_REPROVIDE_POLL_INTERVAL_MS before delegating to the
|
|
6286
|
+
* core change-detection. Lives inside the publish loop so it's torn down together with the loop on stop().
|
|
6287
|
+
*/
|
|
6288
|
+
async function reprovideOnAddressChangeIfDue(community) {
|
|
6289
|
+
const now = Date.now();
|
|
6290
|
+
if (typeof community._lastAddressReprovideCheckAt === "number" && now - community._lastAddressReprovideCheckAt < 6e4) return;
|
|
6291
|
+
community._lastAddressReprovideCheckAt = now;
|
|
6292
|
+
await reprovideConnectionCidsIfBrowserAddrsChanged(community);
|
|
6293
|
+
}
|
|
6211
6294
|
//#endregion
|
|
6212
6295
|
//#region dist/node/runtime/node/community/local-community/lifecycle.js
|
|
6213
6296
|
async function publishLoop(community, syncIntervalMs) {
|
|
@@ -6230,6 +6313,7 @@ async function publishLoop(community, syncIntervalMs) {
|
|
|
6230
6313
|
};
|
|
6231
6314
|
while (!shouldStopPublishLoop()) try {
|
|
6232
6315
|
await syncIpnsWithDb(community);
|
|
6316
|
+
await reprovideOnAddressChangeIfDue(community).catch((e) => log.error("Failed to re-provide connection CIDs on address change", e));
|
|
6233
6317
|
} catch (e) {
|
|
6234
6318
|
community.emit("error", e);
|
|
6235
6319
|
} finally {
|
|
@@ -6263,6 +6347,8 @@ async function start(community) {
|
|
|
6263
6347
|
if (community.state === "updating") throw new PKCError("ERR_NEED_TO_STOP_UPDATING_COMMUNITY_BEFORE_STARTING", { address: community.address });
|
|
6264
6348
|
community._stopHasBeenCalled = false;
|
|
6265
6349
|
community._firstUpdateAfterStart = true;
|
|
6350
|
+
community._lastProvidedBrowserDialableSelfAddrs = void 0;
|
|
6351
|
+
community._lastAddressReprovideCheckAt = void 0;
|
|
6266
6352
|
if (!community._clientsManager.getDefaultKuboRpcClientOrHelia()) throw Error("You need to define an IPFS client in your pkc instance to be able to start a local community");
|
|
6267
6353
|
await community.initDbHandlerIfNeeded();
|
|
6268
6354
|
await community._updateStartedValue();
|
|
@@ -6938,6 +7024,8 @@ var LocalCommunity = class extends RpcLocalCommunity {
|
|
|
6938
7024
|
this._firstUpdateAfterStart = true;
|
|
6939
7025
|
this._internalStateUpdateId = "";
|
|
6940
7026
|
this._lastPubsubTopicRoutingProvideAt = void 0;
|
|
7027
|
+
this._lastProvidedBrowserDialableSelfAddrs = void 0;
|
|
7028
|
+
this._lastAddressReprovideCheckAt = void 0;
|
|
6941
7029
|
this._mirroredStartedOrUpdatingCommunity = void 0;
|
|
6942
7030
|
this._pendingEditProps = [];
|
|
6943
7031
|
this._blocksToRm = [];
|