@pkcprotocol/pkc-js 0.0.130 → 0.0.132
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 +17 -7
- package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +2 -0
- package/dist/browser/clients/rpc-client/schema.d.ts +24 -0
- package/dist/browser/community/schema.d.ts +193 -0
- package/dist/browser/community/schema.js +4 -0
- package/dist/browser/community/schema.js.map +1 -1
- package/dist/browser/errors.d.ts +7 -1
- package/dist/browser/errors.js +7 -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/index-with-compile-cache.d.ts +32 -0
- package/dist/browser/index.d.ts +64 -0
- package/dist/browser/pages/schema.d.ts +44 -0
- package/dist/browser/pkc/pkc-with-rpc-client.d.ts +3 -0
- package/dist/browser/pkc/pkc-with-rpc-client.js +26 -3
- package/dist/browser/pkc/pkc-with-rpc-client.js.map +1 -1
- package/dist/browser/pkc-error.d.ts +1 -1
- package/dist/browser/publications/comment/comment.d.ts +1 -0
- package/dist/browser/publications/comment/comment.js +2 -0
- package/dist/browser/publications/comment/comment.js.map +1 -1
- package/dist/browser/publications/comment/schema.d.ts +133 -1
- package/dist/browser/publications/comment/schema.js +21 -6
- package/dist/browser/publications/comment/schema.js.map +1 -1
- package/dist/browser/publications/comment/types.d.ts +2 -1
- package/dist/browser/publications/community-edit/schema.d.ts +8 -0
- package/dist/browser/pubsub-messages/schema.d.ts +37 -0
- package/dist/browser/rpc/src/lib/pkc-js/index.d.ts +32 -0
- package/dist/browser/rpc/src/schema.d.ts +192 -0
- package/dist/browser/runtime/node/community/db-handler.js +3 -2
- package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/publication-validation.js +41 -17
- package/dist/browser/runtime/node/community/local-community/publication-validation.js.map +1 -1
- package/dist/browser/runtime/node/polyfill.js +3 -1
- package/dist/browser/runtime/node/polyfill.js.map +1 -1
- package/dist/browser/runtime/node/util.js +12 -3
- package/dist/browser/runtime/node/util.js.map +1 -1
- package/dist/browser/schema/schema-util.d.ts +82 -0
- package/dist/browser/schema.d.ts +256 -0
- package/dist/browser/test/test-util.d.ts +40 -0
- package/dist/browser/version.js +1 -1
- package/dist/bundled/bundle-manifest.json +446 -223
- package/dist/bundled/challenges.js +1 -1
- package/dist/bundled/chunks/{helia-for-pkc-CVGt82_T.js → helia-for-pkc-Be5IsnZy.js} +2 -2
- package/dist/bundled/chunks/{local-community-fdVlmCGN.js → local-community-BU2-PWv4.js} +1 -1
- package/dist/bundled/chunks/{local-community-wNpPFFZe.js → local-community-BjDsNdnK.js} +42 -26
- package/dist/bundled/chunks/node-Cpazwn3v.js +36843 -0
- package/dist/bundled/chunks/{page-sort-scoring-DerjGUL1.js → page-sort-scoring-BqPwUozm.js} +1 -1
- package/dist/bundled/chunks/{rpc-local-community-CJbuAfCd.js → rpc-local-community-C5xdrdFG.js} +56834 -33748
- package/dist/bundled/chunks/{src-B07ldGHS.js → src-BggJ_InF.js} +435 -149
- package/dist/bundled/chunks/{src-629pKfxo.js → src-BsiPSkhv.js} +2 -2
- package/dist/bundled/chunks/{src-BOzgM7Fp.js → src-evzEHW9W.js} +26 -9
- package/dist/bundled/chunks/{util-kemFUDC0.js → util-BLpE5ch7.js} +1 -1
- package/dist/bundled/chunks/{util-B_sAleCo.js → util-DaZGW5bK.js} +30 -9
- package/dist/bundled/chunks/{validate-package-factories-DLuTOpn4.js → validate-package-factories-DBOjkq17.js} +2 -2
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/page-sorts.js +1 -1
- package/dist/bundled/rpc/src/index.js +4 -4
- package/dist/node/clients/rpc-client/rpc-schema-util.d.ts +2 -0
- package/dist/node/clients/rpc-client/schema.d.ts +24 -0
- package/dist/node/community/schema.d.ts +193 -0
- package/dist/node/community/schema.js +4 -0
- package/dist/node/community/schema.js.map +1 -1
- package/dist/node/errors.d.ts +7 -1
- package/dist/node/errors.js +7 -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/index-with-compile-cache.d.ts +32 -0
- package/dist/node/index.d.ts +64 -0
- package/dist/node/pages/schema.d.ts +44 -0
- package/dist/node/pkc/pkc-with-rpc-client.d.ts +3 -0
- package/dist/node/pkc/pkc-with-rpc-client.js +26 -3
- package/dist/node/pkc/pkc-with-rpc-client.js.map +1 -1
- package/dist/node/pkc-error.d.ts +1 -1
- package/dist/node/publications/comment/comment.d.ts +1 -0
- package/dist/node/publications/comment/comment.js +2 -0
- package/dist/node/publications/comment/comment.js.map +1 -1
- package/dist/node/publications/comment/schema.d.ts +133 -1
- package/dist/node/publications/comment/schema.js +21 -6
- package/dist/node/publications/comment/schema.js.map +1 -1
- package/dist/node/publications/comment/types.d.ts +2 -1
- package/dist/node/publications/community-edit/schema.d.ts +8 -0
- package/dist/node/pubsub-messages/schema.d.ts +37 -0
- package/dist/node/rpc/src/lib/pkc-js/index.d.ts +32 -0
- package/dist/node/rpc/src/schema.d.ts +192 -0
- package/dist/node/runtime/node/community/db-handler.js +3 -2
- package/dist/node/runtime/node/community/db-handler.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/publication-validation.js +41 -17
- package/dist/node/runtime/node/community/local-community/publication-validation.js.map +1 -1
- package/dist/node/runtime/node/polyfill.js +3 -1
- package/dist/node/runtime/node/polyfill.js.map +1 -1
- package/dist/node/runtime/node/util.js +12 -3
- package/dist/node/runtime/node/util.js.map +1 -1
- package/dist/node/schema/schema-util.d.ts +82 -0
- package/dist/node/schema.d.ts +256 -0
- package/dist/node/test/test-util.d.ts +40 -0
- package/dist/node/version.js +1 -1
- package/package.json +18 -18
- package/dist/bundled/chunks/node-Z0wgsXeR.js +0 -9757
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as validateChallengeFileFactory } from "./chunks/validate-package-factories-
|
|
1
|
+
import { t as validateChallengeFileFactory } from "./chunks/validate-package-factories-DBOjkq17.js";
|
|
2
2
|
export { validateChallengeFileFactory };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { C as hideClassPrivateProps, Lr as PKCError, T as ipnsNameToIpnsOverPubsubTopic, n as binaryKeyToPubsubTopic, zr as logger_default } from "./util-
|
|
3
|
-
import { a as directFetchIpnsRecordFromProviders, c as readFreshCachedIpnsRecordFromPubsubLocalStore, i as connectToPubsubPeers, l as selectBitswapSessionSeedPeers, n as REACHABILITY_DOCS_URL, o as fetchBlockWithStalledSessionFailover, r as cacheIpnsRecordInPubsubLocalStore, s as getHeliaDebugContext, u as summarizeProviderReachability } from "./util-
|
|
2
|
+
import { C as hideClassPrivateProps, Lr as PKCError, T as ipnsNameToIpnsOverPubsubTopic, n as binaryKeyToPubsubTopic, zr as logger_default } from "./util-DaZGW5bK.js";
|
|
3
|
+
import { a as directFetchIpnsRecordFromProviders, c as readFreshCachedIpnsRecordFromPubsubLocalStore, i as connectToPubsubPeers, l as selectBitswapSessionSeedPeers, n as REACHABILITY_DOCS_URL, o as fetchBlockWithStalledSessionFailover, r as cacheIpnsRecordInPubsubLocalStore, s as getHeliaDebugContext, u as summarizeProviderReachability } from "./util-BLpE5ch7.js";
|
|
4
4
|
import { t as map } from "./src-Cpx2Sts8.js";
|
|
5
5
|
import { t as parallelBatch } from "./src-DKntVmyX.js";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
@@ -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-BjDsNdnK.js";
|
|
2
2
|
export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { i as __toESM } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $ as retryKuboIpfsAddAndProvide, $n as CommentEditsTableRowSchema, At as ChallengeAnswerMessageSchema, Bt as DecryptedChallengeRequestSchema, C as hideClassPrivateProps, Ct as trackUpdatingCommunity, Dt as require_sha256, En as VotePubsubReservedFields, Et as untrackUpdatingCommunity, F as isLinkOfVideo, G as removeMfsFilesSafely, Hn as CommentsTableRowSchema, I as isLinkValid, It as ChallengeVerificationMessageSchema, Jt as version_default, Lr as PKCError, M as isLinkOfAudio, Mn as CommentPubsubMessageReservedFields, Mt as ChallengeMessageSchema, N as isLinkOfImage, On as VoteTablesRowSchema, Or as t$4, P as isLinkOfMedia, Pt as ChallengeRequestMessageSchema, Rr as messages, Sr as e, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$3, Vn as CommentUpdateTableRowSchema, W as removeBlocksFromKuboNode, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xt as CommunityEditPublicationPubsubReservedFields, Yn as CommentEditPubsubMessagePublicationSchema, Z as retryKuboBlockPutPinAndProvidePubsubTopic, Zn as CommentEditReservedFields, _ as genToArray, _r as t$7, at as timestamp, b as getIpnsRecordInLocalKuboNode, br as t$6, bt as syncCommunityRegistryEntry, c as contentContainsMarkdownImages, ct as withSortedKeysDeep, dt as findStartedCommunity, f as derivePublicationFromChallengeRequest, g as findMalformedUnicodeString, gr as n$3, hr as isStringDomain, i as calculateStringSizeSameAsIpfsAddCidV0, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, j as isLinkOfAnimatedImage, jn as CommentIpfsSchema, jr as require_retry, kr as t$2, kt as pTimeout, l as contentContainsMarkdownVideos, lt as writeKuboFilesWithTimeout, mn as CommunitySignedPropertyNames, nn as CommentModerationReservedFields, nt as sleepUntilTimeoutOrAbort, o as calculateUnixFsDagSizeCidV0, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, q as removeNullUndefinedValues, r as calculateIpfsCidV0, rt as statMfsPathSafely, s as contentContainsMarkdownAudio, st as withSortedKeys, ti as ZodError, tn as CommentModerationPubsubMessagePublicationSchema, ut as findCommunityInRegistry, v as getEquivalentCommunityAddresses, vr as n$2, wr as r$1, wt as untrackStartedCommunity, xr as e$1, xt as trackStartedCommunity, y as getErrorCodeFromMessage, yr as t$5, z as pubsubTopicToDhtKey, zn as CommentUpdateSchema, zr as logger_default, zt as DecryptedChallengeRequestPublicationSchema } from "./util-
|
|
3
|
-
import { $ as createSchemaRowParser, An as verifyChallengeAnswer, Bn as verifyCommunityEdit, Br as t$8, Cr as getThumbnailPropsOfLink, Dr as moveCommunityDbToDeletedDirectory, Dt as parseJsonWithPKCErrorIfFails, En as signCommunity, Fn as verifyCommentIpfs, Fr as isCommunityStartLocked, Gr as stringify, Hn as verifyVote, Hr as n$4, In as verifyCommentModeration, Ir as require_src, Kn as getAuthorNameFromWire, Ln as verifyCommentPubsubMessage, Lr as t$10, Mn as verifyChallengeRequest, Mr as findCommunitiesEntry, N as MAX_PAGE_SIZE_BYTES, Or as refreshCommunitiesList, Pn as verifyCommentEdit, Q as collectSchemaRowCoercions, Qn as effectiveMaxCrosspostDepth, Rn as verifyCommentUpdate, Rr as t$11, S as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, Sn as signCommentEdit, Tn as signCommentUpdateForChallengeVerification, Un as buildRuntimeAuthor, Vr as n$5, W as pLimit, Wn as cleanWireAuthor, Wr as t$9, X as coerceSchemaRowBoolean, Xr as STORAGE_KEYS, Z as coerceSchemaRowJson, Zn as crosspostChainDepthUpTo, Zr as require_lodash_merge, _ as createAuthorIdentityMatcher, _r as deriveCommentIpfsFromCommentTableRow, a as generatePagesReportingFailedSorts, ar as encode, b as KeyvBetterSqlite3, bn as signChallengeVerification, c as resolvePageSortsOrThrow, cn as SignerWithPublicKeyAddress, cr as getPKCAddressFromPublicKey, d as getChallengeVerification, dr as BackupAbortError, dt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, f as getCommunityChallengeFromCommunityChallengeSettings, fn as decryptEd25519AesGcmPublicKeyBuffer, fr as backupCommunityDb, g as authorNameResolveFailureReason, gn as cleanUpBeforePublishing, gr as deleteOldCommunityInWindows, h as authorIdentityMatcherForRequest, hn as _validateSignatureOfPKCRecord, i as derivePublicPageSorts, ir as decode, j as iterateOverPageCidsToFindAllCids, kr as resolveDbPostsCidRefs, lr as getPKCAddressFromPublicKeySync, m as pkcJsChallenges, mn as encryptEd25519AesGcmPublicKeyBuffer, mr as calculateInlineRepliesBudget, nr as getCommunityPublicKeyFromWire, o as loadPageSortsForStartedCommunity, p as loadChallengeFileFromCommunityChallengeSettings, pr as calculateExpectedSignatureSize, pt as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, r as computePageSortsFingerprint, s as lookupPageSortFactories, sr as getIpfsKeyFromPrivateKey, t as RpcLocalCommunity, tr as getCommunityNameFromWire, u as deriveCommunityChallengesOrThrow, ur as getPublicKeyFromPrivateKey, v as TrackedInstanceRegistry, vn as signChallengeMessage, vr as deriveDbPosts, w as TIMEFRAMES_TO_SECONDS, wn as signCommentUpdate, wr as importSignerIntoKuboNode, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, xn as signComment, xr as getDefaultCommunityDbConfig, y as LRUCache, yr as deriveDbReplies, zn as verifyCommunity, zr as r$2 } from "./rpc-local-community-
|
|
4
|
-
import { a as scorePageCommentsWithFile, i as partitionPageCommentsForSort, n as filterRepliesForPageSort, o as stripRepliesFromPageComment, r as orderPageCommentsByScore, t as createDescendantsLookup } from "./page-sort-scoring-
|
|
5
|
-
import { randomFillSync, randomUUID } from "node:crypto";
|
|
2
|
+
import { $ as retryKuboIpfsAddAndProvide, $n as CommentEditsTableRowSchema, At as ChallengeAnswerMessageSchema, Bt as DecryptedChallengeRequestSchema, C as hideClassPrivateProps, Ct as trackUpdatingCommunity, Dt as require_sha256, En as VotePubsubReservedFields, Et as untrackUpdatingCommunity, F as isLinkOfVideo, G as removeMfsFilesSafely, Hn as CommentsTableRowSchema, I as isLinkValid, It as ChallengeVerificationMessageSchema, Jt as version_default, Lr as PKCError, M as isLinkOfAudio, Mn as CommentPubsubMessageReservedFields, Mt as ChallengeMessageSchema, N as isLinkOfImage, On as VoteTablesRowSchema, Or as t$4, P as isLinkOfMedia, Pt as ChallengeRequestMessageSchema, Rr as messages, Sr as e, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$3, Vn as CommentUpdateTableRowSchema, W as removeBlocksFromKuboNode, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xt as CommunityEditPublicationPubsubReservedFields, Yn as CommentEditPubsubMessagePublicationSchema, Z as retryKuboBlockPutPinAndProvidePubsubTopic, Zn as CommentEditReservedFields, _ as genToArray, _r as t$7, at as timestamp, b as getIpnsRecordInLocalKuboNode, br as t$6, bt as syncCommunityRegistryEntry, c as contentContainsMarkdownImages, ct as withSortedKeysDeep, dt as findStartedCommunity, f as derivePublicationFromChallengeRequest, g as findMalformedUnicodeString, gr as n$3, hr as isStringDomain, i as calculateStringSizeSameAsIpfsAddCidV0, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, j as isLinkOfAnimatedImage, jn as CommentIpfsSchema, jr as require_retry, kr as t$2, kt as pTimeout, l as contentContainsMarkdownVideos, lt as writeKuboFilesWithTimeout, mn as CommunitySignedPropertyNames, nn as CommentModerationReservedFields, nt as sleepUntilTimeoutOrAbort, o as calculateUnixFsDagSizeCidV0, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, q as removeNullUndefinedValues, r as calculateIpfsCidV0, rt as statMfsPathSafely, s as contentContainsMarkdownAudio, st as withSortedKeys, ti as ZodError, tn as CommentModerationPubsubMessagePublicationSchema, ut as findCommunityInRegistry, v as getEquivalentCommunityAddresses, vr as n$2, wr as r$1, wt as untrackStartedCommunity, xr as e$1, xt as trackStartedCommunity, y as getErrorCodeFromMessage, yr as t$5, z as pubsubTopicToDhtKey, zn as CommentUpdateSchema, zr as logger_default, zt as DecryptedChallengeRequestPublicationSchema } from "./util-DaZGW5bK.js";
|
|
3
|
+
import { $ as createSchemaRowParser, An as verifyChallengeAnswer, Bn as verifyCommunityEdit, Br as t$8, Cr as getThumbnailPropsOfLink, Dr as moveCommunityDbToDeletedDirectory, Dt as parseJsonWithPKCErrorIfFails, En as signCommunity, Fn as verifyCommentIpfs, Fr as isCommunityStartLocked, Gr as stringify, Hn as verifyVote, Hr as n$4, In as verifyCommentModeration, Ir as require_src, Kn as getAuthorNameFromWire, Ln as verifyCommentPubsubMessage, Lr as t$10, Mn as verifyChallengeRequest, Mr as findCommunitiesEntry, N as MAX_PAGE_SIZE_BYTES, Or as refreshCommunitiesList, Pn as verifyCommentEdit, Q as collectSchemaRowCoercions, Qn as effectiveMaxCrosspostDepth, Rn as verifyCommentUpdate, Rr as t$11, S as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, Sn as signCommentEdit, Tn as signCommentUpdateForChallengeVerification, Un as buildRuntimeAuthor, Vr as n$5, W as pLimit, Wn as cleanWireAuthor, Wr as t$9, X as coerceSchemaRowBoolean, Xr as STORAGE_KEYS, Z as coerceSchemaRowJson, Zn as crosspostChainDepthUpTo, Zr as require_lodash_merge, _ as createAuthorIdentityMatcher, _r as deriveCommentIpfsFromCommentTableRow, a as generatePagesReportingFailedSorts, ar as encode, b as KeyvBetterSqlite3, bn as signChallengeVerification, c as resolvePageSortsOrThrow, cn as SignerWithPublicKeyAddress, cr as getPKCAddressFromPublicKey, d as getChallengeVerification, dr as BackupAbortError, dt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, f as getCommunityChallengeFromCommunityChallengeSettings, fn as decryptEd25519AesGcmPublicKeyBuffer, fr as backupCommunityDb, g as authorNameResolveFailureReason, gn as cleanUpBeforePublishing, gr as deleteOldCommunityInWindows, h as authorIdentityMatcherForRequest, hn as _validateSignatureOfPKCRecord, i as derivePublicPageSorts, ir as decode, j as iterateOverPageCidsToFindAllCids, kr as resolveDbPostsCidRefs, lr as getPKCAddressFromPublicKeySync, m as pkcJsChallenges, mn as encryptEd25519AesGcmPublicKeyBuffer, mr as calculateInlineRepliesBudget, nr as getCommunityPublicKeyFromWire, o as loadPageSortsForStartedCommunity, p as loadChallengeFileFromCommunityChallengeSettings, pr as calculateExpectedSignatureSize, pt as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, r as computePageSortsFingerprint, s as lookupPageSortFactories, sr as getIpfsKeyFromPrivateKey, t as RpcLocalCommunity, tr as getCommunityNameFromWire, u as deriveCommunityChallengesOrThrow, ur as getPublicKeyFromPrivateKey, v as TrackedInstanceRegistry, vn as signChallengeMessage, vr as deriveDbPosts, w as TIMEFRAMES_TO_SECONDS, wn as signCommentUpdate, wr as importSignerIntoKuboNode, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, xn as signComment, xr as getDefaultCommunityDbConfig, y as LRUCache, yr as deriveDbReplies, zn as verifyCommunity, zr as r$2 } from "./rpc-local-community-C5xdrdFG.js";
|
|
4
|
+
import { a as scorePageCommentsWithFile, i as partitionPageCommentsForSort, n as filterRepliesForPageSort, o as stripRepliesFromPageComment, r as orderPageCommentsByScore, t as createDescendantsLookup } from "./page-sort-scoring-BqPwUozm.js";
|
|
6
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
6
|
import path from "node:path";
|
|
8
7
|
import os from "os";
|
|
@@ -184,18 +183,10 @@ async function reprovideAnchorRecordIfDue(community) {
|
|
|
184
183
|
await reprovideAnchorRecordIfNeeded(community);
|
|
185
184
|
}
|
|
186
185
|
//#endregion
|
|
187
|
-
//#region node_modules/uuid/dist-node/native.js
|
|
188
|
-
var native_default = { randomUUID };
|
|
189
|
-
//#endregion
|
|
190
186
|
//#region node_modules/uuid/dist-node/rng.js
|
|
191
|
-
const
|
|
192
|
-
let poolPtr = rnds8Pool.length;
|
|
187
|
+
const rnds8 = new Uint8Array(16);
|
|
193
188
|
function rng() {
|
|
194
|
-
|
|
195
|
-
randomFillSync(rnds8Pool);
|
|
196
|
-
poolPtr = 0;
|
|
197
|
-
}
|
|
198
|
-
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
189
|
+
return crypto.getRandomValues(rnds8);
|
|
199
190
|
}
|
|
200
191
|
//#endregion
|
|
201
192
|
//#region node_modules/uuid/dist-node/stringify.js
|
|
@@ -206,6 +197,10 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
206
197
|
}
|
|
207
198
|
//#endregion
|
|
208
199
|
//#region node_modules/uuid/dist-node/v4.js
|
|
200
|
+
function v4(options, buf, offset) {
|
|
201
|
+
if (!buf && !options && crypto.randomUUID) return crypto.randomUUID();
|
|
202
|
+
return _v4(options, buf, offset);
|
|
203
|
+
}
|
|
209
204
|
function _v4(options, buf, offset) {
|
|
210
205
|
options = options || {};
|
|
211
206
|
const rnds = options.random ?? options.rng?.() ?? rng();
|
|
@@ -220,10 +215,6 @@ function _v4(options, buf, offset) {
|
|
|
220
215
|
}
|
|
221
216
|
return unsafeStringify(rnds);
|
|
222
217
|
}
|
|
223
|
-
function v4(options, buf, offset) {
|
|
224
|
-
if (native_default.randomUUID && !buf && !options) return native_default.randomUUID();
|
|
225
|
-
return _v4(options, buf, offset);
|
|
226
|
-
}
|
|
227
218
|
//#endregion
|
|
228
219
|
//#region dist/node/runtime/node/community/local-community/defaults.js
|
|
229
220
|
const DUPLICATE_PUBLICATION_ERRORS = new Set([
|
|
@@ -1549,6 +1540,7 @@ var DbHandler = class {
|
|
|
1549
1540
|
pseudonymityMode TEXT NULLABLE,
|
|
1550
1541
|
quotedCids TEXT NULLABLE, -- JSON array
|
|
1551
1542
|
crosspost TEXT NULLABLE, -- JSON: {cid, comment} of the comment this one reposts, stored verbatim so the embedded record keeps reproducing its cid
|
|
1543
|
+
gallery TEXT NULLABLE, -- JSON array of media items, stored verbatim since items are loose and author-signed
|
|
1552
1544
|
extraProps TEXT NULLABLE, -- JSON
|
|
1553
1545
|
challengeCommentUpdate TEXT NULLABLE, -- JSON: challenge-supplied partial CommentUpdate seeded into queryCalculatedCommentUpdate with lowest priority
|
|
1554
1546
|
protocolVersion TEXT NOT NULL,
|
|
@@ -2117,8 +2109,8 @@ var DbHandler = class {
|
|
|
2117
2109
|
const columnNames = this._getColumnNames(TABLES.COMMENTS);
|
|
2118
2110
|
const stmt = this._db.prepare(`
|
|
2119
2111
|
INSERT INTO ${TABLES.COMMENTS}
|
|
2120
|
-
(cid, authorSignerAddress, author, link, linkWidth, linkHeight, thumbnailUrl, thumbnailUrlWidth, thumbnailUrlHeight, parentCid, postCid, previousCid, communityPublicKey, communityName, content, timestamp, signature, originalCommentSignatureEncoded, title, depth, linkHtmlTagName, flairs, spoiler, pendingApproval, number, postNumber, nsfw, pseudonymityMode, quotedCids, crosspost, extraProps, challengeCommentUpdate, protocolVersion, insertedAt)
|
|
2121
|
-
VALUES (@cid, @authorSignerAddress, @author, @link, @linkWidth, @linkHeight, @thumbnailUrl, @thumbnailUrlWidth, @thumbnailUrlHeight, @parentCid, @postCid, @previousCid, @communityPublicKey, @communityName, @content, @timestamp, @signature, @originalCommentSignatureEncoded, @title, @depth, @linkHtmlTagName, @flairs, @spoiler, @pendingApproval, @number, @postNumber, @nsfw, @pseudonymityMode, @quotedCids, @crosspost, @extraProps, @challengeCommentUpdate, @protocolVersion, @insertedAt)
|
|
2112
|
+
(cid, authorSignerAddress, author, link, linkWidth, linkHeight, thumbnailUrl, thumbnailUrlWidth, thumbnailUrlHeight, parentCid, postCid, previousCid, communityPublicKey, communityName, content, timestamp, signature, originalCommentSignatureEncoded, title, depth, linkHtmlTagName, flairs, spoiler, pendingApproval, number, postNumber, nsfw, pseudonymityMode, quotedCids, crosspost, gallery, extraProps, challengeCommentUpdate, protocolVersion, insertedAt)
|
|
2113
|
+
VALUES (@cid, @authorSignerAddress, @author, @link, @linkWidth, @linkHeight, @thumbnailUrl, @thumbnailUrlWidth, @thumbnailUrlHeight, @parentCid, @postCid, @previousCid, @communityPublicKey, @communityName, @content, @timestamp, @signature, @originalCommentSignatureEncoded, @title, @depth, @linkHtmlTagName, @flairs, @spoiler, @pendingApproval, @number, @postNumber, @nsfw, @pseudonymityMode, @quotedCids, @crosspost, @gallery, @extraProps, @challengeCommentUpdate, @protocolVersion, @insertedAt)
|
|
2122
2114
|
`);
|
|
2123
2115
|
const defaults = t$5(columnNames, (column) => [column, null]);
|
|
2124
2116
|
this._db.transaction((items) => {
|
|
@@ -5245,6 +5237,24 @@ async function checkParentAndPostState(community, request, publication, authorId
|
|
|
5245
5237
|
if (isCommentDisapproved && !isCommentDisapproved.approved && !("commentModeration" in request) && !(request.commentEdit?.deleted === true)) return messages.ERR_USER_PUBLISHED_UNDER_DISAPPROVED_COMMENT;
|
|
5246
5238
|
}
|
|
5247
5239
|
}
|
|
5240
|
+
const GALLERY_HTML_TAG_NAME_BY_MIME_CATEGORY = {
|
|
5241
|
+
image: "img",
|
|
5242
|
+
video: "video",
|
|
5243
|
+
audio: "audio"
|
|
5244
|
+
};
|
|
5245
|
+
function checkCommentGallery(community, commentPublication) {
|
|
5246
|
+
const gallery = commentPublication.gallery;
|
|
5247
|
+
if (!gallery) return void 0;
|
|
5248
|
+
const isReply = Boolean(commentPublication.parentCid);
|
|
5249
|
+
const maxItems = isReply ? community.features?.maxReplyGalleryItems : community.features?.maxPostGalleryItems;
|
|
5250
|
+
if (!maxItems) return isReply ? messages.ERR_REPLY_GALLERY_NOT_ALLOWED : messages.ERR_POST_GALLERY_NOT_ALLOWED;
|
|
5251
|
+
if (gallery.length > maxItems) return isReply ? messages.ERR_REPLY_GALLERY_EXCEEDS_MAX_ITEMS : messages.ERR_POST_GALLERY_EXCEEDS_MAX_ITEMS;
|
|
5252
|
+
for (const item of gallery) {
|
|
5253
|
+
if (!isLinkValid(item.url) || !isLinkOfMedia(item.url)) return messages.ERR_GALLERY_ITEM_NOT_MEDIA;
|
|
5254
|
+
const mimeCategory = isLinkOfImage(item.url) ? "image" : isLinkOfVideo(item.url) ? "video" : "audio";
|
|
5255
|
+
if (item.htmlTagName !== GALLERY_HTML_TAG_NAME_BY_MIME_CATEGORY[mimeCategory]) return messages.ERR_GALLERY_ITEM_HTML_TAG_NAME_MISMATCH;
|
|
5256
|
+
}
|
|
5257
|
+
}
|
|
5248
5258
|
async function checkCommentPublication(community, request) {
|
|
5249
5259
|
if (!request.comment) return void 0;
|
|
5250
5260
|
const commentPublication = request.comment;
|
|
@@ -5253,17 +5263,23 @@ async function checkCommentPublication(community, request) {
|
|
|
5253
5263
|
if (community.features?.requirePostLinkIsMedia && commentPublication.link && (!isLinkValid(commentPublication.link) || !isLinkOfMedia(commentPublication.link))) return messages.ERR_POST_LINK_IS_NOT_OF_MEDIA;
|
|
5254
5264
|
if (community.features?.requireReplyLink && commentPublication.parentCid && (!commentPublication.link || !community.features?.requireReplyLinkIsMedia && !isLinkValid(commentPublication.link))) return messages.ERR_REPLY_HAS_INVALID_LINK_FIELD;
|
|
5255
5265
|
if (community.features?.requireReplyLinkIsMedia && commentPublication.parentCid && commentPublication.link && (!isLinkValid(commentPublication.link) || !isLinkOfMedia(commentPublication.link))) return messages.ERR_REPLY_LINK_IS_NOT_OF_MEDIA;
|
|
5266
|
+
const galleryError = checkCommentGallery(community, commentPublication);
|
|
5267
|
+
if (galleryError) return galleryError;
|
|
5256
5268
|
if (community.features?.noMarkdownImages && commentPublication.content && contentContainsMarkdownImages(commentPublication.content)) return messages.ERR_COMMENT_CONTENT_CONTAINS_MARKDOWN_IMAGE;
|
|
5257
5269
|
if (community.features?.noMarkdownVideos && commentPublication.content && contentContainsMarkdownVideos(commentPublication.content)) return messages.ERR_COMMENT_CONTENT_CONTAINS_MARKDOWN_VIDEO;
|
|
5258
5270
|
if (community.features?.noMarkdownAudio && commentPublication.content && contentContainsMarkdownAudio(commentPublication.content)) return messages.ERR_COMMENT_CONTENT_CONTAINS_MARKDOWN_AUDIO;
|
|
5259
|
-
|
|
5260
|
-
|
|
5271
|
+
const mediaUrls = [...commentPublication.link ? [commentPublication.link] : [], ...commentPublication.gallery?.map((item) => item.url) ?? []];
|
|
5272
|
+
const hasImage = mediaUrls.some(isLinkOfImage);
|
|
5273
|
+
const hasVideo = mediaUrls.some((url) => isLinkOfVideo(url) || isLinkOfAnimatedImage(url));
|
|
5274
|
+
const hasAudio = mediaUrls.some(isLinkOfAudio);
|
|
5275
|
+
if (community.features?.noImages && hasImage) return messages.ERR_COMMENT_HAS_LINK_THAT_IS_IMAGE;
|
|
5276
|
+
if (community.features?.noVideos && hasVideo) return messages.ERR_COMMENT_HAS_LINK_THAT_IS_VIDEO;
|
|
5261
5277
|
if (community.features?.noSpoilers && commentPublication.spoiler === true) return messages.ERR_COMMENT_HAS_SPOILER_ENABLED;
|
|
5262
|
-
if (community.features?.noImageReplies && commentPublication.parentCid &&
|
|
5263
|
-
if (community.features?.noVideoReplies && commentPublication.parentCid &&
|
|
5278
|
+
if (community.features?.noImageReplies && commentPublication.parentCid && hasImage) return messages.ERR_REPLY_HAS_LINK_THAT_IS_IMAGE;
|
|
5279
|
+
if (community.features?.noVideoReplies && commentPublication.parentCid && hasVideo) return messages.ERR_REPLY_HAS_LINK_THAT_IS_VIDEO;
|
|
5264
5280
|
if (community.features?.noReplyLinks && commentPublication.parentCid && commentPublication.link) return messages.ERR_REPLY_HAS_LINK;
|
|
5265
|
-
if (community.features?.noAudio &&
|
|
5266
|
-
if (community.features?.noAudioReplies && commentPublication.parentCid &&
|
|
5281
|
+
if (community.features?.noAudio && hasAudio) return messages.ERR_COMMENT_HAS_LINK_THAT_IS_AUDIO;
|
|
5282
|
+
if (community.features?.noAudioReplies && commentPublication.parentCid && hasAudio) return messages.ERR_REPLY_HAS_LINK_THAT_IS_AUDIO;
|
|
5267
5283
|
if (community.features?.noSpoilerReplies && commentPublication.parentCid && commentPublication.spoiler === true) return messages.ERR_REPLY_HAS_SPOILER_ENABLED;
|
|
5268
5284
|
if (community.features?.noNestedReplies && commentPublication.parentCid) {
|
|
5269
5285
|
const parent = community._dbHandler.queryComment(commentPublication.parentCid);
|