peerpigeon 1.1.2 → 1.2.0
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/index.cjs +9011 -0
- package/dist/index.d.cts +2027 -0
- package/dist/index.d.ts +2027 -0
- package/dist/index.js +8944 -0
- package/package.json +53 -86
- package/LICENSE +0 -21
- package/README.md +0 -317
- package/cli.js +0 -1382
- package/dist/peerpigeon-browser.js +0 -13322
- package/dist/peerpigeon-browser.js.map +0 -7
- package/docs/API_DOCUMENTATION.md +0 -1976
- package/docs/BINARY_IMPLEMENTATION_SUMMARY.md +0 -304
- package/docs/BINARY_MESSAGES.md +0 -332
- package/docs/BOOTSTRAP_HUBS.md +0 -319
- package/docs/BROADCAST_STREAMING.md +0 -388
- package/docs/CLI_README.md +0 -371
- package/docs/CLOUD_DEPLOYMENT.md +0 -132
- package/docs/CUSTOM_HUB_NAMESPACES.md +0 -182
- package/docs/CUSTOM_NAMESPACE_IMPLEMENTATION.md +0 -187
- package/docs/DOCUMENTATION_REORGANIZATION.md +0 -172
- package/docs/HUB_P2P_MESH.md +0 -358
- package/docs/HUB_QUICK_REF.md +0 -108
- package/docs/HUB_SCRIPTS.md +0 -341
- package/docs/HUB_SYSTEM.md +0 -599
- package/docs/LOCAL_TESTING.md +0 -135
- package/docs/MIGRATION_COMPLETE.md +0 -93
- package/docs/NETWORK_NAMESPACES.md +0 -212
- package/docs/PIGEONRTC_MIGRATION.md +0 -280
- package/docs/README.md +0 -108
- package/docs/SELECTIVE_STREAMING_GUIDE.md +0 -427
- package/docs/STREAMING_API.md +0 -542
- package/docs/STREAMING_IMPLEMENTATION_SUMMARY.md +0 -286
- package/docs/TEST_CLEANUP_COMPLETE.md +0 -80
- package/examples/binary-message-demo.html +0 -496
- package/examples/bootstrap-hub-example.js +0 -292
- package/examples/broadcast-stream-demo.html +0 -539
- package/examples/browser/vanilla/README.md +0 -278
- package/examples/browser/vanilla/app.js +0 -2478
- package/examples/browser/vanilla/index.html +0 -603
- package/examples/browser/vanilla/minimal/README.md +0 -55
- package/examples/browser/vanilla/minimal/index.html +0 -75
- package/examples/browser/vanilla/minimal/minimal.js +0 -234
- package/examples/browser/vanilla/peerpigeon-browser.js +0 -13322
- package/examples/browser/vanilla/pigeonlogo.svg +0 -51
- package/examples/browser/vanilla/styles.css +0 -998
- package/examples/browser/vanilla/test-bundle.html +0 -35
- package/examples/browser/vue/EXPRESS_SOLUTION.md +0 -183
- package/examples/browser/vue/ICE_DEBUG.md +0 -171
- package/examples/browser/vue/IMPLEMENTATION.md +0 -218
- package/examples/browser/vue/QUICK_START.md +0 -149
- package/examples/browser/vue/README.md +0 -303
- package/examples/browser/vue/dist/assets/index-DJmfz_4i.js +0 -57
- package/examples/browser/vue/dist/assets/index-zmUJURg4.css +0 -1
- package/examples/browser/vue/dist/index.html +0 -32
- package/examples/browser/vue/dist/peerpigeon-browser.js +0 -13322
- package/examples/browser/vue/dist/pigeonlogo.svg +0 -51
- package/examples/browser/vue/index.html +0 -31
- package/examples/browser/vue/node_modules/.package-lock.json +0 -1305
- package/examples/browser/vue/node_modules/.vue-global-types/vue_99_0.d.ts +0 -136
- package/examples/browser/vue/node_modules/@babel/helper-string-parser/LICENSE +0 -22
- package/examples/browser/vue/node_modules/@babel/helper-string-parser/README.md +0 -19
- package/examples/browser/vue/node_modules/@babel/helper-string-parser/lib/index.js +0 -295
- package/examples/browser/vue/node_modules/@babel/helper-string-parser/lib/index.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/helper-string-parser/package.json +0 -31
- package/examples/browser/vue/node_modules/@babel/helper-validator-identifier/LICENSE +0 -22
- package/examples/browser/vue/node_modules/@babel/helper-validator-identifier/README.md +0 -19
- package/examples/browser/vue/node_modules/@babel/helper-validator-identifier/lib/identifier.js +0 -70
- package/examples/browser/vue/node_modules/@babel/helper-validator-identifier/lib/identifier.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/helper-validator-identifier/lib/index.js +0 -57
- package/examples/browser/vue/node_modules/@babel/helper-validator-identifier/lib/index.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/helper-validator-identifier/lib/keyword.js +0 -35
- package/examples/browser/vue/node_modules/@babel/helper-validator-identifier/lib/keyword.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/helper-validator-identifier/package.json +0 -31
- package/examples/browser/vue/node_modules/@babel/parser/CHANGELOG.md +0 -1073
- package/examples/browser/vue/node_modules/@babel/parser/LICENSE +0 -19
- package/examples/browser/vue/node_modules/@babel/parser/README.md +0 -19
- package/examples/browser/vue/node_modules/@babel/parser/bin/babel-parser.js +0 -15
- package/examples/browser/vue/node_modules/@babel/parser/lib/index.js +0 -14595
- package/examples/browser/vue/node_modules/@babel/parser/lib/index.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/parser/package.json +0 -50
- package/examples/browser/vue/node_modules/@babel/parser/typings/babel-parser.d.ts +0 -239
- package/examples/browser/vue/node_modules/@babel/types/LICENSE +0 -22
- package/examples/browser/vue/node_modules/@babel/types/README.md +0 -19
- package/examples/browser/vue/node_modules/@babel/types/lib/asserts/assertNode.js +0 -16
- package/examples/browser/vue/node_modules/@babel/types/lib/asserts/assertNode.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/asserts/generated/index.js +0 -1251
- package/examples/browser/vue/node_modules/@babel/types/lib/asserts/generated/index.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/ast-types/generated/index.js +0 -3
- package/examples/browser/vue/node_modules/@babel/types/lib/ast-types/generated/index.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js +0 -18
- package/examples/browser/vue/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js +0 -31
- package/examples/browser/vue/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/builders/generated/index.js +0 -29
- package/examples/browser/vue/node_modules/@babel/types/lib/builders/generated/index.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/builders/generated/lowercase.js +0 -2896
- package/examples/browser/vue/node_modules/@babel/types/lib/builders/generated/lowercase.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/builders/generated/uppercase.js +0 -274
- package/examples/browser/vue/node_modules/@babel/types/lib/builders/generated/uppercase.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/builders/productions.js +0 -12
- package/examples/browser/vue/node_modules/@babel/types/lib/builders/productions.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/builders/react/buildChildren.js +0 -24
- package/examples/browser/vue/node_modules/@babel/types/lib/builders/react/buildChildren.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js +0 -22
- package/examples/browser/vue/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/builders/validateNode.js +0 -21
- package/examples/browser/vue/node_modules/@babel/types/lib/builders/validateNode.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/clone/clone.js +0 -12
- package/examples/browser/vue/node_modules/@babel/types/lib/clone/clone.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/clone/cloneDeep.js +0 -12
- package/examples/browser/vue/node_modules/@babel/types/lib/clone/cloneDeep.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js +0 -12
- package/examples/browser/vue/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/clone/cloneNode.js +0 -107
- package/examples/browser/vue/node_modules/@babel/types/lib/clone/cloneNode.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js +0 -12
- package/examples/browser/vue/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/comments/addComment.js +0 -15
- package/examples/browser/vue/node_modules/@babel/types/lib/comments/addComment.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/comments/addComments.js +0 -22
- package/examples/browser/vue/node_modules/@babel/types/lib/comments/addComments.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/comments/inheritInnerComments.js +0 -12
- package/examples/browser/vue/node_modules/@babel/types/lib/comments/inheritInnerComments.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/comments/inheritLeadingComments.js +0 -12
- package/examples/browser/vue/node_modules/@babel/types/lib/comments/inheritLeadingComments.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/comments/inheritTrailingComments.js +0 -12
- package/examples/browser/vue/node_modules/@babel/types/lib/comments/inheritTrailingComments.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/comments/inheritsComments.js +0 -17
- package/examples/browser/vue/node_modules/@babel/types/lib/comments/inheritsComments.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/comments/removeComments.js +0 -15
- package/examples/browser/vue/node_modules/@babel/types/lib/comments/removeComments.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/constants/generated/index.js +0 -60
- package/examples/browser/vue/node_modules/@babel/types/lib/constants/generated/index.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/constants/index.js +0 -33
- package/examples/browser/vue/node_modules/@babel/types/lib/constants/index.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/ensureBlock.js +0 -14
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/ensureBlock.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js +0 -66
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js +0 -14
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/toBlock.js +0 -29
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/toBlock.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/toComputedKey.js +0 -14
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/toComputedKey.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/toExpression.js +0 -28
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/toExpression.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/toIdentifier.js +0 -25
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/toIdentifier.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/toKeyAlias.js +0 -38
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/toKeyAlias.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/toSequenceExpression.js +0 -20
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/toSequenceExpression.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/toStatement.js +0 -39
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/toStatement.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/valueToNode.js +0 -89
- package/examples/browser/vue/node_modules/@babel/types/lib/converters/valueToNode.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/core.js +0 -1659
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/core.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/deprecated-aliases.js +0 -11
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/deprecated-aliases.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/experimental.js +0 -126
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/experimental.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/flow.js +0 -495
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/flow.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/index.js +0 -100
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/index.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/jsx.js +0 -157
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/jsx.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/misc.js +0 -33
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/misc.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/placeholders.js +0 -27
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/placeholders.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/typescript.js +0 -528
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/typescript.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/utils.js +0 -292
- package/examples/browser/vue/node_modules/@babel/types/lib/definitions/utils.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/index-legacy.d.ts +0 -2797
- package/examples/browser/vue/node_modules/@babel/types/lib/index.d.ts +0 -3308
- package/examples/browser/vue/node_modules/@babel/types/lib/index.js +0 -584
- package/examples/browser/vue/node_modules/@babel/types/lib/index.js.flow +0 -2650
- package/examples/browser/vue/node_modules/@babel/types/lib/index.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js +0 -15
- package/examples/browser/vue/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js +0 -65
- package/examples/browser/vue/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/modifications/inherits.js +0 -28
- package/examples/browser/vue/node_modules/@babel/types/lib/modifications/inherits.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js +0 -17
- package/examples/browser/vue/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/modifications/removeProperties.js +0 -24
- package/examples/browser/vue/node_modules/@babel/types/lib/modifications/removeProperties.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js +0 -14
- package/examples/browser/vue/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js +0 -66
- package/examples/browser/vue/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/retrievers/getAssignmentIdentifiers.js +0 -48
- package/examples/browser/vue/node_modules/@babel/types/lib/retrievers/getAssignmentIdentifiers.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js +0 -102
- package/examples/browser/vue/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/retrievers/getFunctionName.js +0 -63
- package/examples/browser/vue/node_modules/@babel/types/lib/retrievers/getFunctionName.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js +0 -13
- package/examples/browser/vue/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/traverse/traverse.js +0 -50
- package/examples/browser/vue/node_modules/@babel/types/lib/traverse/traverse.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/traverse/traverseFast.js +0 -40
- package/examples/browser/vue/node_modules/@babel/types/lib/traverse/traverseFast.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/utils/deprecationWarning.js +0 -44
- package/examples/browser/vue/node_modules/@babel/types/lib/utils/deprecationWarning.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/utils/inherit.js +0 -13
- package/examples/browser/vue/node_modules/@babel/types/lib/utils/inherit.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js +0 -40
- package/examples/browser/vue/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/utils/shallowEqual.js +0 -17
- package/examples/browser/vue/node_modules/@babel/types/lib/utils/shallowEqual.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js +0 -13
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/generated/index.js +0 -2797
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/generated/index.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/is.js +0 -27
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/is.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isBinding.js +0 -27
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isBinding.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isBlockScoped.js +0 -13
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isBlockScoped.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isImmutable.js +0 -21
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isImmutable.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isLet.js +0 -17
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isLet.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isNode.js +0 -12
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isNode.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isNodesEquivalent.js +0 -57
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isNodesEquivalent.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isPlaceholderType.js +0 -15
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isPlaceholderType.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isReferenced.js +0 -96
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isReferenced.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isScope.js +0 -18
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isScope.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isSpecifierDefault.js +0 -14
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isSpecifierDefault.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isType.js +0 -17
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isType.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isValidES3Identifier.js +0 -13
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isValidES3Identifier.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isValidIdentifier.js +0 -18
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isValidIdentifier.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isVar.js +0 -19
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/isVar.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/matchesPattern.js +0 -44
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/matchesPattern.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/react/isCompatTag.js +0 -11
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/react/isCompatTag.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/react/isReactComponent.js +0 -11
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/react/isReactComponent.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/validate.js +0 -42
- package/examples/browser/vue/node_modules/@babel/types/lib/validators/validate.js.map +0 -1
- package/examples/browser/vue/node_modules/@babel/types/package.json +0 -39
- package/examples/browser/vue/node_modules/@esbuild/darwin-arm64/README.md +0 -3
- package/examples/browser/vue/node_modules/@esbuild/darwin-arm64/bin/esbuild +0 -0
- package/examples/browser/vue/node_modules/@esbuild/darwin-arm64/package.json +0 -20
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/LICENSE +0 -19
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/README.md +0 -264
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +0 -423
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +0 -6
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js +0 -464
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map +0 -6
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/package.json +0 -63
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/src/scopes.ts +0 -345
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts +0 -111
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/src/strings.ts +0 -65
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/src/vlq.ts +0 -55
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts +0 -50
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts.map +0 -1
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts +0 -50
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts.map +0 -1
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts +0 -9
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts.map +0 -1
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts +0 -9
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts.map +0 -1
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts +0 -16
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts.map +0 -1
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts +0 -16
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts.map +0 -1
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts +0 -7
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts.map +0 -1
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts +0 -7
- package/examples/browser/vue/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts.map +0 -1
- package/examples/browser/vue/node_modules/@rollup/rollup-darwin-arm64/README.md +0 -3
- package/examples/browser/vue/node_modules/@rollup/rollup-darwin-arm64/package.json +0 -22
- package/examples/browser/vue/node_modules/@rollup/rollup-darwin-arm64/rollup.darwin-arm64.node +0 -0
- package/examples/browser/vue/node_modules/@types/estree/LICENSE +0 -21
- package/examples/browser/vue/node_modules/@types/estree/README.md +0 -15
- package/examples/browser/vue/node_modules/@types/estree/flow.d.ts +0 -167
- package/examples/browser/vue/node_modules/@types/estree/index.d.ts +0 -694
- package/examples/browser/vue/node_modules/@types/estree/package.json +0 -27
- package/examples/browser/vue/node_modules/@types/web-bluetooth/LICENSE +0 -21
- package/examples/browser/vue/node_modules/@types/web-bluetooth/README.md +0 -15
- package/examples/browser/vue/node_modules/@types/web-bluetooth/index.d.ts +0 -193
- package/examples/browser/vue/node_modules/@types/web-bluetooth/package.json +0 -40
- package/examples/browser/vue/node_modules/@vitejs/plugin-vue/LICENSE +0 -21
- package/examples/browser/vue/node_modules/@vitejs/plugin-vue/README.md +0 -278
- package/examples/browser/vue/node_modules/@vitejs/plugin-vue/dist/index.cjs +0 -3105
- package/examples/browser/vue/node_modules/@vitejs/plugin-vue/dist/index.d.cts +0 -113
- package/examples/browser/vue/node_modules/@vitejs/plugin-vue/dist/index.d.mts +0 -111
- package/examples/browser/vue/node_modules/@vitejs/plugin-vue/dist/index.d.ts +0 -113
- package/examples/browser/vue/node_modules/@vitejs/plugin-vue/dist/index.mjs +0 -3090
- package/examples/browser/vue/node_modules/@vitejs/plugin-vue/package.json +0 -50
- package/examples/browser/vue/node_modules/@vue/compiler-core/LICENSE +0 -21
- package/examples/browser/vue/node_modules/@vue/compiler-core/README.md +0 -1
- package/examples/browser/vue/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js +0 -6864
- package/examples/browser/vue/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +0 -6741
- package/examples/browser/vue/node_modules/@vue/compiler-core/dist/compiler-core.d.ts +0 -1096
- package/examples/browser/vue/node_modules/@vue/compiler-core/dist/compiler-core.esm-bundler.js +0 -5814
- package/examples/browser/vue/node_modules/@vue/compiler-core/index.js +0 -7
- package/examples/browser/vue/node_modules/@vue/compiler-core/package.json +0 -58
- package/examples/browser/vue/node_modules/@vue/compiler-dom/LICENSE +0 -21
- package/examples/browser/vue/node_modules/@vue/compiler-dom/README.md +0 -1
- package/examples/browser/vue/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js +0 -934
- package/examples/browser/vue/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +0 -689
- package/examples/browser/vue/node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts +0 -45
- package/examples/browser/vue/node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.js +0 -6623
- package/examples/browser/vue/node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +0 -14
- package/examples/browser/vue/node_modules/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js +0 -690
- package/examples/browser/vue/node_modules/@vue/compiler-dom/dist/compiler-dom.global.js +0 -6790
- package/examples/browser/vue/node_modules/@vue/compiler-dom/dist/compiler-dom.global.prod.js +0 -14
- package/examples/browser/vue/node_modules/@vue/compiler-dom/index.js +0 -7
- package/examples/browser/vue/node_modules/@vue/compiler-dom/package.json +0 -57
- package/examples/browser/vue/node_modules/@vue/compiler-sfc/LICENSE +0 -21
- package/examples/browser/vue/node_modules/@vue/compiler-sfc/README.md +0 -80
- package/examples/browser/vue/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +0 -25084
- package/examples/browser/vue/node_modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts +0 -485
- package/examples/browser/vue/node_modules/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +0 -50571
- package/examples/browser/vue/node_modules/@vue/compiler-sfc/package.json +0 -67
- package/examples/browser/vue/node_modules/@vue/compiler-ssr/LICENSE +0 -21
- package/examples/browser/vue/node_modules/@vue/compiler-ssr/README.md +0 -1
- package/examples/browser/vue/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +0 -1411
- package/examples/browser/vue/node_modules/@vue/compiler-ssr/dist/compiler-ssr.d.ts +0 -4
- package/examples/browser/vue/node_modules/@vue/compiler-ssr/package.json +0 -34
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/cjs/api/api.js +0 -2
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/cjs/api/app.js +0 -2
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/cjs/api/component.js +0 -2
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/cjs/api/context.js +0 -2
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/cjs/api/hooks.js +0 -2
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/cjs/api/index.js +0 -22
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/cjs/api/util.js +0 -2
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/cjs/const.js +0 -5
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/cjs/env.js +0 -17
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/cjs/index.js +0 -45
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/cjs/plugin.js +0 -2
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/cjs/proxy.js +0 -111
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/cjs/time.js +0 -28
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/api/api.d.ts +0 -108
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/api/api.js +0 -1
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/api/app.d.ts +0 -1
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/api/app.js +0 -1
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/api/component.d.ts +0 -78
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/api/component.js +0 -1
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/api/context.d.ts +0 -5
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/api/context.js +0 -1
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/api/hooks.d.ts +0 -180
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/api/hooks.js +0 -1
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/api/index.d.ts +0 -6
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/api/index.js +0 -6
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/api/util.d.ts +0 -4
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/api/util.js +0 -1
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/const.d.ts +0 -2
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/const.js +0 -2
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/env.d.ts +0 -15
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/env.js +0 -12
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/index.d.ts +0 -18
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/index.js +0 -27
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/plugin.d.ts +0 -47
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/plugin.js +0 -1
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/proxy.d.ts +0 -20
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/proxy.js +0 -107
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/time.d.ts +0 -2
- package/examples/browser/vue/node_modules/@vue/devtools-api/lib/esm/time.js +0 -23
- package/examples/browser/vue/node_modules/@vue/devtools-api/package.json +0 -37
- package/examples/browser/vue/node_modules/@vue/reactivity/LICENSE +0 -21
- package/examples/browser/vue/node_modules/@vue/reactivity/README.md +0 -19
- package/examples/browser/vue/node_modules/@vue/reactivity/dist/reactivity.cjs.js +0 -1963
- package/examples/browser/vue/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +0 -1807
- package/examples/browser/vue/node_modules/@vue/reactivity/dist/reactivity.d.ts +0 -757
- package/examples/browser/vue/node_modules/@vue/reactivity/dist/reactivity.esm-browser.js +0 -1961
- package/examples/browser/vue/node_modules/@vue/reactivity/dist/reactivity.esm-browser.prod.js +0 -5
- package/examples/browser/vue/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js +0 -1920
- package/examples/browser/vue/node_modules/@vue/reactivity/dist/reactivity.global.js +0 -2017
- package/examples/browser/vue/node_modules/@vue/reactivity/dist/reactivity.global.prod.js +0 -5
- package/examples/browser/vue/node_modules/@vue/reactivity/index.js +0 -7
- package/examples/browser/vue/node_modules/@vue/reactivity/package.json +0 -55
- package/examples/browser/vue/node_modules/@vue/runtime-core/LICENSE +0 -21
- package/examples/browser/vue/node_modules/@vue/runtime-core/README.md +0 -28
- package/examples/browser/vue/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js +0 -8586
- package/examples/browser/vue/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +0 -6732
- package/examples/browser/vue/node_modules/@vue/runtime-core/dist/runtime-core.d.ts +0 -1839
- package/examples/browser/vue/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +0 -8515
- package/examples/browser/vue/node_modules/@vue/runtime-core/index.js +0 -7
- package/examples/browser/vue/node_modules/@vue/runtime-core/package.json +0 -52
- package/examples/browser/vue/node_modules/@vue/runtime-dom/LICENSE +0 -21
- package/examples/browser/vue/node_modules/@vue/runtime-dom/README.md +0 -13
- package/examples/browser/vue/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.js +0 -1851
- package/examples/browser/vue/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +0 -1703
- package/examples/browser/vue/node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts +0 -1409
- package/examples/browser/vue/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-browser.js +0 -12499
- package/examples/browser/vue/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-browser.prod.js +0 -6
- package/examples/browser/vue/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +0 -1892
- package/examples/browser/vue/node_modules/@vue/runtime-dom/dist/runtime-dom.global.js +0 -12550
- package/examples/browser/vue/node_modules/@vue/runtime-dom/dist/runtime-dom.global.prod.js +0 -6
- package/examples/browser/vue/node_modules/@vue/runtime-dom/index.js +0 -7
- package/examples/browser/vue/node_modules/@vue/runtime-dom/package.json +0 -60
- package/examples/browser/vue/node_modules/@vue/server-renderer/LICENSE +0 -21
- package/examples/browser/vue/node_modules/@vue/server-renderer/README.md +0 -178
- package/examples/browser/vue/node_modules/@vue/server-renderer/dist/server-renderer.cjs.js +0 -1151
- package/examples/browser/vue/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +0 -879
- package/examples/browser/vue/node_modules/@vue/server-renderer/dist/server-renderer.d.ts +0 -65
- package/examples/browser/vue/node_modules/@vue/server-renderer/dist/server-renderer.esm-browser.js +0 -8488
- package/examples/browser/vue/node_modules/@vue/server-renderer/dist/server-renderer.esm-browser.prod.js +0 -5
- package/examples/browser/vue/node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.js +0 -1088
- package/examples/browser/vue/node_modules/@vue/server-renderer/index.js +0 -7
- package/examples/browser/vue/node_modules/@vue/server-renderer/package.json +0 -55
- package/examples/browser/vue/node_modules/@vue/shared/LICENSE +0 -21
- package/examples/browser/vue/node_modules/@vue/shared/README.md +0 -3
- package/examples/browser/vue/node_modules/@vue/shared/dist/shared.cjs.js +0 -612
- package/examples/browser/vue/node_modules/@vue/shared/dist/shared.cjs.prod.js +0 -604
- package/examples/browser/vue/node_modules/@vue/shared/dist/shared.d.ts +0 -334
- package/examples/browser/vue/node_modules/@vue/shared/dist/shared.esm-bundler.js +0 -536
- package/examples/browser/vue/node_modules/@vue/shared/index.js +0 -7
- package/examples/browser/vue/node_modules/@vue/shared/package.json +0 -47
- package/examples/browser/vue/node_modules/@vueuse/core/LICENSE +0 -21
- package/examples/browser/vue/node_modules/@vueuse/core/README.md +0 -124
- package/examples/browser/vue/node_modules/@vueuse/core/index.cjs +0 -7660
- package/examples/browser/vue/node_modules/@vueuse/core/index.d.cts +0 -5382
- package/examples/browser/vue/node_modules/@vueuse/core/index.d.mts +0 -5382
- package/examples/browser/vue/node_modules/@vueuse/core/index.d.ts +0 -5382
- package/examples/browser/vue/node_modules/@vueuse/core/index.iife.js +0 -7780
- package/examples/browser/vue/node_modules/@vueuse/core/index.iife.min.js +0 -1
- package/examples/browser/vue/node_modules/@vueuse/core/index.mjs +0 -7486
- package/examples/browser/vue/node_modules/@vueuse/core/metadata.cjs +0 -1
- package/examples/browser/vue/node_modules/@vueuse/core/metadata.d.cts +0 -1
- package/examples/browser/vue/node_modules/@vueuse/core/metadata.d.mts +0 -1
- package/examples/browser/vue/node_modules/@vueuse/core/metadata.d.ts +0 -1
- package/examples/browser/vue/node_modules/@vueuse/core/metadata.mjs +0 -1
- package/examples/browser/vue/node_modules/@vueuse/core/package.json +0 -45
- package/examples/browser/vue/node_modules/@vueuse/metadata/LICENSE +0 -21
- package/examples/browser/vue/node_modules/@vueuse/metadata/index.cjs +0 -2638
- package/examples/browser/vue/node_modules/@vueuse/metadata/index.d.cts +0 -76
- package/examples/browser/vue/node_modules/@vueuse/metadata/index.d.mts +0 -76
- package/examples/browser/vue/node_modules/@vueuse/metadata/index.d.ts +0 -76
- package/examples/browser/vue/node_modules/@vueuse/metadata/index.json +0 -2584
- package/examples/browser/vue/node_modules/@vueuse/metadata/index.mjs +0 -2626
- package/examples/browser/vue/node_modules/@vueuse/metadata/package.json +0 -39
- package/examples/browser/vue/node_modules/@vueuse/shared/LICENSE +0 -21
- package/examples/browser/vue/node_modules/@vueuse/shared/index.cjs +0 -1695
- package/examples/browser/vue/node_modules/@vueuse/shared/index.d.cts +0 -1221
- package/examples/browser/vue/node_modules/@vueuse/shared/index.d.mts +0 -1221
- package/examples/browser/vue/node_modules/@vueuse/shared/index.d.ts +0 -1221
- package/examples/browser/vue/node_modules/@vueuse/shared/index.iife.js +0 -1816
- package/examples/browser/vue/node_modules/@vueuse/shared/index.iife.min.js +0 -1
- package/examples/browser/vue/node_modules/@vueuse/shared/index.mjs +0 -1575
- package/examples/browser/vue/node_modules/@vueuse/shared/package.json +0 -37
- package/examples/browser/vue/node_modules/csstype/LICENSE +0 -19
- package/examples/browser/vue/node_modules/csstype/README.md +0 -277
- package/examples/browser/vue/node_modules/csstype/index.d.ts +0 -21297
- package/examples/browser/vue/node_modules/csstype/index.js.flow +0 -6612
- package/examples/browser/vue/node_modules/csstype/package.json +0 -66
- package/examples/browser/vue/node_modules/entities/LICENSE +0 -11
- package/examples/browser/vue/node_modules/entities/lib/decode.d.ts +0 -211
- package/examples/browser/vue/node_modules/entities/lib/decode.d.ts.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/decode.js +0 -536
- package/examples/browser/vue/node_modules/entities/lib/decode.js.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/decode_codepoint.d.ts +0 -19
- package/examples/browser/vue/node_modules/entities/lib/decode_codepoint.d.ts.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/decode_codepoint.js +0 -76
- package/examples/browser/vue/node_modules/entities/lib/decode_codepoint.js.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/encode.d.ts +0 -22
- package/examples/browser/vue/node_modules/entities/lib/encode.d.ts.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/encode.js +0 -77
- package/examples/browser/vue/node_modules/entities/lib/encode.js.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/escape.d.ts +0 -43
- package/examples/browser/vue/node_modules/entities/lib/escape.d.ts.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/escape.js +0 -122
- package/examples/browser/vue/node_modules/entities/lib/escape.js.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/esm/decode.d.ts +0 -211
- package/examples/browser/vue/node_modules/entities/lib/esm/decode.d.ts.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/esm/decode.js +0 -496
- package/examples/browser/vue/node_modules/entities/lib/esm/decode.js.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/esm/decode_codepoint.d.ts +0 -19
- package/examples/browser/vue/node_modules/entities/lib/esm/decode_codepoint.d.ts.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/esm/decode_codepoint.js +0 -71
- package/examples/browser/vue/node_modules/entities/lib/esm/decode_codepoint.js.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/esm/encode.d.ts +0 -22
- package/examples/browser/vue/node_modules/entities/lib/esm/encode.d.ts.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/esm/encode.js +0 -69
- package/examples/browser/vue/node_modules/entities/lib/esm/encode.js.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/esm/escape.d.ts +0 -43
- package/examples/browser/vue/node_modules/entities/lib/esm/escape.d.ts.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/esm/escape.js +0 -116
- package/examples/browser/vue/node_modules/entities/lib/esm/escape.js.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/esm/generated/decode-data-html.d.ts +0 -3
- package/examples/browser/vue/node_modules/entities/lib/esm/generated/decode-data-html.d.ts.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/esm/generated/decode-data-html.js +0 -7
- package/examples/browser/vue/node_modules/entities/lib/esm/generated/decode-data-html.js.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts +0 -3
- package/examples/browser/vue/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/esm/generated/decode-data-xml.js +0 -7
- package/examples/browser/vue/node_modules/entities/lib/esm/generated/decode-data-xml.js.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/esm/generated/encode-html.d.ts +0 -8
- package/examples/browser/vue/node_modules/entities/lib/esm/generated/encode-html.d.ts.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/esm/generated/encode-html.js +0 -10
- package/examples/browser/vue/node_modules/entities/lib/esm/generated/encode-html.js.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/esm/index.d.ts +0 -96
- package/examples/browser/vue/node_modules/entities/lib/esm/index.d.ts.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/esm/index.js +0 -99
- package/examples/browser/vue/node_modules/entities/lib/esm/index.js.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/esm/package.json +0 -1
- package/examples/browser/vue/node_modules/entities/lib/generated/decode-data-html.d.ts +0 -3
- package/examples/browser/vue/node_modules/entities/lib/generated/decode-data-html.d.ts.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/generated/decode-data-html.js +0 -9
- package/examples/browser/vue/node_modules/entities/lib/generated/decode-data-html.js.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/generated/decode-data-xml.d.ts +0 -3
- package/examples/browser/vue/node_modules/entities/lib/generated/decode-data-xml.d.ts.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/generated/decode-data-xml.js +0 -9
- package/examples/browser/vue/node_modules/entities/lib/generated/decode-data-xml.js.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/generated/encode-html.d.ts +0 -8
- package/examples/browser/vue/node_modules/entities/lib/generated/encode-html.d.ts.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/generated/encode-html.js +0 -12
- package/examples/browser/vue/node_modules/entities/lib/generated/encode-html.js.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/index.d.ts +0 -96
- package/examples/browser/vue/node_modules/entities/lib/index.d.ts.map +0 -1
- package/examples/browser/vue/node_modules/entities/lib/index.js +0 -126
- package/examples/browser/vue/node_modules/entities/lib/index.js.map +0 -1
- package/examples/browser/vue/node_modules/entities/package.json +0 -90
- package/examples/browser/vue/node_modules/entities/readme.md +0 -122
- package/examples/browser/vue/node_modules/esbuild/LICENSE.md +0 -21
- package/examples/browser/vue/node_modules/esbuild/README.md +0 -3
- package/examples/browser/vue/node_modules/esbuild/bin/esbuild +0 -0
- package/examples/browser/vue/node_modules/esbuild/install.js +0 -285
- package/examples/browser/vue/node_modules/esbuild/lib/main.d.ts +0 -705
- package/examples/browser/vue/node_modules/esbuild/lib/main.js +0 -2239
- package/examples/browser/vue/node_modules/esbuild/package.json +0 -46
- package/examples/browser/vue/node_modules/estree-walker/CHANGELOG.md +0 -92
- package/examples/browser/vue/node_modules/estree-walker/LICENSE +0 -7
- package/examples/browser/vue/node_modules/estree-walker/README.md +0 -48
- package/examples/browser/vue/node_modules/estree-walker/dist/esm/estree-walker.js +0 -333
- package/examples/browser/vue/node_modules/estree-walker/dist/esm/package.json +0 -1
- package/examples/browser/vue/node_modules/estree-walker/dist/umd/estree-walker.js +0 -344
- package/examples/browser/vue/node_modules/estree-walker/package.json +0 -37
- package/examples/browser/vue/node_modules/estree-walker/src/async.js +0 -118
- package/examples/browser/vue/node_modules/estree-walker/src/index.js +0 -35
- package/examples/browser/vue/node_modules/estree-walker/src/package.json +0 -1
- package/examples/browser/vue/node_modules/estree-walker/src/sync.js +0 -118
- package/examples/browser/vue/node_modules/estree-walker/src/walker.js +0 -61
- package/examples/browser/vue/node_modules/estree-walker/types/async.d.ts +0 -53
- package/examples/browser/vue/node_modules/estree-walker/types/index.d.ts +0 -56
- package/examples/browser/vue/node_modules/estree-walker/types/sync.d.ts +0 -53
- package/examples/browser/vue/node_modules/estree-walker/types/tsconfig.tsbuildinfo +0 -345
- package/examples/browser/vue/node_modules/estree-walker/types/walker.d.ts +0 -37
- package/examples/browser/vue/node_modules/fsevents/LICENSE +0 -22
- package/examples/browser/vue/node_modules/fsevents/README.md +0 -89
- package/examples/browser/vue/node_modules/fsevents/fsevents.d.ts +0 -46
- package/examples/browser/vue/node_modules/fsevents/fsevents.js +0 -83
- package/examples/browser/vue/node_modules/fsevents/fsevents.node +0 -0
- package/examples/browser/vue/node_modules/fsevents/package.json +0 -62
- package/examples/browser/vue/node_modules/magic-string/LICENSE +0 -7
- package/examples/browser/vue/node_modules/magic-string/README.md +0 -324
- package/examples/browser/vue/node_modules/magic-string/dist/magic-string.cjs.d.ts +0 -289
- package/examples/browser/vue/node_modules/magic-string/dist/magic-string.cjs.js +0 -1594
- package/examples/browser/vue/node_modules/magic-string/dist/magic-string.cjs.js.map +0 -1
- package/examples/browser/vue/node_modules/magic-string/dist/magic-string.es.d.mts +0 -289
- package/examples/browser/vue/node_modules/magic-string/dist/magic-string.es.mjs +0 -1588
- package/examples/browser/vue/node_modules/magic-string/dist/magic-string.es.mjs.map +0 -1
- package/examples/browser/vue/node_modules/magic-string/dist/magic-string.umd.js +0 -1682
- package/examples/browser/vue/node_modules/magic-string/dist/magic-string.umd.js.map +0 -1
- package/examples/browser/vue/node_modules/magic-string/package.json +0 -70
- package/examples/browser/vue/node_modules/nanoid/LICENSE +0 -20
- package/examples/browser/vue/node_modules/nanoid/README.md +0 -39
- package/examples/browser/vue/node_modules/nanoid/async/index.browser.cjs +0 -69
- package/examples/browser/vue/node_modules/nanoid/async/index.browser.js +0 -34
- package/examples/browser/vue/node_modules/nanoid/async/index.cjs +0 -71
- package/examples/browser/vue/node_modules/nanoid/async/index.d.ts +0 -56
- package/examples/browser/vue/node_modules/nanoid/async/index.js +0 -35
- package/examples/browser/vue/node_modules/nanoid/async/index.native.js +0 -26
- package/examples/browser/vue/node_modules/nanoid/async/package.json +0 -12
- package/examples/browser/vue/node_modules/nanoid/bin/nanoid.cjs +0 -55
- package/examples/browser/vue/node_modules/nanoid/index.browser.cjs +0 -72
- package/examples/browser/vue/node_modules/nanoid/index.browser.js +0 -34
- package/examples/browser/vue/node_modules/nanoid/index.cjs +0 -85
- package/examples/browser/vue/node_modules/nanoid/index.d.cts +0 -91
- package/examples/browser/vue/node_modules/nanoid/index.d.ts +0 -91
- package/examples/browser/vue/node_modules/nanoid/index.js +0 -45
- package/examples/browser/vue/node_modules/nanoid/nanoid.js +0 -1
- package/examples/browser/vue/node_modules/nanoid/non-secure/index.cjs +0 -34
- package/examples/browser/vue/node_modules/nanoid/non-secure/index.d.ts +0 -33
- package/examples/browser/vue/node_modules/nanoid/non-secure/index.js +0 -21
- package/examples/browser/vue/node_modules/nanoid/non-secure/package.json +0 -6
- package/examples/browser/vue/node_modules/nanoid/package.json +0 -89
- package/examples/browser/vue/node_modules/nanoid/url-alphabet/index.cjs +0 -7
- package/examples/browser/vue/node_modules/nanoid/url-alphabet/index.js +0 -3
- package/examples/browser/vue/node_modules/nanoid/url-alphabet/package.json +0 -6
- package/examples/browser/vue/node_modules/picocolors/LICENSE +0 -15
- package/examples/browser/vue/node_modules/picocolors/README.md +0 -21
- package/examples/browser/vue/node_modules/picocolors/package.json +0 -25
- package/examples/browser/vue/node_modules/picocolors/picocolors.browser.js +0 -4
- package/examples/browser/vue/node_modules/picocolors/picocolors.d.ts +0 -5
- package/examples/browser/vue/node_modules/picocolors/picocolors.js +0 -75
- package/examples/browser/vue/node_modules/picocolors/types.d.ts +0 -51
- package/examples/browser/vue/node_modules/pinia/LICENSE +0 -21
- package/examples/browser/vue/node_modules/pinia/README.md +0 -24
- package/examples/browser/vue/node_modules/pinia/dist/pinia.cjs +0 -2061
- package/examples/browser/vue/node_modules/pinia/dist/pinia.d.ts +0 -1074
- package/examples/browser/vue/node_modules/pinia/dist/pinia.esm-browser.js +0 -2036
- package/examples/browser/vue/node_modules/pinia/dist/pinia.iife.js +0 -2223
- package/examples/browser/vue/node_modules/pinia/dist/pinia.iife.prod.js +0 -7
- package/examples/browser/vue/node_modules/pinia/dist/pinia.mjs +0 -2044
- package/examples/browser/vue/node_modules/pinia/dist/pinia.prod.cjs +0 -846
- package/examples/browser/vue/node_modules/pinia/index.cjs +0 -7
- package/examples/browser/vue/node_modules/pinia/index.js +0 -7
- package/examples/browser/vue/node_modules/pinia/package.json +0 -96
- package/examples/browser/vue/node_modules/postcss/LICENSE +0 -20
- package/examples/browser/vue/node_modules/postcss/README.md +0 -29
- package/examples/browser/vue/node_modules/postcss/lib/at-rule.d.ts +0 -140
- package/examples/browser/vue/node_modules/postcss/lib/at-rule.js +0 -25
- package/examples/browser/vue/node_modules/postcss/lib/comment.d.ts +0 -68
- package/examples/browser/vue/node_modules/postcss/lib/comment.js +0 -13
- package/examples/browser/vue/node_modules/postcss/lib/container.d.ts +0 -483
- package/examples/browser/vue/node_modules/postcss/lib/container.js +0 -447
- package/examples/browser/vue/node_modules/postcss/lib/css-syntax-error.d.ts +0 -248
- package/examples/browser/vue/node_modules/postcss/lib/css-syntax-error.js +0 -133
- package/examples/browser/vue/node_modules/postcss/lib/declaration.d.ts +0 -151
- package/examples/browser/vue/node_modules/postcss/lib/declaration.js +0 -24
- package/examples/browser/vue/node_modules/postcss/lib/document.d.ts +0 -69
- package/examples/browser/vue/node_modules/postcss/lib/document.js +0 -33
- package/examples/browser/vue/node_modules/postcss/lib/fromJSON.d.ts +0 -9
- package/examples/browser/vue/node_modules/postcss/lib/fromJSON.js +0 -54
- package/examples/browser/vue/node_modules/postcss/lib/input.d.ts +0 -227
- package/examples/browser/vue/node_modules/postcss/lib/input.js +0 -265
- package/examples/browser/vue/node_modules/postcss/lib/lazy-result.d.ts +0 -190
- package/examples/browser/vue/node_modules/postcss/lib/lazy-result.js +0 -550
- package/examples/browser/vue/node_modules/postcss/lib/list.d.ts +0 -60
- package/examples/browser/vue/node_modules/postcss/lib/list.js +0 -58
- package/examples/browser/vue/node_modules/postcss/lib/map-generator.js +0 -368
- package/examples/browser/vue/node_modules/postcss/lib/no-work-result.d.ts +0 -46
- package/examples/browser/vue/node_modules/postcss/lib/no-work-result.js +0 -138
- package/examples/browser/vue/node_modules/postcss/lib/node.d.ts +0 -556
- package/examples/browser/vue/node_modules/postcss/lib/node.js +0 -449
- package/examples/browser/vue/node_modules/postcss/lib/parse.d.ts +0 -9
- package/examples/browser/vue/node_modules/postcss/lib/parse.js +0 -42
- package/examples/browser/vue/node_modules/postcss/lib/parser.js +0 -611
- package/examples/browser/vue/node_modules/postcss/lib/postcss.d.mts +0 -69
- package/examples/browser/vue/node_modules/postcss/lib/postcss.d.ts +0 -458
- package/examples/browser/vue/node_modules/postcss/lib/postcss.js +0 -101
- package/examples/browser/vue/node_modules/postcss/lib/postcss.mjs +0 -30
- package/examples/browser/vue/node_modules/postcss/lib/previous-map.d.ts +0 -81
- package/examples/browser/vue/node_modules/postcss/lib/previous-map.js +0 -144
- package/examples/browser/vue/node_modules/postcss/lib/processor.d.ts +0 -115
- package/examples/browser/vue/node_modules/postcss/lib/processor.js +0 -67
- package/examples/browser/vue/node_modules/postcss/lib/result.d.ts +0 -205
- package/examples/browser/vue/node_modules/postcss/lib/result.js +0 -42
- package/examples/browser/vue/node_modules/postcss/lib/root.d.ts +0 -87
- package/examples/browser/vue/node_modules/postcss/lib/root.js +0 -61
- package/examples/browser/vue/node_modules/postcss/lib/rule.d.ts +0 -126
- package/examples/browser/vue/node_modules/postcss/lib/rule.js +0 -27
- package/examples/browser/vue/node_modules/postcss/lib/stringifier.d.ts +0 -46
- package/examples/browser/vue/node_modules/postcss/lib/stringifier.js +0 -353
- package/examples/browser/vue/node_modules/postcss/lib/stringify.d.ts +0 -9
- package/examples/browser/vue/node_modules/postcss/lib/stringify.js +0 -11
- package/examples/browser/vue/node_modules/postcss/lib/symbols.js +0 -5
- package/examples/browser/vue/node_modules/postcss/lib/terminal-highlight.js +0 -70
- package/examples/browser/vue/node_modules/postcss/lib/tokenize.js +0 -266
- package/examples/browser/vue/node_modules/postcss/lib/warn-once.js +0 -13
- package/examples/browser/vue/node_modules/postcss/lib/warning.d.ts +0 -147
- package/examples/browser/vue/node_modules/postcss/lib/warning.js +0 -37
- package/examples/browser/vue/node_modules/postcss/package.json +0 -88
- package/examples/browser/vue/node_modules/rollup/LICENSE.md +0 -679
- package/examples/browser/vue/node_modules/rollup/README.md +0 -134
- package/examples/browser/vue/node_modules/rollup/dist/bin/rollup +0 -1912
- package/examples/browser/vue/node_modules/rollup/dist/es/getLogFilter.js +0 -64
- package/examples/browser/vue/node_modules/rollup/dist/es/package.json +0 -1
- package/examples/browser/vue/node_modules/rollup/dist/es/parseAst.js +0 -12
- package/examples/browser/vue/node_modules/rollup/dist/es/rollup.js +0 -17
- package/examples/browser/vue/node_modules/rollup/dist/es/shared/node-entry.js +0 -23920
- package/examples/browser/vue/node_modules/rollup/dist/es/shared/parseAst.js +0 -2086
- package/examples/browser/vue/node_modules/rollup/dist/es/shared/watch.js +0 -9297
- package/examples/browser/vue/node_modules/rollup/dist/getLogFilter.d.ts +0 -5
- package/examples/browser/vue/node_modules/rollup/dist/getLogFilter.js +0 -69
- package/examples/browser/vue/node_modules/rollup/dist/loadConfigFile.d.ts +0 -20
- package/examples/browser/vue/node_modules/rollup/dist/loadConfigFile.js +0 -29
- package/examples/browser/vue/node_modules/rollup/dist/native.js +0 -129
- package/examples/browser/vue/node_modules/rollup/dist/parseAst.d.ts +0 -4
- package/examples/browser/vue/node_modules/rollup/dist/parseAst.js +0 -22
- package/examples/browser/vue/node_modules/rollup/dist/rollup.d.ts +0 -1185
- package/examples/browser/vue/node_modules/rollup/dist/rollup.js +0 -127
- package/examples/browser/vue/node_modules/rollup/dist/shared/fsevents-importer.js +0 -37
- package/examples/browser/vue/node_modules/rollup/dist/shared/index.js +0 -9003
- package/examples/browser/vue/node_modules/rollup/dist/shared/loadConfigFile.js +0 -572
- package/examples/browser/vue/node_modules/rollup/dist/shared/parseAst.js +0 -2318
- package/examples/browser/vue/node_modules/rollup/dist/shared/rollup.js +0 -23842
- package/examples/browser/vue/node_modules/rollup/dist/shared/watch-cli.js +0 -542
- package/examples/browser/vue/node_modules/rollup/dist/shared/watch.js +0 -324
- package/examples/browser/vue/node_modules/rollup/package.json +0 -273
- package/examples/browser/vue/node_modules/source-map-js/LICENSE +0 -28
- package/examples/browser/vue/node_modules/source-map-js/README.md +0 -765
- package/examples/browser/vue/node_modules/source-map-js/lib/array-set.js +0 -121
- package/examples/browser/vue/node_modules/source-map-js/lib/base64-vlq.js +0 -140
- package/examples/browser/vue/node_modules/source-map-js/lib/base64.js +0 -67
- package/examples/browser/vue/node_modules/source-map-js/lib/binary-search.js +0 -111
- package/examples/browser/vue/node_modules/source-map-js/lib/mapping-list.js +0 -79
- package/examples/browser/vue/node_modules/source-map-js/lib/quick-sort.js +0 -132
- package/examples/browser/vue/node_modules/source-map-js/lib/source-map-consumer.d.ts +0 -1
- package/examples/browser/vue/node_modules/source-map-js/lib/source-map-consumer.js +0 -1188
- package/examples/browser/vue/node_modules/source-map-js/lib/source-map-generator.d.ts +0 -1
- package/examples/browser/vue/node_modules/source-map-js/lib/source-map-generator.js +0 -444
- package/examples/browser/vue/node_modules/source-map-js/lib/source-node.d.ts +0 -1
- package/examples/browser/vue/node_modules/source-map-js/lib/source-node.js +0 -413
- package/examples/browser/vue/node_modules/source-map-js/lib/util.js +0 -594
- package/examples/browser/vue/node_modules/source-map-js/package.json +0 -71
- package/examples/browser/vue/node_modules/source-map-js/source-map.d.ts +0 -104
- package/examples/browser/vue/node_modules/source-map-js/source-map.js +0 -8
- package/examples/browser/vue/node_modules/vite/LICENSE.md +0 -3423
- package/examples/browser/vue/node_modules/vite/README.md +0 -20
- package/examples/browser/vue/node_modules/vite/bin/openChrome.applescript +0 -95
- package/examples/browser/vue/node_modules/vite/bin/vite.js +0 -61
- package/examples/browser/vue/node_modules/vite/client.d.ts +0 -256
- package/examples/browser/vue/node_modules/vite/dist/client/client.mjs +0 -829
- package/examples/browser/vue/node_modules/vite/dist/client/env.mjs +0 -24
- package/examples/browser/vue/node_modules/vite/dist/node/chunks/dep-D-7KCb9p.js +0 -7960
- package/examples/browser/vue/node_modules/vite/dist/node/chunks/dep-D_zLpgQd.js +0 -67047
- package/examples/browser/vue/node_modules/vite/dist/node/chunks/dep-IQS-Za7F.js +0 -561
- package/examples/browser/vue/node_modules/vite/dist/node/chunks/dep-YkMKzX4u.js +0 -993
- package/examples/browser/vue/node_modules/vite/dist/node/chunks/dep-e9kYborm.js +0 -7004
- package/examples/browser/vue/node_modules/vite/dist/node/cli.js +0 -917
- package/examples/browser/vue/node_modules/vite/dist/node/constants.js +0 -113
- package/examples/browser/vue/node_modules/vite/dist/node/index.d.ts +0 -3627
- package/examples/browser/vue/node_modules/vite/dist/node/index.js +0 -261
- package/examples/browser/vue/node_modules/vite/dist/node/runtime.d.ts +0 -63
- package/examples/browser/vue/node_modules/vite/dist/node/runtime.js +0 -1066
- package/examples/browser/vue/node_modules/vite/dist/node/types.d-aGj9QkWt.d.ts +0 -281
- package/examples/browser/vue/node_modules/vite/dist/node-cjs/publicUtils.cjs +0 -6171
- package/examples/browser/vue/node_modules/vite/index.cjs +0 -60
- package/examples/browser/vue/node_modules/vite/index.d.cts +0 -6
- package/examples/browser/vue/node_modules/vite/package.json +0 -191
- package/examples/browser/vue/node_modules/vite/types/customEvent.d.ts +0 -39
- package/examples/browser/vue/node_modules/vite/types/hmrPayload.d.ts +0 -65
- package/examples/browser/vue/node_modules/vite/types/hot.d.ts +0 -36
- package/examples/browser/vue/node_modules/vite/types/import-meta.d.ts +0 -5
- package/examples/browser/vue/node_modules/vite/types/importGlob.d.ts +0 -75
- package/examples/browser/vue/node_modules/vite/types/importMeta.d.ts +0 -22
- package/examples/browser/vue/node_modules/vite/types/metadata.d.ts +0 -10
- package/examples/browser/vue/node_modules/vite/types/package.json +0 -4
- package/examples/browser/vue/node_modules/vue/LICENSE +0 -21
- package/examples/browser/vue/node_modules/vue/README.md +0 -62
- package/examples/browser/vue/node_modules/vue/compiler-sfc/index.browser.js +0 -1
- package/examples/browser/vue/node_modules/vue/compiler-sfc/index.browser.mjs +0 -1
- package/examples/browser/vue/node_modules/vue/compiler-sfc/index.d.mts +0 -1
- package/examples/browser/vue/node_modules/vue/compiler-sfc/index.d.ts +0 -1
- package/examples/browser/vue/node_modules/vue/compiler-sfc/index.js +0 -3
- package/examples/browser/vue/node_modules/vue/compiler-sfc/index.mjs +0 -3
- package/examples/browser/vue/node_modules/vue/compiler-sfc/package.json +0 -4
- package/examples/browser/vue/node_modules/vue/compiler-sfc/register-ts.js +0 -3
- package/examples/browser/vue/node_modules/vue/dist/vue.cjs.js +0 -80
- package/examples/browser/vue/node_modules/vue/dist/vue.cjs.prod.js +0 -66
- package/examples/browser/vue/node_modules/vue/dist/vue.d.mts +0 -7
- package/examples/browser/vue/node_modules/vue/dist/vue.d.ts +0 -7
- package/examples/browser/vue/node_modules/vue/dist/vue.esm-browser.js +0 -18392
- package/examples/browser/vue/node_modules/vue/dist/vue.esm-browser.prod.js +0 -12
- package/examples/browser/vue/node_modules/vue/dist/vue.esm-bundler.js +0 -71
- package/examples/browser/vue/node_modules/vue/dist/vue.global.js +0 -18272
- package/examples/browser/vue/node_modules/vue/dist/vue.global.prod.js +0 -12
- package/examples/browser/vue/node_modules/vue/dist/vue.runtime.esm-browser.js +0 -12522
- package/examples/browser/vue/node_modules/vue/dist/vue.runtime.esm-browser.prod.js +0 -6
- package/examples/browser/vue/node_modules/vue/dist/vue.runtime.esm-bundler.js +0 -26
- package/examples/browser/vue/node_modules/vue/dist/vue.runtime.global.js +0 -12574
- package/examples/browser/vue/node_modules/vue/dist/vue.runtime.global.prod.js +0 -6
- package/examples/browser/vue/node_modules/vue/index.js +0 -7
- package/examples/browser/vue/node_modules/vue/index.mjs +0 -1
- package/examples/browser/vue/node_modules/vue/jsx-runtime/index.d.ts +0 -25
- package/examples/browser/vue/node_modules/vue/jsx-runtime/index.js +0 -15
- package/examples/browser/vue/node_modules/vue/jsx-runtime/index.mjs +0 -12
- package/examples/browser/vue/node_modules/vue/jsx-runtime/package.json +0 -5
- package/examples/browser/vue/node_modules/vue/jsx.d.ts +0 -22
- package/examples/browser/vue/node_modules/vue/package.json +0 -112
- package/examples/browser/vue/node_modules/vue/server-renderer/index.d.mts +0 -1
- package/examples/browser/vue/node_modules/vue/server-renderer/index.d.ts +0 -1
- package/examples/browser/vue/node_modules/vue/server-renderer/index.js +0 -1
- package/examples/browser/vue/node_modules/vue/server-renderer/index.mjs +0 -1
- package/examples/browser/vue/node_modules/vue/server-renderer/package.json +0 -4
- package/examples/browser/vue/node_modules/vue-demi/LICENSE +0 -21
- package/examples/browser/vue/node_modules/vue-demi/README.md +0 -229
- package/examples/browser/vue/node_modules/vue-demi/bin/vue-demi-fix.js +0 -3
- package/examples/browser/vue/node_modules/vue-demi/bin/vue-demi-switch.js +0 -3
- package/examples/browser/vue/node_modules/vue-demi/lib/index.cjs +0 -29
- package/examples/browser/vue/node_modules/vue-demi/lib/index.d.ts +0 -22
- package/examples/browser/vue/node_modules/vue-demi/lib/index.iife.js +0 -126
- package/examples/browser/vue/node_modules/vue-demi/lib/index.mjs +0 -34
- package/examples/browser/vue/node_modules/vue-demi/lib/v2/index.cjs +0 -34
- package/examples/browser/vue/node_modules/vue-demi/lib/v2/index.d.ts +0 -33
- package/examples/browser/vue/node_modules/vue-demi/lib/v2/index.mjs +0 -49
- package/examples/browser/vue/node_modules/vue-demi/lib/v2.7/index.cjs +0 -60
- package/examples/browser/vue/node_modules/vue-demi/lib/v2.7/index.d.ts +0 -38
- package/examples/browser/vue/node_modules/vue-demi/lib/v2.7/index.mjs +0 -80
- package/examples/browser/vue/node_modules/vue-demi/lib/v3/index.cjs +0 -29
- package/examples/browser/vue/node_modules/vue-demi/lib/v3/index.d.ts +0 -22
- package/examples/browser/vue/node_modules/vue-demi/lib/v3/index.mjs +0 -34
- package/examples/browser/vue/node_modules/vue-demi/package.json +0 -47
- package/examples/browser/vue/node_modules/vue-demi/scripts/postinstall.js +0 -19
- package/examples/browser/vue/node_modules/vue-demi/scripts/switch-cli.js +0 -18
- package/examples/browser/vue/node_modules/vue-demi/scripts/utils.js +0 -62
- package/examples/browser/vue/node_modules/vue-router/LICENSE +0 -21
- package/examples/browser/vue/node_modules/vue-router/README.md +0 -111
- package/examples/browser/vue/node_modules/vue-router/dist/devtools-BLCumUwL.mjs +0 -1218
- package/examples/browser/vue/node_modules/vue-router/dist/experimental/index.d.mts +0 -38
- package/examples/browser/vue/node_modules/vue-router/dist/experimental/index.mjs +0 -754
- package/examples/browser/vue/node_modules/vue-router/dist/router-BbqN7H95.d.mts +0 -1928
- package/examples/browser/vue/node_modules/vue-router/dist/vue-router.cjs +0 -2797
- package/examples/browser/vue/node_modules/vue-router/dist/vue-router.d.mts +0 -393
- package/examples/browser/vue/node_modules/vue-router/dist/vue-router.esm-browser.js +0 -2743
- package/examples/browser/vue/node_modules/vue-router/dist/vue-router.esm-browser.prod.js +0 -6
- package/examples/browser/vue/node_modules/vue-router/dist/vue-router.esm-bundler.js +0 -2
- package/examples/browser/vue/node_modules/vue-router/dist/vue-router.global.js +0 -3040
- package/examples/browser/vue/node_modules/vue-router/dist/vue-router.global.prod.js +0 -6
- package/examples/browser/vue/node_modules/vue-router/dist/vue-router.mjs +0 -1557
- package/examples/browser/vue/node_modules/vue-router/dist/vue-router.prod.cjs +0 -23
- package/examples/browser/vue/node_modules/vue-router/index.js +0 -7
- package/examples/browser/vue/node_modules/vue-router/package.json +0 -154
- package/examples/browser/vue/node_modules/vue-router/vetur/attributes.json +0 -32
- package/examples/browser/vue/node_modules/vue-router/vetur/tags.json +0 -10
- package/examples/browser/vue/node_modules/vue-router/vue-router-auto-resolver.d.mts +0 -22
- package/examples/browser/vue/node_modules/vue-router/vue-router-auto-routes.d.ts +0 -4
- package/examples/browser/vue/node_modules/vue-router/vue-router-auto.d.ts +0 -1
- package/examples/browser/vue/node_modules/vue-router/vue-router.node.mjs +0 -2
- package/examples/browser/vue/package-lock.json +0 -1276
- package/examples/browser/vue/package.json +0 -23
- package/examples/browser/vue/public/peerpigeon-browser.js +0 -13322
- package/examples/browser/vue/public/pigeonlogo.svg +0 -51
- package/examples/browser/vue/src/App-simple.vue +0 -21
- package/examples/browser/vue/src/App.vue +0 -423
- package/examples/browser/vue/src/components/CryptoView.vue +0 -1661
- package/examples/browser/vue/src/components/DHTView.vue +0 -1281
- package/examples/browser/vue/src/components/DebugView.vue +0 -1783
- package/examples/browser/vue/src/components/MediaView.vue +0 -1197
- package/examples/browser/vue/src/components/MessagingView.vue +0 -803
- package/examples/browser/vue/src/components/NetworkView.vue +0 -930
- package/examples/browser/vue/src/components/StorageView.vue +0 -1376
- package/examples/browser/vue/src/components/TestingView.vue +0 -794
- package/examples/browser/vue/src/main.js +0 -11
- package/examples/browser/vue/src/router.js +0 -63
- package/examples/browser/vue/src/stores/peerpigeon.js +0 -1334
- package/examples/browser/vue/test-vue-restructured-2.log +0 -18
- package/examples/browser/vue/test-vue-restructured-3.log +0 -18
- package/examples/browser/vue/vite.config.js +0 -22
- package/examples/debug-configuration.js +0 -171
- package/examples/hub-example.js +0 -189
- package/examples/multi-hub-test.js +0 -186
- package/examples/nativescript/README.md +0 -73
- package/examples/nativescript/app.js +0 -152
- package/examples/nativescript/package.json +0 -27
- package/examples/node/README.md +0 -110
- package/examples/node/basic-storage-example.js +0 -90
- package/examples/node/package.json +0 -17
- package/examples/node/storage-spaces-test.js +0 -329
- package/examples/node/storage-test.js +0 -655
- package/examples/node/test-crypto-media.js +0 -137
- package/examples/node/test-crypto.js +0 -146
- package/examples/node/test-node.js +0 -152
- package/examples/programmatic-namespace-example.js +0 -108
- package/examples/selective-streaming-demo.html +0 -698
- package/examples/standard-events-demo.js +0 -126
- package/examples/stream-file-transfer-demo.html +0 -935
- package/index.js +0 -30
- package/server/index.js +0 -2147
- package/server/start.js +0 -52
- package/src/CleanupManager.js +0 -183
- package/src/ConnectionManager.js +0 -1286
- package/src/CryptoManager.js +0 -743
- package/src/DebugLogger.js +0 -204
- package/src/DistributedStorageManager.js +0 -1741
- package/src/EnvironmentDetector.js +0 -600
- package/src/EventEmitter.js +0 -106
- package/src/EvictionManager.js +0 -260
- package/src/GossipManager.js +0 -726
- package/src/LexicalStorageInterface.js +0 -332
- package/src/MediaManager.js +0 -276
- package/src/MeshOptimizer.js +0 -182
- package/src/PeerConnection.js +0 -1850
- package/src/PeerDiscovery.js +0 -329
- package/src/PeerPigeonMesh.js +0 -2502
- package/src/PigeonRTC-browser.js +0 -247
- package/src/SignalingClient.js +0 -395
- package/src/SignalingHandler.js +0 -589
- package/src/StorageManager.js +0 -107
- package/src/TimerUtils.js +0 -75
- package/src/WebDHT-Simple.js +0 -389
- package/src/WebDHT.js +0 -474
- package/src/browser-entry.js +0 -68
package/src/PeerPigeonMesh.js
DELETED
|
@@ -1,2502 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from './EventEmitter.js';
|
|
2
|
-
import { SignalingClient } from './SignalingClient.js';
|
|
3
|
-
import { PeerDiscovery } from './PeerDiscovery.js';
|
|
4
|
-
import { ConnectionManager } from './ConnectionManager.js';
|
|
5
|
-
import { SignalingHandler } from './SignalingHandler.js';
|
|
6
|
-
import { EvictionManager } from './EvictionManager.js';
|
|
7
|
-
import { MeshOptimizer } from './MeshOptimizer.js';
|
|
8
|
-
import { CleanupManager } from './CleanupManager.js';
|
|
9
|
-
import { StorageManager } from './StorageManager.js';
|
|
10
|
-
import { GossipManager } from './GossipManager.js';
|
|
11
|
-
import { MediaManager } from './MediaManager.js';
|
|
12
|
-
import { WebDHT } from './WebDHT.js';
|
|
13
|
-
import { CryptoManager } from './CryptoManager.js';
|
|
14
|
-
import { DistributedStorageManager } from './DistributedStorageManager.js';
|
|
15
|
-
import { environmentDetector } from './EnvironmentDetector.js';
|
|
16
|
-
import DebugLogger from './DebugLogger.js';
|
|
17
|
-
|
|
18
|
-
export class PeerPigeonMesh extends EventEmitter {
|
|
19
|
-
constructor(options = {}) {
|
|
20
|
-
super();
|
|
21
|
-
this.debug = DebugLogger.create('PeerPigeonMesh');
|
|
22
|
-
|
|
23
|
-
// Validate environment capabilities
|
|
24
|
-
this.environmentReport = this.validateEnvironment(options);
|
|
25
|
-
|
|
26
|
-
this.peerId = null;
|
|
27
|
-
this.providedPeerId = options.peerId || null;
|
|
28
|
-
this.signalingClient = null;
|
|
29
|
-
this.peerDiscovery = null;
|
|
30
|
-
|
|
31
|
-
// Network namespace configuration
|
|
32
|
-
this.networkName = options.networkName || 'global';
|
|
33
|
-
this.allowGlobalFallback = options.allowGlobalFallback !== false; // Default to true
|
|
34
|
-
this.isInFallbackMode = false;
|
|
35
|
-
this.originalNetworkName = this.networkName;
|
|
36
|
-
|
|
37
|
-
// Configuration - Optional features enabled by default (opt-out)
|
|
38
|
-
this.maxPeers = options.maxPeers !== undefined ? options.maxPeers : 3;
|
|
39
|
-
this.minPeers = options.minPeers !== undefined ? options.minPeers : 2;
|
|
40
|
-
// Connectivity floor: ensure each peer obtains at least this many connections for robust gossip
|
|
41
|
-
// Default to 3 across browsers (capped by maxPeers) for consistent propagation
|
|
42
|
-
const defaultFloor = Math.min(3, this.maxPeers ?? 3);
|
|
43
|
-
this.connectivityFloor = options.connectivityFloor !== undefined ? options.connectivityFloor : defaultFloor;
|
|
44
|
-
this.autoConnect = options.autoConnect !== false; // Default to true, can be disabled by setting to false
|
|
45
|
-
this.autoDiscovery = options.autoDiscovery !== false;
|
|
46
|
-
this.evictionStrategy = options.evictionStrategy !== false;
|
|
47
|
-
this.xorRouting = options.xorRouting !== false;
|
|
48
|
-
this.enableWebDHT = options.enableWebDHT !== false; // Default to true, can be disabled by setting to false
|
|
49
|
-
this.enableCrypto = options.enableCrypto !== false; // Default to true, can be disabled by setting to false
|
|
50
|
-
|
|
51
|
-
// State
|
|
52
|
-
this.connected = false;
|
|
53
|
-
this.polling = false; // Only WebSocket is supported
|
|
54
|
-
this.signalingUrl = null;
|
|
55
|
-
this.discoveredPeers = new Map();
|
|
56
|
-
|
|
57
|
-
// Track ongoing key exchange attempts to prevent duplicates across all channels
|
|
58
|
-
this.ongoingKeyExchanges = new Set();
|
|
59
|
-
|
|
60
|
-
// Track peers for which we've already emitted peerKeyAdded events to prevent UI spam
|
|
61
|
-
this.emittedPeerKeyEvents = new Set();
|
|
62
|
-
|
|
63
|
-
// Gossip stream tracking
|
|
64
|
-
this.gossipStreams = new Map(); // streamId -> { chunks: Map, metadata, controller, totalChunks }
|
|
65
|
-
|
|
66
|
-
// Initialize managers
|
|
67
|
-
this.storageManager = new StorageManager(this);
|
|
68
|
-
this.mediaManager = new MediaManager();
|
|
69
|
-
this.connectionManager = new ConnectionManager(this);
|
|
70
|
-
this.evictionManager = new EvictionManager(this, this.connectionManager);
|
|
71
|
-
this.meshOptimizer = new MeshOptimizer(this, this.connectionManager, this.evictionManager);
|
|
72
|
-
this.cleanupManager = new CleanupManager(this);
|
|
73
|
-
this.signalingHandler = new SignalingHandler(this, this.connectionManager);
|
|
74
|
-
this.gossipManager = new GossipManager(this, this.connectionManager);
|
|
75
|
-
this.webDHT = null; // Will be initialized after peerId is set
|
|
76
|
-
this.distributedStorage = null; // Will be initialized after WebDHT is set
|
|
77
|
-
|
|
78
|
-
// Initialize crypto manager if enabled
|
|
79
|
-
this.cryptoManager = null;
|
|
80
|
-
if (this.enableCrypto) {
|
|
81
|
-
this.cryptoManager = new CryptoManager();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Set up inter-module event forwarding
|
|
85
|
-
this.setupManagerEventHandlers();
|
|
86
|
-
|
|
87
|
-
// Set up unload handlers
|
|
88
|
-
this.cleanupManager.setupUnloadHandlers();
|
|
89
|
-
|
|
90
|
-
// Load saved signaling URL immediately
|
|
91
|
-
this.storageManager.loadSignalingUrlFromStorage();
|
|
92
|
-
|
|
93
|
-
// Connectivity enforcement timer handle
|
|
94
|
-
this._connectivityEnforcementTimer = null;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
setupManagerEventHandlers() {
|
|
98
|
-
// Forward events from managers to main mesh
|
|
99
|
-
this.connectionManager.addEventListener('peersUpdated', () => {
|
|
100
|
-
this.emit('peersUpdated');
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
// Handle peer disconnections
|
|
104
|
-
this.addEventListener('peerDisconnected', (data) => {
|
|
105
|
-
this.debug.log(`Peer ${data.peerId.substring(0, 8)}... disconnected: ${data.reason}`);
|
|
106
|
-
|
|
107
|
-
// Clear tracking for this peer to allow fresh key exchange if they reconnect
|
|
108
|
-
this.emittedPeerKeyEvents.delete(data.peerId);
|
|
109
|
-
this.ongoingKeyExchanges.delete(data.peerId);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
// Handle gossip messages and intercept mesh signaling
|
|
113
|
-
this.gossipManager.addEventListener('messageReceived', (data) => {
|
|
114
|
-
// Check if this is a mesh signaling message
|
|
115
|
-
if (data.message && data.message.type === 'mesh_signaling') {
|
|
116
|
-
this._handleMeshSignalingMessage(data.message, data.from);
|
|
117
|
-
return; // Don't emit as regular message
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Handle crypto key exchange messages
|
|
121
|
-
if (data.message && (data.message.type === 'key_exchange' || data.message.type === 'key_exchange_response')) {
|
|
122
|
-
this._handleKeyExchange(data.message, data.from).catch(err => {
|
|
123
|
-
this.debug.error('Key exchange handling failed:', err);
|
|
124
|
-
});
|
|
125
|
-
return; // Don't emit as regular message
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Handle DHT messages - route to WebDHT
|
|
129
|
-
if (data.message && data.message.type === 'dht' && this.webDHT) {
|
|
130
|
-
this.webDHT.handleMessage(data.message, data.from);
|
|
131
|
-
return; // Don't emit as regular message
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Handle gossip stream chunks
|
|
135
|
-
if (data.message && data.message.type === 'stream-chunk') {
|
|
136
|
-
this._handleGossipStreamChunk(data.message, data.from);
|
|
137
|
-
return; // Don't emit as regular message
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// Handle gossip stream control messages
|
|
141
|
-
if (data.message && data.message.type === 'stream-control') {
|
|
142
|
-
this._handleGossipStreamControl(data.message, data.from);
|
|
143
|
-
return; // Don't emit as regular message
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Additional safety filter for message types that should not be emitted to UI
|
|
147
|
-
// These should already be filtered at the GossipManager level, but this provides defense in depth
|
|
148
|
-
if (data.content && typeof data.content === 'string') {
|
|
149
|
-
try {
|
|
150
|
-
const parsedContent = JSON.parse(data.content);
|
|
151
|
-
const filteredTypes = ['signaling-relay', 'peer-announce-relay', 'bootstrap-keepalive', 'client-peer-announcement', 'cross-bootstrap-signaling'];
|
|
152
|
-
if (filteredTypes.includes(parsedContent.type)) {
|
|
153
|
-
console.debug(`🔇 MESH FILTER: Blocked filtered message type '${parsedContent.type}' from UI emission`);
|
|
154
|
-
return; // Don't emit to UI
|
|
155
|
-
}
|
|
156
|
-
} catch (e) {
|
|
157
|
-
// Not JSON, continue normally
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
this.emit('messageReceived', data);
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
// CRITICAL: Handle remote stream announcements from gossip
|
|
165
|
-
// When we hear about a stream from an indirectly connected peer,
|
|
166
|
-
// establish a direct connection to receive the media
|
|
167
|
-
this.addEventListener('remoteStreamAnnouncement', (data) => {
|
|
168
|
-
this._handleRemoteStreamAnnouncement(data);
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
// Forward media events
|
|
172
|
-
this.mediaManager.addEventListener('localStreamStarted', (data) => {
|
|
173
|
-
this.emit('localStreamStarted', data);
|
|
174
|
-
// Gossip stream start announcement to all peers in the mesh
|
|
175
|
-
this.gossipManager.broadcastMessage({
|
|
176
|
-
event: 'streamStarted',
|
|
177
|
-
peerId: this.peerId,
|
|
178
|
-
hasVideo: data.hasVideo,
|
|
179
|
-
hasAudio: data.hasAudio,
|
|
180
|
-
timestamp: Date.now()
|
|
181
|
-
}, 'mediaEvent').catch(err => {
|
|
182
|
-
this.debug.error('Failed to broadcast stream started event:', err);
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
this.mediaManager.addEventListener('localStreamStopped', () => {
|
|
187
|
-
this.emit('localStreamStopped');
|
|
188
|
-
// Gossip stream stop announcement to all peers in the mesh
|
|
189
|
-
this.gossipManager.broadcastMessage({
|
|
190
|
-
event: 'streamStopped',
|
|
191
|
-
peerId: this.peerId,
|
|
192
|
-
timestamp: Date.now()
|
|
193
|
-
}, 'mediaEvent').catch(err => {
|
|
194
|
-
this.debug.error('Failed to broadcast stream stopped event:', err);
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
this.mediaManager.addEventListener('error', (data) => {
|
|
199
|
-
this.emit('mediaError', data);
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
// Forward remote stream events from ConnectionManager
|
|
203
|
-
this.connectionManager.addEventListener('remoteStream', (data) => {
|
|
204
|
-
this.emit('remoteStream', data);
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
// Handle crypto events if crypto is enabled
|
|
208
|
-
if (this.cryptoManager) {
|
|
209
|
-
this.cryptoManager.addEventListener('cryptoReady', (data) => {
|
|
210
|
-
this.emit('cryptoReady', data);
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
this.cryptoManager.addEventListener('cryptoError', (data) => {
|
|
214
|
-
this.emit('cryptoError', data);
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
this.cryptoManager.addEventListener('peerKeyAdded', (data) => {
|
|
218
|
-
// Only emit peerKeyAdded event once per peer to prevent UI spam from duplicate key exchanges
|
|
219
|
-
if (!this.emittedPeerKeyEvents.has(data.peerId)) {
|
|
220
|
-
this.emittedPeerKeyEvents.add(data.peerId);
|
|
221
|
-
this.emit('peerKeyAdded', data);
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
this.cryptoManager.addEventListener('userAuthenticated', (data) => {
|
|
226
|
-
this.emit('userAuthenticated', data);
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
validateEnvironment(options = {}) {
|
|
232
|
-
const report = environmentDetector.getEnvironmentReport();
|
|
233
|
-
const warnings = [];
|
|
234
|
-
const errors = [];
|
|
235
|
-
|
|
236
|
-
// Log environment info
|
|
237
|
-
this.debug.log('🔍 PeerPigeon Environment Detection:', {
|
|
238
|
-
runtime: `${report.runtime.isBrowser ? 'Browser' : ''}${report.runtime.isNodeJS ? 'Node.js' : ''}${report.runtime.isWorker ? 'Worker' : ''}${report.runtime.isNativeScript ? 'NativeScript' : ''}`,
|
|
239
|
-
webrtc: report.capabilities.webrtc,
|
|
240
|
-
websocket: report.capabilities.webSocket,
|
|
241
|
-
browser: report.browser?.name || 'N/A',
|
|
242
|
-
nativescript: report.nativescript?.platform || 'N/A'
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
// Check WebRTC support (required for peer connections)
|
|
246
|
-
if (!report.capabilities.webrtc) {
|
|
247
|
-
if (report.runtime.isBrowser) {
|
|
248
|
-
errors.push('WebRTC is not supported in this browser. PeerPigeon requires WebRTC for peer-to-peer connections.');
|
|
249
|
-
} else if (report.runtime.isNodeJS) {
|
|
250
|
-
warnings.push('WebRTC support not detected in Node.js environment. PeerPigeon includes @koush/wrtc for automatic WebRTC support - ensure it is properly installed.');
|
|
251
|
-
} else if (report.runtime.isNativeScript) {
|
|
252
|
-
warnings.push('WebRTC support not detected in NativeScript environment. Consider using a native WebRTC plugin.');
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// Check WebSocket support (required for signaling)
|
|
257
|
-
if (!report.capabilities.webSocket) {
|
|
258
|
-
if (report.runtime.isBrowser) {
|
|
259
|
-
errors.push('WebSocket is not supported in this browser. PeerPigeon requires WebSocket for signaling.');
|
|
260
|
-
} else if (report.runtime.isNodeJS) {
|
|
261
|
-
warnings.push('WebSocket support not detected. Install the "ws" package for WebSocket support in Node.js.');
|
|
262
|
-
} else if (report.runtime.isNativeScript) {
|
|
263
|
-
warnings.push('WebSocket support not detected. Consider using a native WebSocket plugin or polyfill.');
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
// Check storage capabilities for persistent peer ID
|
|
268
|
-
if ((report.runtime.isBrowser || report.runtime.isNativeScript) && !report.capabilities.localStorage && !report.capabilities.sessionStorage) {
|
|
269
|
-
warnings.push('No storage mechanism available. Peer ID will not persist between sessions.');
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// Check crypto support for secure peer ID generation
|
|
273
|
-
if (!report.capabilities.randomValues) {
|
|
274
|
-
warnings.push('Crypto random values not available. Peer ID generation may be less secure.');
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
// Network connectivity checks
|
|
278
|
-
if (report.runtime.isBrowser && !report.network.online) {
|
|
279
|
-
warnings.push('Browser reports offline status. Mesh networking may not function properly.');
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
// Environment-specific warnings
|
|
283
|
-
if (report.runtime.isBrowser) {
|
|
284
|
-
// Browser-specific checks
|
|
285
|
-
const browser = report.browser;
|
|
286
|
-
if (browser && browser.name === 'ie') {
|
|
287
|
-
errors.push('Internet Explorer is not supported. Please use a modern browser.');
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
// Check for secure context in production
|
|
291
|
-
if (typeof location !== 'undefined' && location.protocol === 'http:' && location.hostname !== 'localhost') {
|
|
292
|
-
warnings.push('Running on HTTP in production. Some WebRTC features may be limited. Consider using HTTPS.');
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
if (report.runtime.isNativeScript) {
|
|
297
|
-
// NativeScript-specific checks
|
|
298
|
-
const nativeScript = report.nativescript;
|
|
299
|
-
if (nativeScript && nativeScript.platform) {
|
|
300
|
-
this.debug.log(`🔮 Running on NativeScript ${nativeScript.platform} platform`);
|
|
301
|
-
|
|
302
|
-
// Platform-specific considerations
|
|
303
|
-
if (nativeScript.platform === 'android') {
|
|
304
|
-
warnings.push('Android WebRTC may require network permissions and appropriate security configurations.');
|
|
305
|
-
} else if (nativeScript.platform === 'ios' || nativeScript.platform === 'visionos') {
|
|
306
|
-
warnings.push('iOS/visionOS WebRTC may require camera/microphone permissions for media features.');
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// Handle errors and warnings
|
|
312
|
-
if (errors.length > 0) {
|
|
313
|
-
const errorMessage = 'PeerPigeon environment validation failed:\n' + errors.join('\n');
|
|
314
|
-
this.debug.error(errorMessage);
|
|
315
|
-
if (!options.ignoreEnvironmentErrors) {
|
|
316
|
-
throw new Error(errorMessage);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
if (warnings.length > 0) {
|
|
321
|
-
this.debug.warn('PeerPigeon environment warnings:\n' + warnings.join('\n'));
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// Store capabilities for runtime checks
|
|
325
|
-
this.capabilities = report.capabilities;
|
|
326
|
-
this.runtimeInfo = report.runtime;
|
|
327
|
-
|
|
328
|
-
return report;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
async init() {
|
|
332
|
-
try {
|
|
333
|
-
// Initialize PigeonRTC for cross-platform WebRTC support
|
|
334
|
-
try {
|
|
335
|
-
const webrtcInitialized = await environmentDetector.initWebRTCAsync();
|
|
336
|
-
if (webrtcInitialized) {
|
|
337
|
-
const adapterName = environmentDetector.getPigeonRTC()?.getAdapterName();
|
|
338
|
-
this.debug.log(`🌐 PigeonRTC initialized successfully (${adapterName})`);
|
|
339
|
-
}
|
|
340
|
-
} catch (error) {
|
|
341
|
-
this.debug.warn('PigeonRTC initialization failed:', error.message);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// Request media permissions for localhost WebRTC to work unless explicitly disabled
|
|
345
|
-
// Added DISABLE_LOCALHOST_MEDIA_REQUEST override for automated/headless test environments
|
|
346
|
-
if (environmentDetector.isBrowser) {
|
|
347
|
-
try {
|
|
348
|
-
const disableLocalhostMedia = typeof window !== 'undefined' && window.DISABLE_LOCALHOST_MEDIA_REQUEST;
|
|
349
|
-
const isLocalhost = window.location.hostname === 'localhost' ||
|
|
350
|
-
window.location.hostname === '127.0.0.1' ||
|
|
351
|
-
window.location.hostname === '';
|
|
352
|
-
|
|
353
|
-
if (!disableLocalhostMedia && isLocalhost && navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
|
|
354
|
-
this.debug.log('🎤 Requesting media permissions for localhost WebRTC (not disabled)...');
|
|
355
|
-
|
|
356
|
-
// Request minimal audio permission (no video to reduce intrusiveness)
|
|
357
|
-
const stream = await navigator.mediaDevices.getUserMedia({
|
|
358
|
-
audio: true,
|
|
359
|
-
video: false
|
|
360
|
-
}).catch(err => {
|
|
361
|
-
this.debug.warn('Media permission denied - connections may fail on localhost:', err.message);
|
|
362
|
-
return null;
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
// Immediately stop all tracks - we only needed the permission
|
|
366
|
-
if (stream) {
|
|
367
|
-
stream.getTracks().forEach(track => track.stop());
|
|
368
|
-
this.debug.log('✅ Media permissions granted - localhost connections will work');
|
|
369
|
-
}
|
|
370
|
-
} else if (disableLocalhostMedia) {
|
|
371
|
-
this.debug.log('🚫 Skipping localhost media permission request (DISABLE_LOCALHOST_MEDIA_REQUEST flag set)');
|
|
372
|
-
}
|
|
373
|
-
} catch (error) {
|
|
374
|
-
this.debug.warn('Could not request media permissions:', error.message);
|
|
375
|
-
// Continue anyway - non-localhost environments don't need this
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
// Use provided peer ID if valid, otherwise generate one
|
|
380
|
-
if (this.providedPeerId) {
|
|
381
|
-
if (PeerPigeonMesh.validatePeerId(this.providedPeerId)) {
|
|
382
|
-
this.peerId = this.providedPeerId;
|
|
383
|
-
this.debug.log(`Using provided peer ID: ${this.peerId}`);
|
|
384
|
-
} else {
|
|
385
|
-
this.debug.warn(`Invalid peer ID provided: ${this.providedPeerId}. Must be 40-character SHA-1 hex string. Generating new one.`);
|
|
386
|
-
this.peerId = await PeerPigeonMesh.generatePeerId();
|
|
387
|
-
}
|
|
388
|
-
} else {
|
|
389
|
-
this.peerId = await PeerPigeonMesh.generatePeerId();
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
// Initialize WebDHT now that we have a peerId (if enabled)
|
|
393
|
-
if (this.enableWebDHT) {
|
|
394
|
-
// Initialize WebDHT - Low-level distributed hash table for raw key-value storage
|
|
395
|
-
this.webDHT = new WebDHT(this);
|
|
396
|
-
this.debug.log('WebDHT (low-level DHT) initialized and enabled');
|
|
397
|
-
|
|
398
|
-
// Setup WebDHT event handlers now that it's initialized
|
|
399
|
-
this.setupWebDHTEventHandlers();
|
|
400
|
-
|
|
401
|
-
// Initialize DistributedStorageManager - High-level storage with encryption/access control
|
|
402
|
-
// Note: This uses WebDHT as its storage backend but provides a separate high-level API
|
|
403
|
-
this.distributedStorage = new DistributedStorageManager(this);
|
|
404
|
-
this.debug.log('DistributedStorageManager (high-level encrypted storage) initialized');
|
|
405
|
-
|
|
406
|
-
// Setup DistributedStorageManager event handlers
|
|
407
|
-
this.setupDistributedStorageEventHandlers();
|
|
408
|
-
} else {
|
|
409
|
-
this.debug.log('WebDHT disabled by configuration');
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
// Load signaling URL from query params or storage
|
|
413
|
-
const savedUrl = this.storageManager.loadSignalingUrlFromQuery();
|
|
414
|
-
if (savedUrl) {
|
|
415
|
-
this.signalingUrl = savedUrl;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
this.signalingClient = new SignalingClient(this.peerId, this.maxPeers, this);
|
|
419
|
-
this.setupSignalingHandlers();
|
|
420
|
-
|
|
421
|
-
this.peerDiscovery = new PeerDiscovery(this.peerId, {
|
|
422
|
-
autoDiscovery: this.autoDiscovery,
|
|
423
|
-
evictionStrategy: this.evictionStrategy,
|
|
424
|
-
xorRouting: this.xorRouting,
|
|
425
|
-
minPeers: this.minPeers,
|
|
426
|
-
maxPeers: this.maxPeers
|
|
427
|
-
});
|
|
428
|
-
this.setupDiscoveryHandlers();
|
|
429
|
-
// Start connectivity enforcement loop once discovery is ready
|
|
430
|
-
this.startConnectivityEnforcement();
|
|
431
|
-
|
|
432
|
-
// Initialize crypto manager if enabled
|
|
433
|
-
if (this.cryptoManager) {
|
|
434
|
-
try {
|
|
435
|
-
this.debug.log('🔐 Initializing crypto manager with automatic key persistence...');
|
|
436
|
-
|
|
437
|
-
// Add timeout to prevent hanging
|
|
438
|
-
const cryptoInitPromise = this.cryptoManager.initWithPeerId(this.peerId);
|
|
439
|
-
const timeoutPromise = new Promise((resolve, reject) => {
|
|
440
|
-
setTimeout(() => reject(new Error('Crypto initialization timeout')), 10000);
|
|
441
|
-
});
|
|
442
|
-
|
|
443
|
-
await Promise.race([cryptoInitPromise, timeoutPromise]);
|
|
444
|
-
this.debug.log('🔐 Crypto manager initialized successfully with persistent keys');
|
|
445
|
-
} catch (error) {
|
|
446
|
-
this.debug.error('Failed to initialize crypto manager:', error);
|
|
447
|
-
// Continue without crypto - don't fail the entire init
|
|
448
|
-
this.enableCrypto = false;
|
|
449
|
-
this.cryptoManager = null;
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
this.emit('statusChanged', { type: 'initialized', peerId: this.peerId });
|
|
454
|
-
} catch (error) {
|
|
455
|
-
this.debug.error('Failed to initialize mesh:', error);
|
|
456
|
-
this.emit('statusChanged', { type: 'error', message: `Initialization failed: ${error.message}` });
|
|
457
|
-
throw error;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
setupSignalingHandlers() {
|
|
462
|
-
this.signalingClient.addEventListener('connected', () => {
|
|
463
|
-
this.connected = true;
|
|
464
|
-
this.polling = false;
|
|
465
|
-
this.peerDiscovery.start();
|
|
466
|
-
|
|
467
|
-
this.emit('statusChanged', { type: 'connected' });
|
|
468
|
-
});
|
|
469
|
-
|
|
470
|
-
// IMPORTANT: When the WebSocket signaling connection is lost, we do NOT disconnect peers!
|
|
471
|
-
// WebRTC connections are peer-to-peer and remain active even without the signaling server.
|
|
472
|
-
// Peers can continue to communicate directly through their existing WebRTC data channels.
|
|
473
|
-
// The signaling server is only needed for:
|
|
474
|
-
// 1. Initial peer discovery and connection negotiation
|
|
475
|
-
// 2. Discovering new peers that join the network
|
|
476
|
-
// Once peers are connected via WebRTC, they are independent of the signaling server.
|
|
477
|
-
this.signalingClient.addEventListener('disconnected', () => {
|
|
478
|
-
this.connected = false;
|
|
479
|
-
this.polling = false;
|
|
480
|
-
this.peerDiscovery.stop();
|
|
481
|
-
// Don't disconnect peers - WebRTC connections are peer-to-peer and persist without signaling server
|
|
482
|
-
this.emit('statusChanged', { type: 'disconnected' });
|
|
483
|
-
});
|
|
484
|
-
|
|
485
|
-
this.signalingClient.addEventListener('signalingMessage', (message) => {
|
|
486
|
-
this.signalingHandler.handleSignalingMessage(message);
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
this.signalingClient.addEventListener('statusChanged', (data) => {
|
|
490
|
-
this.emit('statusChanged', data);
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
setupDiscoveryHandlers() {
|
|
495
|
-
this.peerDiscovery.addEventListener('peerDiscovered', (data) => {
|
|
496
|
-
this.emit('peerDiscovered', data);
|
|
497
|
-
|
|
498
|
-
// Check if we should return from global fallback to original network
|
|
499
|
-
if (this.isInFallbackMode && this.originalNetworkName !== 'global') {
|
|
500
|
-
this._tryReturnToOriginalNetwork();
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
|
|
504
|
-
this.peerDiscovery.addEventListener('connectToPeer', (data) => {
|
|
505
|
-
this.debug.log(`PeerDiscovery requested connection to: ${data.peerId.substring(0, 8)}...`);
|
|
506
|
-
this.connectionManager.connectToPeer(data.peerId);
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
this.peerDiscovery.addEventListener('evictPeer', (data) => {
|
|
510
|
-
this.evictionManager.evictPeer(data.peerId, data.reason);
|
|
511
|
-
});
|
|
512
|
-
|
|
513
|
-
this.peerDiscovery.addEventListener('optimizeMesh', () => {
|
|
514
|
-
this.peerDiscovery.optimizeMeshConnections(this.connectionManager.peers);
|
|
515
|
-
});
|
|
516
|
-
|
|
517
|
-
this.peerDiscovery.addEventListener('optimizeConnections', (data) => {
|
|
518
|
-
this.meshOptimizer.handleOptimizeConnections(data.unconnectedPeers);
|
|
519
|
-
});
|
|
520
|
-
|
|
521
|
-
// Monitor network health and activate fallback if needed
|
|
522
|
-
this.addEventListener('peersUpdated', () => {
|
|
523
|
-
this._checkNetworkHealth();
|
|
524
|
-
});
|
|
525
|
-
|
|
526
|
-
this.peerDiscovery.addEventListener('peersUpdated', (data) => {
|
|
527
|
-
this.emit('statusChanged', { type: 'info', message: `Cleaned up ${data.removedCount} stale peer(s)` });
|
|
528
|
-
this.emit('peersUpdated');
|
|
529
|
-
});
|
|
530
|
-
|
|
531
|
-
// Handle capacity checks
|
|
532
|
-
this.peerDiscovery.addEventListener('checkCapacity', () => {
|
|
533
|
-
const canAccept = this.connectionManager.canAcceptMorePeers();
|
|
534
|
-
const currentConnectionCount = this.connectionManager.getConnectedPeerCount();
|
|
535
|
-
this.debug.log(`Capacity check: ${canAccept} (${currentConnectionCount}/${this.maxPeers} peers)`);
|
|
536
|
-
this.peerDiscovery._canAcceptMorePeers = canAccept;
|
|
537
|
-
this.peerDiscovery._currentConnectionCount = currentConnectionCount;
|
|
538
|
-
});
|
|
539
|
-
|
|
540
|
-
// Handle eviction checks
|
|
541
|
-
this.peerDiscovery.addEventListener('checkEviction', (data) => {
|
|
542
|
-
const evictPeerId = this.evictionManager.shouldEvictForPeer(data.newPeerId);
|
|
543
|
-
this.debug.log(`Eviction check for ${data.newPeerId.substring(0, 8)}...: ${evictPeerId ? evictPeerId.substring(0, 8) + '...' : 'none'}`);
|
|
544
|
-
this.peerDiscovery._shouldEvictForPeer = evictPeerId;
|
|
545
|
-
});
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
async connect(signalingUrl) {
|
|
549
|
-
this.signalingUrl = signalingUrl;
|
|
550
|
-
this.storageManager.saveSignalingUrlToStorage(signalingUrl);
|
|
551
|
-
this.polling = false; // Only WebSocket is supported
|
|
552
|
-
// Don't emit connecting here - SignalingClient will handle it with more detail
|
|
553
|
-
|
|
554
|
-
try {
|
|
555
|
-
await this.signalingClient.connect(signalingUrl);
|
|
556
|
-
} catch (error) {
|
|
557
|
-
this.debug.error('Connection failed:', error);
|
|
558
|
-
this.polling = false;
|
|
559
|
-
this.emit('statusChanged', { type: 'error', message: `Connection failed: ${error.message}` });
|
|
560
|
-
throw error;
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
disconnect() {
|
|
565
|
-
if (this.connected) {
|
|
566
|
-
this.cleanupManager.sendGoodbyeMessage();
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
this.connected = false;
|
|
570
|
-
this.polling = false;
|
|
571
|
-
|
|
572
|
-
if (this.signalingClient) {
|
|
573
|
-
this.signalingClient.disconnect();
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
if (this.peerDiscovery) {
|
|
577
|
-
this.peerDiscovery.cleanup(); // Use cleanup() instead of stop() for full cleanup
|
|
578
|
-
}
|
|
579
|
-
if (this._connectivityEnforcementTimer) {
|
|
580
|
-
clearInterval(this._connectivityEnforcementTimer);
|
|
581
|
-
this._connectivityEnforcementTimer = null;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
this.connectionManager.disconnectAllPeers();
|
|
585
|
-
this.connectionManager.cleanup();
|
|
586
|
-
|
|
587
|
-
// WebDHT persists in the mesh - no cleanup needed on disconnect
|
|
588
|
-
this.evictionManager.cleanup();
|
|
589
|
-
this.cleanupManager.cleanup();
|
|
590
|
-
this.gossipManager.cleanup();
|
|
591
|
-
|
|
592
|
-
this.emit('statusChanged', { type: 'disconnected' });
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
/**
|
|
596
|
-
* Periodically attempt extra connections for under-connected peers until reaching connectivityFloor.
|
|
597
|
-
*/
|
|
598
|
-
startConnectivityEnforcement() {
|
|
599
|
-
if (this._connectivityEnforcementTimer) return;
|
|
600
|
-
const intervalMs = 4000; // Slower enforcement to avoid connection storms
|
|
601
|
-
this._connectivityEnforcementTimer = setInterval(() => {
|
|
602
|
-
if (!this.connected || !this.peerDiscovery) return;
|
|
603
|
-
const connectedCount = this.connectionManager.getConnectedPeerCount();
|
|
604
|
-
if (connectedCount >= this.connectivityFloor) return; // met floor
|
|
605
|
-
|
|
606
|
-
// Gather candidate peer IDs
|
|
607
|
-
const discovered = this.peerDiscovery.getDiscoveredPeers().map(p => p.peerId);
|
|
608
|
-
const notConnected = discovered.filter(pid =>
|
|
609
|
-
!this.connectionManager.hasPeer(pid) &&
|
|
610
|
-
!this.peerDiscovery.isAttemptingConnection(pid)
|
|
611
|
-
);
|
|
612
|
-
if (notConnected.length === 0) return;
|
|
613
|
-
|
|
614
|
-
// Prioritize by XOR distance for diversity and stability
|
|
615
|
-
const prioritized = notConnected.sort((a, b) => {
|
|
616
|
-
const distA = this.peerDiscovery.calculateXorDistance(this.peerId, a);
|
|
617
|
-
const distB = this.peerDiscovery.calculateXorDistance(this.peerId, b);
|
|
618
|
-
return distA < distB ? -1 : 1;
|
|
619
|
-
});
|
|
620
|
-
|
|
621
|
-
// Conservative: attempt exactly what's needed, one at a time
|
|
622
|
-
const needed = this.connectivityFloor - connectedCount;
|
|
623
|
-
const attemptLimit = Math.min(prioritized.length, Math.max(1, needed));
|
|
624
|
-
const batch = prioritized.slice(0, attemptLimit);
|
|
625
|
-
batch.forEach(pid => {
|
|
626
|
-
this.debug.log(`🔧 CONNECTIVITY FLOOR (${connectedCount}/${this.connectivityFloor}) attempting extra connection to ${pid.substring(0,8)}...`);
|
|
627
|
-
// Use normal connect, but with initiator override below floor
|
|
628
|
-
this.connectionManager.connectToPeer(pid);
|
|
629
|
-
});
|
|
630
|
-
}, intervalMs);
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
// Configuration methods
|
|
634
|
-
setMaxPeers(maxPeers) {
|
|
635
|
-
this.maxPeers = Math.max(1, Math.min(50, maxPeers));
|
|
636
|
-
|
|
637
|
-
if (this.connectionManager.peers.size > this.maxPeers) {
|
|
638
|
-
this.evictionManager.disconnectExcessPeers();
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
return this.maxPeers;
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
setMinPeers(minPeers) {
|
|
645
|
-
this.minPeers = Math.max(0, Math.min(49, minPeers));
|
|
646
|
-
|
|
647
|
-
// If we're below minimum and auto-discovery is enabled, trigger optimization
|
|
648
|
-
if (this.connectionManager.getConnectedPeerCount() < this.minPeers && this.autoDiscovery && this.connected) {
|
|
649
|
-
this.peerDiscovery.optimizeMeshConnections(this.connectionManager.peers);
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
return this.minPeers;
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
setXorRouting(enabled) {
|
|
656
|
-
this.xorRouting = enabled;
|
|
657
|
-
this.emit('statusChanged', { type: 'setting', setting: 'xorRouting', value: enabled });
|
|
658
|
-
|
|
659
|
-
// If XOR routing is disabled, we might need to adjust our connection strategy
|
|
660
|
-
if (!enabled && this.evictionStrategy) {
|
|
661
|
-
this.emit('statusChanged', { type: 'warning', message: 'XOR routing disabled - eviction strategy effectiveness reduced' });
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
setAutoDiscovery(enabled) {
|
|
666
|
-
this.autoDiscovery = enabled;
|
|
667
|
-
this.emit('statusChanged', { type: 'setting', setting: 'autoDiscovery', value: enabled });
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
setAutoConnect(enabled) {
|
|
671
|
-
this.autoConnect = enabled;
|
|
672
|
-
this.emit('statusChanged', { type: 'setting', setting: 'autoConnect', value: enabled });
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
setEvictionStrategy(enabled) {
|
|
676
|
-
this.evictionStrategy = enabled;
|
|
677
|
-
this.emit('statusChanged', { type: 'setting', setting: 'evictionStrategy', value: enabled });
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
// Network namespace management methods
|
|
681
|
-
setNetworkName(networkName) {
|
|
682
|
-
if (this.connected) {
|
|
683
|
-
throw new Error('Cannot change network name while connected. Disconnect first.');
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
this.networkName = networkName || 'global';
|
|
687
|
-
this.originalNetworkName = this.networkName;
|
|
688
|
-
this.isInFallbackMode = false;
|
|
689
|
-
|
|
690
|
-
this.emit('statusChanged', {
|
|
691
|
-
type: 'setting',
|
|
692
|
-
setting: 'networkName',
|
|
693
|
-
value: this.networkName
|
|
694
|
-
});
|
|
695
|
-
|
|
696
|
-
return this.networkName;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
getNetworkName() {
|
|
700
|
-
return this.networkName;
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
getOriginalNetworkName() {
|
|
704
|
-
return this.originalNetworkName;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
isUsingGlobalFallback() {
|
|
708
|
-
return this.isInFallbackMode;
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
setAllowGlobalFallback(allow) {
|
|
712
|
-
this.allowGlobalFallback = allow;
|
|
713
|
-
this.emit('statusChanged', {
|
|
714
|
-
type: 'setting',
|
|
715
|
-
setting: 'allowGlobalFallback',
|
|
716
|
-
value: allow
|
|
717
|
-
});
|
|
718
|
-
|
|
719
|
-
// If we're currently in fallback mode and fallback is disabled, try to return to original network
|
|
720
|
-
if (!allow && this.isInFallbackMode) {
|
|
721
|
-
this._tryReturnToOriginalNetwork();
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
return this.allowGlobalFallback;
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
async _tryReturnToOriginalNetwork() {
|
|
728
|
-
if (!this.isInFallbackMode || this.originalNetworkName === 'global') {
|
|
729
|
-
return;
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
// Check if there are now peers in the original network
|
|
733
|
-
const originalNetworkPeerCount = await this._getNetworkPeerCount(this.originalNetworkName);
|
|
734
|
-
|
|
735
|
-
if (originalNetworkPeerCount > 0) {
|
|
736
|
-
this.debug.log(`Returning from global fallback to original network: ${this.originalNetworkName}`);
|
|
737
|
-
this.networkName = this.originalNetworkName;
|
|
738
|
-
this.isInFallbackMode = false;
|
|
739
|
-
|
|
740
|
-
this.emit('statusChanged', {
|
|
741
|
-
type: 'network',
|
|
742
|
-
message: `Returned to network: ${this.networkName}`,
|
|
743
|
-
networkName: this.networkName,
|
|
744
|
-
fallbackMode: false
|
|
745
|
-
});
|
|
746
|
-
|
|
747
|
-
// Trigger reconnection to rebuild mesh in correct network
|
|
748
|
-
if (this.connected) {
|
|
749
|
-
this.disconnect();
|
|
750
|
-
setTimeout(() => {
|
|
751
|
-
if (this.signalingUrl) {
|
|
752
|
-
this.connect(this.signalingUrl);
|
|
753
|
-
}
|
|
754
|
-
}, 1000);
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
async _activateGlobalFallback() {
|
|
760
|
-
if (this.originalNetworkName === 'global' || this.isInFallbackMode || !this.allowGlobalFallback) {
|
|
761
|
-
return false;
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
this.debug.log(`Activating global fallback from network: ${this.originalNetworkName}`);
|
|
765
|
-
this.networkName = 'global';
|
|
766
|
-
this.isInFallbackMode = true;
|
|
767
|
-
|
|
768
|
-
this.emit('statusChanged', {
|
|
769
|
-
type: 'network',
|
|
770
|
-
message: `Fallback to global network from: ${this.originalNetworkName}`,
|
|
771
|
-
networkName: this.networkName,
|
|
772
|
-
originalNetwork: this.originalNetworkName,
|
|
773
|
-
fallbackMode: true
|
|
774
|
-
});
|
|
775
|
-
|
|
776
|
-
return true;
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
async _getNetworkPeerCount(networkName) {
|
|
780
|
-
// This would need to be implemented with signaling server support
|
|
781
|
-
// For now, return 0 to indicate we can't determine peer count
|
|
782
|
-
return 0;
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
_checkNetworkHealth() {
|
|
786
|
-
// TEMPORARILY DISABLED - aggressive fallback for debugging
|
|
787
|
-
return;
|
|
788
|
-
|
|
789
|
-
if (this.originalNetworkName === 'global' || !this.allowGlobalFallback) {
|
|
790
|
-
return;
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
const connectedCount = this.connectionManager.getConnectedPeerCount();
|
|
794
|
-
const discoveredCount = this.discoveredPeers.size;
|
|
795
|
-
|
|
796
|
-
// If we're in the original network but have insufficient peers, activate fallback
|
|
797
|
-
if (!this.isInFallbackMode && this.networkName === this.originalNetworkName) {
|
|
798
|
-
if (connectedCount === 0 && discoveredCount === 0) {
|
|
799
|
-
this.debug.log(`Network ${this.originalNetworkName} appears empty, activating global fallback`);
|
|
800
|
-
this._activateGlobalFallback().then(activated => {
|
|
801
|
-
if (activated && this.connected && this.signalingUrl) {
|
|
802
|
-
// Reconnect to signaling server with global network
|
|
803
|
-
this.disconnect();
|
|
804
|
-
setTimeout(() => {
|
|
805
|
-
this.connect(this.signalingUrl);
|
|
806
|
-
}, 1000);
|
|
807
|
-
}
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
// Status and information methods
|
|
814
|
-
getStatus() {
|
|
815
|
-
const connectedCount = this.connectionManager.getConnectedPeerCount();
|
|
816
|
-
const totalCount = this.connectionManager.peers.size;
|
|
817
|
-
return {
|
|
818
|
-
peerId: this.peerId,
|
|
819
|
-
connected: this.connected,
|
|
820
|
-
polling: false, // Only WebSocket is supported
|
|
821
|
-
signalingUrl: this.signalingUrl,
|
|
822
|
-
networkName: this.networkName,
|
|
823
|
-
originalNetworkName: this.originalNetworkName,
|
|
824
|
-
isInFallbackMode: this.isInFallbackMode,
|
|
825
|
-
allowGlobalFallback: this.allowGlobalFallback,
|
|
826
|
-
connectedCount,
|
|
827
|
-
totalPeerCount: totalCount, // Include total count for debugging
|
|
828
|
-
minPeers: this.minPeers,
|
|
829
|
-
maxPeers: this.maxPeers,
|
|
830
|
-
discoveredCount: this.discoveredPeers.size,
|
|
831
|
-
autoConnect: this.autoConnect,
|
|
832
|
-
autoDiscovery: this.autoDiscovery,
|
|
833
|
-
evictionStrategy: this.evictionStrategy,
|
|
834
|
-
xorRouting: this.xorRouting
|
|
835
|
-
};
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
getPeers() {
|
|
839
|
-
return this.connectionManager.getPeers();
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
getPeerStatus(peerConnection) {
|
|
843
|
-
return peerConnection.getStatus();
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
getDiscoveredPeers() {
|
|
847
|
-
if (!this.peerDiscovery) {
|
|
848
|
-
return [];
|
|
849
|
-
}
|
|
850
|
-
const discoveredPeers = this.peerDiscovery.getDiscoveredPeers();
|
|
851
|
-
|
|
852
|
-
// Enrich with connection state from the actual peer connections
|
|
853
|
-
return discoveredPeers.map(peer => {
|
|
854
|
-
const peerConnection = this.connectionManager.getPeer(peer.peerId);
|
|
855
|
-
let isConnected = false;
|
|
856
|
-
|
|
857
|
-
if (peerConnection) {
|
|
858
|
-
const status = peerConnection.getStatus();
|
|
859
|
-
// Consider peer connected if WebRTC connection is established
|
|
860
|
-
isConnected = status === 'connected' || status === 'channel-connecting';
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
return {
|
|
864
|
-
...peer,
|
|
865
|
-
isConnected
|
|
866
|
-
};
|
|
867
|
-
});
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
/**
|
|
871
|
-
* Send a direct message to a specific peer via gossip routing
|
|
872
|
-
* @param {string} targetPeerId - The destination peer's ID
|
|
873
|
-
* @param {string|object} content - The message content
|
|
874
|
-
* @returns {string|null} The message ID if sent, or null on error
|
|
875
|
-
*/
|
|
876
|
-
async sendDirectMessage(targetPeerId, content) {
|
|
877
|
-
if (!targetPeerId || typeof targetPeerId !== 'string') {
|
|
878
|
-
this.debug.error('Invalid targetPeerId for direct message');
|
|
879
|
-
return null;
|
|
880
|
-
}
|
|
881
|
-
return await this.gossipManager.sendDirectMessage(targetPeerId, content);
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
/**
|
|
885
|
-
* Send a broadcast (gossip) message to all peers
|
|
886
|
-
* @param {string|object} content - The message content
|
|
887
|
-
* @returns {string|null} The message ID if sent, or null on error
|
|
888
|
-
*/
|
|
889
|
-
async sendMessage(content) {
|
|
890
|
-
// For clarity, this is a broadcast/gossip message
|
|
891
|
-
return await this.gossipManager.broadcastMessage(content, 'chat');
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
/**
|
|
895
|
-
* Send binary data to a specific peer
|
|
896
|
-
* @param {string} targetPeerId - The destination peer's ID
|
|
897
|
-
* @param {Uint8Array|ArrayBuffer} binaryData - The binary data to send
|
|
898
|
-
* @returns {boolean} True if sent successfully
|
|
899
|
-
*/
|
|
900
|
-
async sendBinaryData(targetPeerId, binaryData) {
|
|
901
|
-
if (!targetPeerId || typeof targetPeerId !== 'string') {
|
|
902
|
-
this.debug.error('Invalid targetPeerId for binary message');
|
|
903
|
-
return false;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
const peerConnection = this.connectionManager.peers.get(targetPeerId);
|
|
907
|
-
if (!peerConnection) {
|
|
908
|
-
this.debug.error(`No connection to peer ${targetPeerId.substring(0, 8)}...`);
|
|
909
|
-
return false;
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
return peerConnection.sendMessage(binaryData);
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
/**
|
|
916
|
-
* Broadcast binary data to all connected peers
|
|
917
|
-
* @param {Uint8Array|ArrayBuffer} binaryData - The binary data to broadcast
|
|
918
|
-
* @returns {number} Number of peers the data was sent to
|
|
919
|
-
*/
|
|
920
|
-
async broadcastBinaryData(binaryData) {
|
|
921
|
-
const peers = this.getConnectedPeers();
|
|
922
|
-
let sentCount = 0;
|
|
923
|
-
|
|
924
|
-
for (const peer of peers) {
|
|
925
|
-
if (await this.sendBinaryData(peer.peerId, binaryData)) {
|
|
926
|
-
sentCount++;
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
this.debug.log(`📦 Binary data broadcasted to ${sentCount}/${peers.length} peers`);
|
|
931
|
-
return sentCount;
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
/**
|
|
935
|
-
* Create a writable stream to send data to a specific peer
|
|
936
|
-
* @param {string} targetPeerId - The destination peer's ID
|
|
937
|
-
* @param {object} options - Stream options (filename, mimeType, totalSize, etc.)
|
|
938
|
-
* @returns {WritableStream} A writable stream
|
|
939
|
-
*/
|
|
940
|
-
createStreamToPeer(targetPeerId, options = {}) {
|
|
941
|
-
if (!targetPeerId || typeof targetPeerId !== 'string') {
|
|
942
|
-
throw new Error('Invalid targetPeerId for stream');
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
const peerConnection = this.connectionManager.peers.get(targetPeerId);
|
|
946
|
-
if (!peerConnection) {
|
|
947
|
-
throw new Error(`No connection to peer ${targetPeerId.substring(0, 8)}...`);
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
return peerConnection.createWritableStream(options);
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
/**
|
|
954
|
-
* Send a ReadableStream to a peer
|
|
955
|
-
* @param {string} targetPeerId - The destination peer's ID
|
|
956
|
-
* @param {ReadableStream} readableStream - The stream to send
|
|
957
|
-
* @param {object} options - Stream options (filename, mimeType, etc.)
|
|
958
|
-
* @returns {Promise<void>}
|
|
959
|
-
*/
|
|
960
|
-
async sendStream(targetPeerId, readableStream, options = {}) {
|
|
961
|
-
const writableStream = this.createStreamToPeer(targetPeerId, options);
|
|
962
|
-
|
|
963
|
-
try {
|
|
964
|
-
await readableStream.pipeTo(writableStream);
|
|
965
|
-
this.debug.log(`✅ Stream sent successfully to ${targetPeerId.substring(0, 8)}...`);
|
|
966
|
-
} catch (error) {
|
|
967
|
-
this.debug.error(`❌ Failed to send stream to ${targetPeerId.substring(0, 8)}...:`, error);
|
|
968
|
-
throw error;
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
/**
|
|
973
|
-
* Send a File to a peer using streams
|
|
974
|
-
* @param {string} targetPeerId - The destination peer's ID
|
|
975
|
-
* @param {File} file - The file to send
|
|
976
|
-
* @returns {Promise<void>}
|
|
977
|
-
*/
|
|
978
|
-
async sendFile(targetPeerId, file) {
|
|
979
|
-
this.debug.log(`📁 Sending file "${file.name}" (${file.size} bytes) to ${targetPeerId.substring(0, 8)}...`);
|
|
980
|
-
|
|
981
|
-
const options = {
|
|
982
|
-
filename: file.name,
|
|
983
|
-
mimeType: file.type,
|
|
984
|
-
totalSize: file.size,
|
|
985
|
-
type: 'file'
|
|
986
|
-
};
|
|
987
|
-
|
|
988
|
-
const stream = file.stream();
|
|
989
|
-
await this.sendStream(targetPeerId, stream, options);
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
/**
|
|
993
|
-
* Send a Blob to a peer using streams
|
|
994
|
-
* @param {string} targetPeerId - The destination peer's ID
|
|
995
|
-
* @param {Blob} blob - The blob to send
|
|
996
|
-
* @param {object} options - Additional options
|
|
997
|
-
* @returns {Promise<void>}
|
|
998
|
-
*/
|
|
999
|
-
async sendBlob(targetPeerId, blob, options = {}) {
|
|
1000
|
-
this.debug.log(`📦 Sending blob (${blob.size} bytes) to ${targetPeerId.substring(0, 8)}...`);
|
|
1001
|
-
|
|
1002
|
-
const streamOptions = {
|
|
1003
|
-
...options,
|
|
1004
|
-
mimeType: blob.type,
|
|
1005
|
-
totalSize: blob.size,
|
|
1006
|
-
type: 'blob'
|
|
1007
|
-
};
|
|
1008
|
-
|
|
1009
|
-
const stream = blob.stream();
|
|
1010
|
-
await this.sendStream(targetPeerId, stream, streamOptions);
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
/**
|
|
1014
|
-
* Create a writable stream that broadcasts data to all peers in the mesh using gossip
|
|
1015
|
-
* @param {object} options - Stream options (filename, mimeType, totalSize, etc.)
|
|
1016
|
-
* @returns {WritableStream} A writable stream that broadcasts via gossip protocol
|
|
1017
|
-
*/
|
|
1018
|
-
createBroadcastStream(options = {}) {
|
|
1019
|
-
const streamId = options.streamId || this._generateStreamId();
|
|
1020
|
-
const metadata = {
|
|
1021
|
-
streamId,
|
|
1022
|
-
type: options.type || 'broadcast',
|
|
1023
|
-
filename: options.filename,
|
|
1024
|
-
mimeType: options.mimeType,
|
|
1025
|
-
totalSize: options.totalSize,
|
|
1026
|
-
timestamp: Date.now(),
|
|
1027
|
-
...options
|
|
1028
|
-
};
|
|
1029
|
-
|
|
1030
|
-
// Store chunks locally for gossip distribution
|
|
1031
|
-
const chunks = [];
|
|
1032
|
-
let chunkIndex = 0;
|
|
1033
|
-
let totalBytesWritten = 0;
|
|
1034
|
-
const self = this;
|
|
1035
|
-
|
|
1036
|
-
this.debug.log(`📡 Creating gossip broadcast stream: ${streamId}`);
|
|
1037
|
-
|
|
1038
|
-
return new WritableStream({
|
|
1039
|
-
async write(chunk) {
|
|
1040
|
-
const chunkData = chunk instanceof Uint8Array ? chunk : new Uint8Array(chunk);
|
|
1041
|
-
const chunkId = chunkIndex++;
|
|
1042
|
-
|
|
1043
|
-
// Store chunk
|
|
1044
|
-
chunks.push({
|
|
1045
|
-
index: chunkId,
|
|
1046
|
-
data: chunkData
|
|
1047
|
-
});
|
|
1048
|
-
|
|
1049
|
-
totalBytesWritten += chunkData.length;
|
|
1050
|
-
|
|
1051
|
-
// Broadcast chunk via gossip protocol
|
|
1052
|
-
try {
|
|
1053
|
-
await self.gossipManager.broadcastMessage({
|
|
1054
|
-
streamId,
|
|
1055
|
-
chunkIndex: chunkId,
|
|
1056
|
-
data: Array.from(chunkData), // Convert to regular array for JSON
|
|
1057
|
-
totalSize: metadata.totalSize,
|
|
1058
|
-
metadata: chunkId === 0 ? metadata : undefined // Include metadata with first chunk
|
|
1059
|
-
}, 'stream-chunk');
|
|
1060
|
-
|
|
1061
|
-
self.debug.log(`📡 Gossiped chunk ${chunkId} (${chunkData.length} bytes) for stream ${streamId.substring(0, 8)}...`);
|
|
1062
|
-
} catch (error) {
|
|
1063
|
-
self.debug.error(`Failed to gossip chunk ${chunkId}:`, error);
|
|
1064
|
-
throw error;
|
|
1065
|
-
}
|
|
1066
|
-
},
|
|
1067
|
-
|
|
1068
|
-
async close() {
|
|
1069
|
-
// Broadcast stream end via gossip
|
|
1070
|
-
try {
|
|
1071
|
-
await self.gossipManager.broadcastMessage({
|
|
1072
|
-
streamId,
|
|
1073
|
-
action: 'end',
|
|
1074
|
-
totalChunks: chunkIndex,
|
|
1075
|
-
totalBytes: totalBytesWritten,
|
|
1076
|
-
metadata
|
|
1077
|
-
}, 'stream-control');
|
|
1078
|
-
|
|
1079
|
-
self.debug.log(`📡 Broadcast stream completed via gossip: ${totalBytesWritten} bytes in ${chunkIndex} chunks`);
|
|
1080
|
-
|
|
1081
|
-
// Emit completion event
|
|
1082
|
-
self.emit('broadcastStreamComplete', {
|
|
1083
|
-
streamId,
|
|
1084
|
-
totalBytes: totalBytesWritten,
|
|
1085
|
-
totalChunks: chunkIndex,
|
|
1086
|
-
metadata
|
|
1087
|
-
});
|
|
1088
|
-
} catch (error) {
|
|
1089
|
-
self.debug.error('Failed to broadcast stream end:', error);
|
|
1090
|
-
throw error;
|
|
1091
|
-
}
|
|
1092
|
-
},
|
|
1093
|
-
|
|
1094
|
-
async abort(reason) {
|
|
1095
|
-
// Broadcast stream abort via gossip
|
|
1096
|
-
try {
|
|
1097
|
-
await self.gossipManager.broadcastMessage({
|
|
1098
|
-
streamId,
|
|
1099
|
-
action: 'abort',
|
|
1100
|
-
reason: reason?.message || String(reason),
|
|
1101
|
-
metadata
|
|
1102
|
-
}, 'stream-control');
|
|
1103
|
-
|
|
1104
|
-
self.debug.log(`❌ Broadcast stream aborted via gossip: ${reason}`);
|
|
1105
|
-
|
|
1106
|
-
// Emit abort event
|
|
1107
|
-
self.emit('broadcastStreamAborted', {
|
|
1108
|
-
streamId,
|
|
1109
|
-
reason: reason?.message || String(reason),
|
|
1110
|
-
metadata
|
|
1111
|
-
});
|
|
1112
|
-
} catch (error) {
|
|
1113
|
-
self.debug.error('Failed to broadcast stream abort:', error);
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
});
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
/**
|
|
1120
|
-
* Broadcast a ReadableStream to all connected peers
|
|
1121
|
-
* @param {ReadableStream} readableStream - The stream to broadcast
|
|
1122
|
-
* @param {object} options - Stream options (filename, mimeType, etc.)
|
|
1123
|
-
* @returns {Promise<void>}
|
|
1124
|
-
*/
|
|
1125
|
-
async broadcastStream(readableStream, options = {}) {
|
|
1126
|
-
const writableStream = this.createBroadcastStream(options);
|
|
1127
|
-
|
|
1128
|
-
try {
|
|
1129
|
-
await readableStream.pipeTo(writableStream);
|
|
1130
|
-
this.debug.log(`✅ Stream broadcasted successfully to all peers`);
|
|
1131
|
-
} catch (error) {
|
|
1132
|
-
this.debug.error(`❌ Failed to broadcast stream:`, error);
|
|
1133
|
-
throw error;
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
/**
|
|
1138
|
-
* Broadcast a File to all connected peers using streams
|
|
1139
|
-
* @param {File} file - The file to broadcast
|
|
1140
|
-
* @returns {Promise<void>}
|
|
1141
|
-
*/
|
|
1142
|
-
async broadcastFile(file) {
|
|
1143
|
-
this.debug.log(`📁 Broadcasting file "${file.name}" (${file.size} bytes) to all peers`);
|
|
1144
|
-
|
|
1145
|
-
const options = {
|
|
1146
|
-
filename: file.name,
|
|
1147
|
-
mimeType: file.type,
|
|
1148
|
-
totalSize: file.size,
|
|
1149
|
-
type: 'file'
|
|
1150
|
-
};
|
|
1151
|
-
|
|
1152
|
-
const stream = file.stream();
|
|
1153
|
-
await this.broadcastStream(stream, options);
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
/**
|
|
1157
|
-
* Broadcast a Blob to all connected peers using streams
|
|
1158
|
-
* @param {Blob} blob - The blob to broadcast
|
|
1159
|
-
* @param {object} options - Additional options
|
|
1160
|
-
* @returns {Promise<void>}
|
|
1161
|
-
*/
|
|
1162
|
-
async broadcastBlob(blob, options = {}) {
|
|
1163
|
-
this.debug.log(`📦 Broadcasting blob (${blob.size} bytes) to all peers`);
|
|
1164
|
-
|
|
1165
|
-
const streamOptions = {
|
|
1166
|
-
...options,
|
|
1167
|
-
mimeType: blob.type,
|
|
1168
|
-
totalSize: blob.size,
|
|
1169
|
-
type: 'blob'
|
|
1170
|
-
};
|
|
1171
|
-
|
|
1172
|
-
const stream = blob.stream();
|
|
1173
|
-
await this.broadcastStream(stream, streamOptions);
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
/**
|
|
1177
|
-
* Generate a unique stream ID
|
|
1178
|
-
* @private
|
|
1179
|
-
*/
|
|
1180
|
-
_generateStreamId() {
|
|
1181
|
-
return `stream_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
// Helper methods for backward compatibility
|
|
1185
|
-
canAcceptMorePeers() {
|
|
1186
|
-
return this.connectionManager.canAcceptMorePeers();
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
getConnectedPeerCount() {
|
|
1190
|
-
return this.connectionManager.getConnectedPeerCount();
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
// Expose peers Map for backward compatibility
|
|
1194
|
-
get peers() {
|
|
1195
|
-
return this.connectionManager.peers;
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
// Get peer status method for UI compatibility
|
|
1199
|
-
getPeerUIStatus(peer) {
|
|
1200
|
-
if (!peer) return 'unknown';
|
|
1201
|
-
return peer.getStatus ? peer.getStatus() : 'unknown';
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
// Get connected peer IDs as array for UI compatibility
|
|
1205
|
-
getConnectedPeerIds() {
|
|
1206
|
-
return this.connectionManager.getPeers()
|
|
1207
|
-
.filter(peer => peer.status === 'connected')
|
|
1208
|
-
.map(peer => peer.peerId);
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
// Advanced methods
|
|
1212
|
-
async cleanupStaleSignalingData() {
|
|
1213
|
-
return this.cleanupManager.cleanupStaleSignalingData();
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
forceConnectToAllPeers() {
|
|
1217
|
-
return this.meshOptimizer.forceConnectToAllPeers();
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
// Debugging and maintenance methods
|
|
1221
|
-
forceCleanupInvalidPeers() {
|
|
1222
|
-
this.debug.log('Force cleaning up peers not in connected state...');
|
|
1223
|
-
return this.connectionManager.forceCleanupInvalidPeers();
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
cleanupStalePeers() {
|
|
1227
|
-
this.debug.log('Manually cleaning up stale peers...');
|
|
1228
|
-
return this.connectionManager.cleanupStalePeers();
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
getPeerStateSummary() {
|
|
1232
|
-
return this.connectionManager.getPeerStateSummary();
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
debugConnectivity() {
|
|
1236
|
-
return this.meshOptimizer.debugConnectivity();
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
// Media management methods
|
|
1240
|
-
async initializeMedia() {
|
|
1241
|
-
return await this.mediaManager.init();
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
async startMedia(options = {}) {
|
|
1245
|
-
const { video = false, audio = false, deviceIds = {} } = options;
|
|
1246
|
-
|
|
1247
|
-
try {
|
|
1248
|
-
const stream = await this.mediaManager.startLocalStream({ video, audio, deviceIds });
|
|
1249
|
-
|
|
1250
|
-
// Update all existing peer connections with the new stream - but only if crypto allows it
|
|
1251
|
-
const connections = this.connectionManager.getAllConnections();
|
|
1252
|
-
this.debug.log(`📡 MEDIA START: Applying stream to ${connections.length} connections (with crypto verification)`);
|
|
1253
|
-
|
|
1254
|
-
for (const connection of connections) {
|
|
1255
|
-
// SECURITY: Only share media if crypto keys are established or crypto is disabled
|
|
1256
|
-
let shouldShareMedia = true;
|
|
1257
|
-
|
|
1258
|
-
if (this.enableCrypto && this.cryptoManager) {
|
|
1259
|
-
const hasKeys = this.cryptoManager.peerKeys && this.cryptoManager.peerKeys.has(connection.peerId);
|
|
1260
|
-
if (!hasKeys) {
|
|
1261
|
-
this.debug.log(`� MEDIA START: Skipping media share with ${connection.peerId.substring(0, 8)}... - no crypto keys established`);
|
|
1262
|
-
shouldShareMedia = false;
|
|
1263
|
-
} else {
|
|
1264
|
-
this.debug.log(`🔒 MEDIA START: Crypto keys verified for ${connection.peerId.substring(0, 8)}... - sharing media`);
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
|
-
if (shouldShareMedia) {
|
|
1269
|
-
this.debug.log(`📡 MEDIA START: Setting stream for peer ${connection.peerId.substring(0, 8)}...`);
|
|
1270
|
-
await connection.setLocalStream(stream);
|
|
1271
|
-
this.debug.log(`✅ MEDIA START: Stream applied to ${connection.peerId.substring(0, 8)}...`);
|
|
1272
|
-
|
|
1273
|
-
// REMOVED: No forced immediate renegotiation - let natural renegotiation handle it
|
|
1274
|
-
// This prevents cascade renegotiation conflicts when multiple peers join
|
|
1275
|
-
} // End of shouldShareMedia block
|
|
1276
|
-
} // End of connections loop
|
|
1277
|
-
|
|
1278
|
-
return stream;
|
|
1279
|
-
} catch (error) {
|
|
1280
|
-
this.debug.error('Failed to start media:', error);
|
|
1281
|
-
throw error;
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
async stopMedia() {
|
|
1286
|
-
this.mediaManager.stopLocalStream();
|
|
1287
|
-
|
|
1288
|
-
// Update all existing peer connections to remove the stream
|
|
1289
|
-
const connections = this.connectionManager.getAllConnections();
|
|
1290
|
-
for (const connection of connections) {
|
|
1291
|
-
await connection.setLocalStream(null);
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1295
|
-
toggleVideo() {
|
|
1296
|
-
return this.mediaManager.toggleVideo();
|
|
1297
|
-
}
|
|
1298
|
-
|
|
1299
|
-
toggleAudio() {
|
|
1300
|
-
return this.mediaManager.toggleAudio();
|
|
1301
|
-
}
|
|
1302
|
-
|
|
1303
|
-
getMediaState() {
|
|
1304
|
-
return this.mediaManager.getMediaState();
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
|
-
getMediaDevices() {
|
|
1308
|
-
return this.mediaManager.devices;
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
async enumerateMediaDevices() {
|
|
1312
|
-
return await this.mediaManager.enumerateDevices();
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
getLocalStream() {
|
|
1316
|
-
return this.mediaManager.localStream;
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
// Get remote streams from all connected peers
|
|
1320
|
-
getRemoteStreams() {
|
|
1321
|
-
const streams = new Map();
|
|
1322
|
-
const connections = this.connectionManager.getAllConnections();
|
|
1323
|
-
|
|
1324
|
-
for (const connection of connections) {
|
|
1325
|
-
const remoteStream = connection.getRemoteStream();
|
|
1326
|
-
if (remoteStream) {
|
|
1327
|
-
streams.set(connection.peerId, remoteStream);
|
|
1328
|
-
}
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1331
|
-
return streams;
|
|
1332
|
-
}
|
|
1333
|
-
|
|
1334
|
-
// === SELECTIVE STREAMING CONTROL METHODS ===
|
|
1335
|
-
|
|
1336
|
-
/**
|
|
1337
|
-
* Enable streaming to specific peers only (1:1 or 1:many patterns)
|
|
1338
|
-
* @param {string|string[]} peerIds - Single peer ID or array of peer IDs to stream to
|
|
1339
|
-
* @param {Object} options - Stream options (video, audio, deviceIds)
|
|
1340
|
-
* @returns {Promise<MediaStream>} The local stream
|
|
1341
|
-
*/
|
|
1342
|
-
async startSelectiveStream(peerIds, options = {}) {
|
|
1343
|
-
// Normalize to array
|
|
1344
|
-
const targetPeerIds = Array.isArray(peerIds) ? peerIds : [peerIds];
|
|
1345
|
-
|
|
1346
|
-
this.debug.log(`🎯 SELECTIVE STREAM: Starting stream to ${targetPeerIds.length} specific peer(s)`);
|
|
1347
|
-
|
|
1348
|
-
// Start local media stream
|
|
1349
|
-
const stream = await this.mediaManager.startLocalStream(options);
|
|
1350
|
-
|
|
1351
|
-
// Get all connections
|
|
1352
|
-
const connections = this.connectionManager.getAllConnections();
|
|
1353
|
-
|
|
1354
|
-
// Apply stream only to target peers
|
|
1355
|
-
for (const connection of connections) {
|
|
1356
|
-
if (targetPeerIds.includes(connection.peerId)) {
|
|
1357
|
-
this.debug.log(`📡 SELECTIVE STREAM: Enabling stream for target peer ${connection.peerId.substring(0, 8)}...`);
|
|
1358
|
-
|
|
1359
|
-
// Enable remote stream reception on target peer
|
|
1360
|
-
if (connection.allowRemoteStreamEmission) {
|
|
1361
|
-
connection.allowRemoteStreamEmission();
|
|
1362
|
-
}
|
|
1363
|
-
|
|
1364
|
-
// Set local stream for this connection
|
|
1365
|
-
await connection.setLocalStream(stream);
|
|
1366
|
-
} else {
|
|
1367
|
-
this.debug.log(`🚫 SELECTIVE STREAM: Blocking stream for non-target peer ${connection.peerId.substring(0, 8)}...`);
|
|
1368
|
-
|
|
1369
|
-
// Ensure no stream is set for non-target peers
|
|
1370
|
-
await connection.setLocalStream(null);
|
|
1371
|
-
|
|
1372
|
-
// Block remote stream reception from non-target peers if desired
|
|
1373
|
-
if (connection.blockRemoteStreamEmission) {
|
|
1374
|
-
connection.blockRemoteStreamEmission();
|
|
1375
|
-
}
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
|
-
|
|
1379
|
-
// Emit event for UI updates
|
|
1380
|
-
this.emit('selectiveStreamStarted', {
|
|
1381
|
-
targetPeerIds,
|
|
1382
|
-
stream,
|
|
1383
|
-
streamType: targetPeerIds.length === 1 ? '1:1' : '1:many'
|
|
1384
|
-
});
|
|
1385
|
-
|
|
1386
|
-
return stream;
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
/**
|
|
1390
|
-
* Stop selective streaming and return to broadcast mode or stop entirely
|
|
1391
|
-
* @param {boolean} returnToBroadcast - If true, switch to broadcast mode; if false, stop streaming entirely
|
|
1392
|
-
*/
|
|
1393
|
-
async stopSelectiveStream(returnToBroadcast = false) {
|
|
1394
|
-
this.debug.log(`🛑 SELECTIVE STREAM: Stopping selective streaming (broadcast mode: ${returnToBroadcast})`);
|
|
1395
|
-
|
|
1396
|
-
if (returnToBroadcast) {
|
|
1397
|
-
// Switch to broadcast mode - enable streams for all connected peers
|
|
1398
|
-
await this.enableStreamingForAllPeers();
|
|
1399
|
-
} else {
|
|
1400
|
-
// Stop streaming entirely
|
|
1401
|
-
await this.stopMedia();
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
this.emit('selectiveStreamStopped', { returnToBroadcast });
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
/**
|
|
1408
|
-
* Enable streaming for all connected peers (broadcast mode)
|
|
1409
|
-
*/
|
|
1410
|
-
async enableStreamingForAllPeers() {
|
|
1411
|
-
this.debug.log('📡 BROADCAST STREAM: Enabling streaming for ALL connected peers');
|
|
1412
|
-
|
|
1413
|
-
const connections = this.connectionManager.getAllConnections();
|
|
1414
|
-
const currentStream = this.mediaManager.localStream;
|
|
1415
|
-
|
|
1416
|
-
for (const connection of connections) {
|
|
1417
|
-
this.debug.log(`📡 BROADCAST STREAM: Enabling stream for peer ${connection.peerId.substring(0, 8)}...`);
|
|
1418
|
-
|
|
1419
|
-
// Enable remote stream reception
|
|
1420
|
-
if (connection.allowRemoteStreamEmission) {
|
|
1421
|
-
connection.allowRemoteStreamEmission();
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
|
-
// Set local stream if we have one
|
|
1425
|
-
if (currentStream) {
|
|
1426
|
-
await connection.setLocalStream(currentStream);
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
|
|
1430
|
-
this.emit('broadcastStreamEnabled');
|
|
1431
|
-
}
|
|
1432
|
-
|
|
1433
|
-
/**
|
|
1434
|
-
* Block streaming to specific peers while maintaining streams to others
|
|
1435
|
-
* @param {string|string[]} peerIds - Peer ID(s) to block streaming to
|
|
1436
|
-
*/
|
|
1437
|
-
async blockStreamingToPeers(peerIds) {
|
|
1438
|
-
const targetPeerIds = Array.isArray(peerIds) ? peerIds : [peerIds];
|
|
1439
|
-
|
|
1440
|
-
this.debug.log(`🚫 BLOCK STREAM: Blocking streaming to ${targetPeerIds.length} peer(s)`);
|
|
1441
|
-
|
|
1442
|
-
for (const peerId of targetPeerIds) {
|
|
1443
|
-
const connection = this.connectionManager.getPeer(peerId);
|
|
1444
|
-
if (connection) {
|
|
1445
|
-
this.debug.log(`🚫 BLOCK STREAM: Blocking stream to peer ${peerId.substring(0, 8)}...`);
|
|
1446
|
-
|
|
1447
|
-
// Remove local stream from this connection
|
|
1448
|
-
await connection.setLocalStream(null);
|
|
1449
|
-
|
|
1450
|
-
// Block remote stream reception
|
|
1451
|
-
if (connection.blockRemoteStreamEmission) {
|
|
1452
|
-
connection.blockRemoteStreamEmission();
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
this.emit('streamingBlockedToPeers', { blockedPeerIds: targetPeerIds });
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
/**
|
|
1461
|
-
* Allow streaming to specific peers (unblock them)
|
|
1462
|
-
* @param {string|string[]} peerIds - Peer ID(s) to allow streaming to
|
|
1463
|
-
*/
|
|
1464
|
-
async allowStreamingToPeers(peerIds) {
|
|
1465
|
-
const targetPeerIds = Array.isArray(peerIds) ? peerIds : [peerIds];
|
|
1466
|
-
|
|
1467
|
-
this.debug.log(`✅ ALLOW STREAM: Allowing streaming to ${targetPeerIds.length} peer(s)`);
|
|
1468
|
-
|
|
1469
|
-
const currentStream = this.mediaManager.localStream;
|
|
1470
|
-
|
|
1471
|
-
for (const peerId of targetPeerIds) {
|
|
1472
|
-
const connection = this.connectionManager.getPeer(peerId);
|
|
1473
|
-
if (connection) {
|
|
1474
|
-
this.debug.log(`✅ ALLOW STREAM: Allowing stream to peer ${peerId.substring(0, 8)}...`);
|
|
1475
|
-
|
|
1476
|
-
// Enable remote stream reception
|
|
1477
|
-
if (connection.allowRemoteStreamEmission) {
|
|
1478
|
-
connection.allowRemoteStreamEmission();
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
|
-
// Set local stream if we have one
|
|
1482
|
-
if (currentStream) {
|
|
1483
|
-
await connection.setLocalStream(currentStream);
|
|
1484
|
-
}
|
|
1485
|
-
}
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
this.emit('streamingAllowedToPeers', { allowedPeerIds: targetPeerIds });
|
|
1489
|
-
}
|
|
1490
|
-
|
|
1491
|
-
/**
|
|
1492
|
-
* Get current streaming status for all connected peers
|
|
1493
|
-
* @returns {Map} Map of peer IDs to streaming status
|
|
1494
|
-
*/
|
|
1495
|
-
getStreamingStatus() {
|
|
1496
|
-
const status = new Map();
|
|
1497
|
-
const connections = this.connectionManager.getAllConnections();
|
|
1498
|
-
|
|
1499
|
-
for (const connection of connections) {
|
|
1500
|
-
const hasLocalStream = connection.getLocalStream() !== null;
|
|
1501
|
-
const allowsRemoteStreams = connection.allowRemoteStreams;
|
|
1502
|
-
|
|
1503
|
-
status.set(connection.peerId, {
|
|
1504
|
-
sendingStream: hasLocalStream,
|
|
1505
|
-
receivingStreams: allowsRemoteStreams,
|
|
1506
|
-
streamType: hasLocalStream ? (this.isStreamingToAll() ? 'broadcast' : 'selective') : 'none'
|
|
1507
|
-
});
|
|
1508
|
-
}
|
|
1509
|
-
|
|
1510
|
-
return status;
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
/**
|
|
1514
|
-
* Check if currently streaming to all connected peers
|
|
1515
|
-
* @returns {boolean} True if streaming to all peers
|
|
1516
|
-
*/
|
|
1517
|
-
isStreamingToAll() {
|
|
1518
|
-
const connections = this.connectionManager.getAllConnections();
|
|
1519
|
-
if (connections.length === 0) return false;
|
|
1520
|
-
|
|
1521
|
-
return connections.every(connection => connection.getLocalStream() !== null);
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
/**
|
|
1525
|
-
* Get list of peers currently receiving streams
|
|
1526
|
-
* @returns {string[]} Array of peer IDs receiving streams
|
|
1527
|
-
*/
|
|
1528
|
-
getStreamingPeers() {
|
|
1529
|
-
const connections = this.connectionManager.getAllConnections();
|
|
1530
|
-
return connections
|
|
1531
|
-
.filter(connection => connection.getLocalStream() !== null)
|
|
1532
|
-
.map(connection => connection.peerId);
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
/**
|
|
1536
|
-
* Get list of peers currently blocked from streaming
|
|
1537
|
-
* @returns {string[]} Array of peer IDs blocked from streaming
|
|
1538
|
-
*/
|
|
1539
|
-
getBlockedStreamingPeers() {
|
|
1540
|
-
const connections = this.connectionManager.getAllConnections();
|
|
1541
|
-
return connections
|
|
1542
|
-
.filter(connection => connection.getLocalStream() === null && this.mediaManager.localStream !== null)
|
|
1543
|
-
.map(connection => connection.peerId);
|
|
1544
|
-
}
|
|
1545
|
-
|
|
1546
|
-
// Static utility methods
|
|
1547
|
-
static validatePeerId(peerId) {
|
|
1548
|
-
return typeof peerId === 'string' && /^[a-fA-F0-9]{40}$/.test(peerId);
|
|
1549
|
-
}
|
|
1550
|
-
|
|
1551
|
-
static async generatePeerId() {
|
|
1552
|
-
const array = new Uint8Array(20);
|
|
1553
|
-
|
|
1554
|
-
// Environment-aware random value generation
|
|
1555
|
-
if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
|
|
1556
|
-
// Browser environment
|
|
1557
|
-
crypto.getRandomValues(array);
|
|
1558
|
-
} else if (typeof process !== 'undefined' && process.versions && process.versions.node) {
|
|
1559
|
-
// Node.js environment
|
|
1560
|
-
try {
|
|
1561
|
-
const crypto = await import('crypto');
|
|
1562
|
-
const randomBytes = crypto.randomBytes(20);
|
|
1563
|
-
array.set(randomBytes);
|
|
1564
|
-
} catch (e) {
|
|
1565
|
-
console.warn('Could not use Node.js crypto, falling back to Math.random');
|
|
1566
|
-
// Fallback to Math.random
|
|
1567
|
-
for (let i = 0; i < array.length; i++) {
|
|
1568
|
-
array[i] = Math.floor(Math.random() * 256);
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
} else {
|
|
1572
|
-
// Fallback for unknown environments
|
|
1573
|
-
console.warn('Secure random values not available, using fallback method');
|
|
1574
|
-
for (let i = 0; i < array.length; i++) {
|
|
1575
|
-
array[i] = Math.floor(Math.random() * 256);
|
|
1576
|
-
}
|
|
1577
|
-
}
|
|
1578
|
-
|
|
1579
|
-
return Array.from(array, byte => byte.toString(16).padStart(2, '0')).join('');
|
|
1580
|
-
}
|
|
1581
|
-
|
|
1582
|
-
// WebDHT methods - Low-level Distributed Hash Table for raw key-value storage
|
|
1583
|
-
// Note: For encrypted storage with access control, use this.distributedStorage instead
|
|
1584
|
-
/**
|
|
1585
|
-
* Store a key-value pair in the distributed hash table (low-level, no encryption)
|
|
1586
|
-
* @param {string} key - The key to store
|
|
1587
|
-
* @param {any} value - The value to store
|
|
1588
|
-
* @param {object} options - Storage options (ttl, etc.)
|
|
1589
|
-
* @returns {Promise<boolean>} True if stored successfully
|
|
1590
|
-
*/
|
|
1591
|
-
async dhtPut(key, value, options = {}) {
|
|
1592
|
-
if (!this.enableWebDHT) {
|
|
1593
|
-
throw new Error('WebDHT is disabled. Enable it by setting enableWebDHT: true in constructor options.');
|
|
1594
|
-
}
|
|
1595
|
-
if (!this.webDHT) {
|
|
1596
|
-
throw new Error('WebDHT not initialized');
|
|
1597
|
-
}
|
|
1598
|
-
return this.webDHT.put(key, value, options);
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
|
-
/**
|
|
1602
|
-
* Retrieve a value from the distributed hash table (low-level, no encryption)
|
|
1603
|
-
* @param {string} key - The key to retrieve
|
|
1604
|
-
* @param {object} options - Retrieval options (subscribe, etc.)
|
|
1605
|
-
* @returns {Promise<any>} The stored value or null if not found
|
|
1606
|
-
*/
|
|
1607
|
-
async dhtGet(key, options = {}) {
|
|
1608
|
-
if (!this.enableWebDHT) {
|
|
1609
|
-
throw new Error('WebDHT is disabled. Enable it by setting enableWebDHT: true in constructor options.');
|
|
1610
|
-
}
|
|
1611
|
-
if (!this.webDHT) {
|
|
1612
|
-
throw new Error('WebDHT not initialized');
|
|
1613
|
-
}
|
|
1614
|
-
return this.webDHT.get(key, options);
|
|
1615
|
-
}
|
|
1616
|
-
|
|
1617
|
-
/**
|
|
1618
|
-
* Subscribe to changes for a key in the DHT
|
|
1619
|
-
* @param {string} key - The key to subscribe to
|
|
1620
|
-
* @returns {Promise<any>} The current value
|
|
1621
|
-
*/
|
|
1622
|
-
async dhtSubscribe(key) {
|
|
1623
|
-
if (!this.enableWebDHT) {
|
|
1624
|
-
throw new Error('WebDHT is disabled. Enable it by setting enableWebDHT: true in constructor options.');
|
|
1625
|
-
}
|
|
1626
|
-
if (!this.webDHT) {
|
|
1627
|
-
throw new Error('WebDHT not initialized');
|
|
1628
|
-
}
|
|
1629
|
-
return this.webDHT.subscribe(key);
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1632
|
-
/**
|
|
1633
|
-
* Unsubscribe from changes for a key in the DHT
|
|
1634
|
-
* @param {string} key - The key to unsubscribe from
|
|
1635
|
-
*/
|
|
1636
|
-
async dhtUnsubscribe(key) {
|
|
1637
|
-
if (!this.enableWebDHT) {
|
|
1638
|
-
throw new Error('WebDHT is disabled. Enable it by setting enableWebDHT: true in constructor options.');
|
|
1639
|
-
}
|
|
1640
|
-
if (!this.webDHT) {
|
|
1641
|
-
throw new Error('WebDHT not initialized');
|
|
1642
|
-
}
|
|
1643
|
-
return this.webDHT.unsubscribe(key);
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
/**
|
|
1647
|
-
* Update a key's value and notify subscribers
|
|
1648
|
-
* @param {string} key - The key to update
|
|
1649
|
-
* @param {any} newValue - The new value
|
|
1650
|
-
* @param {object} options - Update options
|
|
1651
|
-
* @returns {Promise<boolean>} True if updated successfully
|
|
1652
|
-
*/
|
|
1653
|
-
async dhtUpdate(key, newValue, options = {}) {
|
|
1654
|
-
if (!this.enableWebDHT) {
|
|
1655
|
-
throw new Error('WebDHT is disabled. Enable it by setting enableWebDHT: true in constructor options.');
|
|
1656
|
-
}
|
|
1657
|
-
if (!this.webDHT) {
|
|
1658
|
-
throw new Error('WebDHT not initialized');
|
|
1659
|
-
}
|
|
1660
|
-
return this.webDHT.update(key, newValue, options);
|
|
1661
|
-
}
|
|
1662
|
-
|
|
1663
|
-
/**
|
|
1664
|
-
* Get DHT statistics
|
|
1665
|
-
* @returns {object} DHT statistics
|
|
1666
|
-
*/
|
|
1667
|
-
getDHTStats() {
|
|
1668
|
-
if (!this.enableWebDHT) {
|
|
1669
|
-
return { error: 'WebDHT is disabled. Enable it by setting enableWebDHT: true in constructor options.' };
|
|
1670
|
-
}
|
|
1671
|
-
if (!this.webDHT) {
|
|
1672
|
-
return { error: 'WebDHT not initialized' };
|
|
1673
|
-
}
|
|
1674
|
-
return this.webDHT.getStats();
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
|
-
/**
|
|
1678
|
-
* Check if WebDHT is enabled
|
|
1679
|
-
* @returns {boolean} True if WebDHT is enabled
|
|
1680
|
-
*/
|
|
1681
|
-
isDHTEnabled() {
|
|
1682
|
-
return this.enableWebDHT;
|
|
1683
|
-
}
|
|
1684
|
-
|
|
1685
|
-
/**
|
|
1686
|
-
* Setup WebDHT event handlers
|
|
1687
|
-
*/
|
|
1688
|
-
setupWebDHTEventHandlers() {
|
|
1689
|
-
// Only set up if webDHT exists
|
|
1690
|
-
if (this.webDHT) {
|
|
1691
|
-
this.webDHT.addEventListener('valueChanged', (data) => {
|
|
1692
|
-
this.emit('dhtValueChanged', data);
|
|
1693
|
-
});
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
|
|
1697
|
-
/**
|
|
1698
|
-
* Setup event handlers for DistributedStorageManager
|
|
1699
|
-
*/
|
|
1700
|
-
setupDistributedStorageEventHandlers() {
|
|
1701
|
-
// Only set up if distributedStorage exists
|
|
1702
|
-
if (this.distributedStorage) {
|
|
1703
|
-
this.distributedStorage.addEventListener('dataStored', (data) => {
|
|
1704
|
-
this.emit('storageDataStored', data);
|
|
1705
|
-
});
|
|
1706
|
-
|
|
1707
|
-
this.distributedStorage.addEventListener('dataRetrieved', (data) => {
|
|
1708
|
-
this.emit('storageDataRetrieved', data);
|
|
1709
|
-
});
|
|
1710
|
-
|
|
1711
|
-
this.distributedStorage.addEventListener('dataUpdated', (data) => {
|
|
1712
|
-
this.emit('storageDataUpdated', data);
|
|
1713
|
-
});
|
|
1714
|
-
|
|
1715
|
-
this.distributedStorage.addEventListener('dataDeleted', (data) => {
|
|
1716
|
-
this.emit('storageDataDeleted', data);
|
|
1717
|
-
});
|
|
1718
|
-
|
|
1719
|
-
this.distributedStorage.addEventListener('accessGranted', (data) => {
|
|
1720
|
-
this.emit('storageAccessGranted', data);
|
|
1721
|
-
});
|
|
1722
|
-
|
|
1723
|
-
this.distributedStorage.addEventListener('accessRevoked', (data) => {
|
|
1724
|
-
this.emit('storageAccessRevoked', data);
|
|
1725
|
-
});
|
|
1726
|
-
}
|
|
1727
|
-
}
|
|
1728
|
-
|
|
1729
|
-
/**
|
|
1730
|
-
* Connect to a specific peer by ID
|
|
1731
|
-
*/
|
|
1732
|
-
connectToPeer(peerId) {
|
|
1733
|
-
if (!peerId || typeof peerId !== 'string') {
|
|
1734
|
-
throw new Error('Valid peer ID is required');
|
|
1735
|
-
}
|
|
1736
|
-
|
|
1737
|
-
if (peerId === this.peerId) {
|
|
1738
|
-
throw new Error('Cannot connect to yourself');
|
|
1739
|
-
}
|
|
1740
|
-
|
|
1741
|
-
return this.connectionManager.connectToPeer(peerId);
|
|
1742
|
-
}
|
|
1743
|
-
|
|
1744
|
-
/**
|
|
1745
|
-
* Get the current environment report
|
|
1746
|
-
* @returns {object} Complete environment detection report
|
|
1747
|
-
*/
|
|
1748
|
-
getEnvironmentReport() {
|
|
1749
|
-
return this.environmentReport;
|
|
1750
|
-
}
|
|
1751
|
-
|
|
1752
|
-
/**
|
|
1753
|
-
* Get runtime capabilities
|
|
1754
|
-
* @returns {object} Capabilities detected during initialization
|
|
1755
|
-
*/
|
|
1756
|
-
getCapabilities() {
|
|
1757
|
-
return this.capabilities;
|
|
1758
|
-
}
|
|
1759
|
-
|
|
1760
|
-
/**
|
|
1761
|
-
* Get runtime information
|
|
1762
|
-
* @returns {object} Runtime environment information
|
|
1763
|
-
*/
|
|
1764
|
-
getRuntimeInfo() {
|
|
1765
|
-
return this.runtimeInfo;
|
|
1766
|
-
}
|
|
1767
|
-
|
|
1768
|
-
/**
|
|
1769
|
-
* Check if a specific feature is supported
|
|
1770
|
-
* @param {string} feature - The feature to check (e.g., 'webrtc', 'websocket', 'localstorage')
|
|
1771
|
-
* @returns {boolean} True if the feature is supported
|
|
1772
|
-
*/
|
|
1773
|
-
hasFeature(feature) {
|
|
1774
|
-
return environmentDetector.hasFeature(feature);
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
|
-
/**
|
|
1778
|
-
* Get environment-specific recommendations
|
|
1779
|
-
* @returns {object} Recommendations based on current environment
|
|
1780
|
-
*/
|
|
1781
|
-
getEnvironmentRecommendations() {
|
|
1782
|
-
const recommendations = [];
|
|
1783
|
-
const report = this.environmentReport;
|
|
1784
|
-
|
|
1785
|
-
if (report.runtime.isBrowser) {
|
|
1786
|
-
if (!report.network.online) {
|
|
1787
|
-
recommendations.push({
|
|
1788
|
-
type: 'warning',
|
|
1789
|
-
message: 'Browser is offline. Enable network connectivity for mesh functionality.'
|
|
1790
|
-
});
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
if (typeof location !== 'undefined' && location.protocol === 'http:' && location.hostname !== 'localhost') {
|
|
1794
|
-
recommendations.push({
|
|
1795
|
-
type: 'security',
|
|
1796
|
-
message: 'Consider using HTTPS for better WebRTC compatibility and security.'
|
|
1797
|
-
});
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
|
-
if (report.browser && report.browser.name === 'safari') {
|
|
1801
|
-
recommendations.push({
|
|
1802
|
-
type: 'compatibility',
|
|
1803
|
-
message: 'Safari has some WebRTC limitations. Test thoroughly for production use.'
|
|
1804
|
-
});
|
|
1805
|
-
}
|
|
1806
|
-
}
|
|
1807
|
-
|
|
1808
|
-
if (report.runtime.isNodeJS) {
|
|
1809
|
-
if (!report.capabilities.webSocket) {
|
|
1810
|
-
recommendations.push({
|
|
1811
|
-
type: 'dependency',
|
|
1812
|
-
message: 'Install the "ws" package for WebSocket support: npm install ws'
|
|
1813
|
-
});
|
|
1814
|
-
}
|
|
1815
|
-
|
|
1816
|
-
if (!report.capabilities.webrtc) {
|
|
1817
|
-
recommendations.push({
|
|
1818
|
-
type: 'dependency',
|
|
1819
|
-
message: 'Install "node-webrtc" or similar for WebRTC support in Node.js: npm install node-webrtc'
|
|
1820
|
-
});
|
|
1821
|
-
}
|
|
1822
|
-
}
|
|
1823
|
-
|
|
1824
|
-
if (!report.capabilities.localStorage && !report.capabilities.sessionStorage) {
|
|
1825
|
-
recommendations.push({
|
|
1826
|
-
type: 'feature',
|
|
1827
|
-
message: 'No persistent storage available. Peer ID will change on restart.'
|
|
1828
|
-
});
|
|
1829
|
-
}
|
|
1830
|
-
|
|
1831
|
-
return {
|
|
1832
|
-
environment: report.runtime,
|
|
1833
|
-
recommendations
|
|
1834
|
-
};
|
|
1835
|
-
}
|
|
1836
|
-
|
|
1837
|
-
// ============================================
|
|
1838
|
-
// Cryptographic Methods (unsea integration)
|
|
1839
|
-
// ============================================
|
|
1840
|
-
|
|
1841
|
-
/**
|
|
1842
|
-
* Initialize crypto with user credentials
|
|
1843
|
-
* @param {Object} options - Crypto initialization options
|
|
1844
|
-
* @param {string} options.alias - User alias for persistent identity
|
|
1845
|
-
* @param {string} options.password - User password
|
|
1846
|
-
* @returns {Promise<boolean>} True if crypto was initialized successfully
|
|
1847
|
-
*/
|
|
1848
|
-
async initCrypto(options = {}) {
|
|
1849
|
-
if (!this.enableCrypto) {
|
|
1850
|
-
this.enableCrypto = true;
|
|
1851
|
-
this.cryptoManager = new CryptoManager();
|
|
1852
|
-
}
|
|
1853
|
-
|
|
1854
|
-
if (!this.cryptoManager) {
|
|
1855
|
-
throw new Error('Crypto manager not available');
|
|
1856
|
-
}
|
|
1857
|
-
|
|
1858
|
-
try {
|
|
1859
|
-
await this.cryptoManager.init(options);
|
|
1860
|
-
return true;
|
|
1861
|
-
} catch (error) {
|
|
1862
|
-
this.debug.error('Failed to initialize crypto:', error);
|
|
1863
|
-
throw error;
|
|
1864
|
-
}
|
|
1865
|
-
}
|
|
1866
|
-
|
|
1867
|
-
/**
|
|
1868
|
-
* Get crypto status and information
|
|
1869
|
-
* @returns {Object} Crypto status information
|
|
1870
|
-
*/
|
|
1871
|
-
getCryptoStatus() {
|
|
1872
|
-
if (!this.cryptoManager) {
|
|
1873
|
-
return {
|
|
1874
|
-
enabled: false,
|
|
1875
|
-
initialized: false,
|
|
1876
|
-
error: 'Crypto not enabled. Enable with enableCrypto: true in constructor'
|
|
1877
|
-
};
|
|
1878
|
-
}
|
|
1879
|
-
|
|
1880
|
-
return this.cryptoManager.getStatus();
|
|
1881
|
-
}
|
|
1882
|
-
|
|
1883
|
-
/**
|
|
1884
|
-
* Enable/disable crypto functionality
|
|
1885
|
-
* @param {boolean} enabled - Whether to enable crypto
|
|
1886
|
-
*/
|
|
1887
|
-
setCrypto(enabled) {
|
|
1888
|
-
if (enabled && !this.cryptoManager) {
|
|
1889
|
-
this.cryptoManager = new CryptoManager();
|
|
1890
|
-
}
|
|
1891
|
-
this.enableCrypto = enabled;
|
|
1892
|
-
}
|
|
1893
|
-
|
|
1894
|
-
/**
|
|
1895
|
-
* Encrypt a message without sending it
|
|
1896
|
-
* @param {any} content - Message content to encrypt
|
|
1897
|
-
* @param {string} peerId - Optional target peer ID for peer-to-peer encryption
|
|
1898
|
-
* @param {string} groupId - Optional group ID for group encryption
|
|
1899
|
-
* @returns {Promise<Object>} Encrypted message object
|
|
1900
|
-
*/
|
|
1901
|
-
async encryptMessage(content, peerId = null, groupId = null) {
|
|
1902
|
-
if (!this.enableCrypto || !this.cryptoManager) {
|
|
1903
|
-
throw new Error('Crypto not enabled or initialized');
|
|
1904
|
-
}
|
|
1905
|
-
|
|
1906
|
-
try {
|
|
1907
|
-
if (groupId) {
|
|
1908
|
-
return await this.cryptoManager.encryptForGroup(content, groupId);
|
|
1909
|
-
} else if (peerId) {
|
|
1910
|
-
return await this.cryptoManager.encryptForPeer(content, peerId);
|
|
1911
|
-
} else {
|
|
1912
|
-
// For benchmark/testing purposes, encrypt with our own public key
|
|
1913
|
-
const ourPeerId = this.peerId;
|
|
1914
|
-
const ourKeypair = this.cryptoManager.keypair;
|
|
1915
|
-
if (ourKeypair && ourKeypair.pub && ourKeypair.epub) {
|
|
1916
|
-
// Add our own key temporarily for testing (include both pub and epub)
|
|
1917
|
-
this.cryptoManager.addPeerKey(ourPeerId, {
|
|
1918
|
-
pub: ourKeypair.pub,
|
|
1919
|
-
epub: ourKeypair.epub
|
|
1920
|
-
});
|
|
1921
|
-
return await this.cryptoManager.encryptForPeer(content, ourPeerId);
|
|
1922
|
-
} else {
|
|
1923
|
-
throw new Error('No complete keypair available for encryption (need both pub and epub)');
|
|
1924
|
-
}
|
|
1925
|
-
}
|
|
1926
|
-
} catch (error) {
|
|
1927
|
-
this.debug.error('Failed to encrypt message:', error);
|
|
1928
|
-
throw error;
|
|
1929
|
-
}
|
|
1930
|
-
}
|
|
1931
|
-
|
|
1932
|
-
/**
|
|
1933
|
-
* Send a signaling message over the mesh (peer-to-peer) instead of the signaling server
|
|
1934
|
-
* This allows peers to coordinate without the signaling server after initial connection
|
|
1935
|
-
* @param {Object} message - The signaling message
|
|
1936
|
-
* @param {string} targetPeerId - Target peer ID (optional, for direct signaling)
|
|
1937
|
-
* @returns {Promise<boolean>} Success status
|
|
1938
|
-
*/
|
|
1939
|
-
async sendMeshSignalingMessage(message, targetPeerId = null) {
|
|
1940
|
-
if (!this.connected) {
|
|
1941
|
-
this.debug.warn('Cannot send mesh signaling message - mesh not connected');
|
|
1942
|
-
return false;
|
|
1943
|
-
}
|
|
1944
|
-
|
|
1945
|
-
const signalingMessage = {
|
|
1946
|
-
type: 'mesh_signaling',
|
|
1947
|
-
meshSignalingType: message.type,
|
|
1948
|
-
data: message.data,
|
|
1949
|
-
fromPeerId: this.peerId,
|
|
1950
|
-
targetPeerId,
|
|
1951
|
-
timestamp: Date.now(),
|
|
1952
|
-
messageId: this.generateMessageId()
|
|
1953
|
-
};
|
|
1954
|
-
|
|
1955
|
-
this.debug.log(`📡 Sending mesh signaling message: ${message.type} ${targetPeerId ? `to ${targetPeerId.substring(0, 8)}...` : '(broadcast)'}`);
|
|
1956
|
-
|
|
1957
|
-
try {
|
|
1958
|
-
if (targetPeerId) {
|
|
1959
|
-
// Send directly to target peer
|
|
1960
|
-
return await this.sendDirectMessage(targetPeerId, signalingMessage);
|
|
1961
|
-
} else {
|
|
1962
|
-
// Broadcast to all connected peers
|
|
1963
|
-
return this.broadcast(signalingMessage);
|
|
1964
|
-
}
|
|
1965
|
-
} catch (error) {
|
|
1966
|
-
this.debug.error('Failed to send mesh signaling message:', error);
|
|
1967
|
-
return false;
|
|
1968
|
-
}
|
|
1969
|
-
}
|
|
1970
|
-
|
|
1971
|
-
/**
|
|
1972
|
-
* Handle incoming mesh signaling messages
|
|
1973
|
-
* @param {Object} message - The mesh signaling message
|
|
1974
|
-
* @param {string} from - Sender peer ID
|
|
1975
|
-
* @private
|
|
1976
|
-
*/
|
|
1977
|
-
_handleMeshSignalingMessage(message, from) {
|
|
1978
|
-
if (!message.meshSignalingType || !message.data) {
|
|
1979
|
-
this.debug.warn('Invalid mesh signaling message format');
|
|
1980
|
-
return;
|
|
1981
|
-
}
|
|
1982
|
-
|
|
1983
|
-
// Only process messages intended for us or broadcasts
|
|
1984
|
-
if (message.targetPeerId && message.targetPeerId !== this.peerId) {
|
|
1985
|
-
this.debug.log(`Ignoring mesh signaling message not intended for us (target: ${message.targetPeerId?.substring(0, 8)}...)`);
|
|
1986
|
-
return;
|
|
1987
|
-
}
|
|
1988
|
-
|
|
1989
|
-
this.debug.log(`📡 Received mesh signaling message: ${message.meshSignalingType} from ${from.substring(0, 8)}...`);
|
|
1990
|
-
|
|
1991
|
-
// Create a signaling message format that our existing handler can process
|
|
1992
|
-
const reconstitutedMessage = {
|
|
1993
|
-
type: message.meshSignalingType,
|
|
1994
|
-
data: message.data,
|
|
1995
|
-
fromPeerId: from,
|
|
1996
|
-
targetPeerId: message.targetPeerId,
|
|
1997
|
-
timestamp: message.timestamp,
|
|
1998
|
-
messageId: message.messageId,
|
|
1999
|
-
viaWebSocket: false, // Mark as coming from mesh, not WebSocket
|
|
2000
|
-
viaMesh: true
|
|
2001
|
-
};
|
|
2002
|
-
|
|
2003
|
-
// Forward to our existing signaling handler
|
|
2004
|
-
this.signalingHandler.handleSignalingMessage(reconstitutedMessage);
|
|
2005
|
-
}
|
|
2006
|
-
|
|
2007
|
-
/**
|
|
2008
|
-
* Handle incoming gossip stream chunk
|
|
2009
|
-
* @param {Object} message - The stream chunk message
|
|
2010
|
-
* @param {string} from - Sender peer ID
|
|
2011
|
-
* @private
|
|
2012
|
-
*/
|
|
2013
|
-
_handleGossipStreamChunk(message, from) {
|
|
2014
|
-
const { streamId, chunkIndex, data, metadata } = message;
|
|
2015
|
-
|
|
2016
|
-
if (!streamId || chunkIndex === undefined || !data) {
|
|
2017
|
-
this.debug.error('Invalid gossip stream chunk format');
|
|
2018
|
-
return;
|
|
2019
|
-
}
|
|
2020
|
-
|
|
2021
|
-
this.debug.log(`📥 Received gossip stream chunk ${chunkIndex} for ${streamId.substring(0, 8)}... from ${from.substring(0, 8)}...`);
|
|
2022
|
-
|
|
2023
|
-
// Initialize stream if this is the first chunk
|
|
2024
|
-
if (!this.gossipStreams.has(streamId)) {
|
|
2025
|
-
const chunks = new Map();
|
|
2026
|
-
let controller;
|
|
2027
|
-
|
|
2028
|
-
const readable = new ReadableStream({
|
|
2029
|
-
start(ctrl) {
|
|
2030
|
-
controller = ctrl;
|
|
2031
|
-
},
|
|
2032
|
-
cancel: (reason) => {
|
|
2033
|
-
this.debug.log(`📥 Gossip stream ${streamId.substring(0, 8)}... cancelled: ${reason}`);
|
|
2034
|
-
}
|
|
2035
|
-
});
|
|
2036
|
-
|
|
2037
|
-
this.gossipStreams.set(streamId, {
|
|
2038
|
-
chunks,
|
|
2039
|
-
metadata: metadata || {},
|
|
2040
|
-
controller,
|
|
2041
|
-
stream: readable,
|
|
2042
|
-
from,
|
|
2043
|
-
totalChunks: null
|
|
2044
|
-
});
|
|
2045
|
-
|
|
2046
|
-
// Emit stream received event
|
|
2047
|
-
this.emit('streamReceived', {
|
|
2048
|
-
peerId: from,
|
|
2049
|
-
streamId,
|
|
2050
|
-
stream: readable,
|
|
2051
|
-
metadata: metadata || {}
|
|
2052
|
-
});
|
|
2053
|
-
}
|
|
2054
|
-
|
|
2055
|
-
// Store chunk
|
|
2056
|
-
const streamData = this.gossipStreams.get(streamId);
|
|
2057
|
-
streamData.chunks.set(chunkIndex, new Uint8Array(data));
|
|
2058
|
-
|
|
2059
|
-
// Enqueue chunk to the readable stream in order
|
|
2060
|
-
this._enqueueOrderedChunks(streamId);
|
|
2061
|
-
}
|
|
2062
|
-
|
|
2063
|
-
/**
|
|
2064
|
-
* Handle incoming gossip stream control message
|
|
2065
|
-
* @param {Object} message - The stream control message
|
|
2066
|
-
* @param {string} from - Sender peer ID
|
|
2067
|
-
* @private
|
|
2068
|
-
*/
|
|
2069
|
-
_handleGossipStreamControl(message, from) {
|
|
2070
|
-
const { streamId, action, totalChunks, totalBytes, metadata, reason } = message;
|
|
2071
|
-
|
|
2072
|
-
if (!streamId || !action) {
|
|
2073
|
-
this.debug.error('Invalid gossip stream control format');
|
|
2074
|
-
return;
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
const streamData = this.gossipStreams.get(streamId);
|
|
2078
|
-
if (!streamData) {
|
|
2079
|
-
this.debug.warn(`Received control message for unknown stream: ${streamId.substring(0, 8)}...`);
|
|
2080
|
-
return;
|
|
2081
|
-
}
|
|
2082
|
-
|
|
2083
|
-
if (action === 'end') {
|
|
2084
|
-
this.debug.log(`📥 Gossip stream ${streamId.substring(0, 8)}... ended: ${totalBytes} bytes in ${totalChunks} chunks`);
|
|
2085
|
-
|
|
2086
|
-
streamData.totalChunks = totalChunks;
|
|
2087
|
-
|
|
2088
|
-
// Enqueue any remaining chunks and close
|
|
2089
|
-
this._enqueueOrderedChunks(streamId);
|
|
2090
|
-
|
|
2091
|
-
if (streamData.controller) {
|
|
2092
|
-
streamData.controller.close();
|
|
2093
|
-
}
|
|
2094
|
-
|
|
2095
|
-
// Emit completion event
|
|
2096
|
-
this.emit('streamCompleted', {
|
|
2097
|
-
peerId: from,
|
|
2098
|
-
streamId,
|
|
2099
|
-
totalChunks,
|
|
2100
|
-
totalBytes
|
|
2101
|
-
});
|
|
2102
|
-
|
|
2103
|
-
// Clean up after a delay
|
|
2104
|
-
setTimeout(() => {
|
|
2105
|
-
this.gossipStreams.delete(streamId);
|
|
2106
|
-
}, 5000);
|
|
2107
|
-
} else if (action === 'abort') {
|
|
2108
|
-
this.debug.log(`❌ Gossip stream ${streamId.substring(0, 8)}... aborted: ${reason}`);
|
|
2109
|
-
|
|
2110
|
-
if (streamData.controller) {
|
|
2111
|
-
streamData.controller.error(new Error(reason || 'Stream aborted'));
|
|
2112
|
-
}
|
|
2113
|
-
|
|
2114
|
-
// Emit abort event
|
|
2115
|
-
this.emit('streamAborted', {
|
|
2116
|
-
peerId: from,
|
|
2117
|
-
streamId,
|
|
2118
|
-
reason
|
|
2119
|
-
});
|
|
2120
|
-
|
|
2121
|
-
// Clean up
|
|
2122
|
-
this.gossipStreams.delete(streamId);
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
|
|
2126
|
-
/**
|
|
2127
|
-
* Enqueue ordered chunks to the readable stream
|
|
2128
|
-
* @param {string} streamId - The stream ID
|
|
2129
|
-
* @private
|
|
2130
|
-
*/
|
|
2131
|
-
_enqueueOrderedChunks(streamId) {
|
|
2132
|
-
const streamData = this.gossipStreams.get(streamId);
|
|
2133
|
-
if (!streamData || !streamData.controller) return;
|
|
2134
|
-
|
|
2135
|
-
const { chunks, controller } = streamData;
|
|
2136
|
-
let nextIndex = streamData.nextIndex || 0;
|
|
2137
|
-
|
|
2138
|
-
// Enqueue all consecutive chunks
|
|
2139
|
-
while (chunks.has(nextIndex)) {
|
|
2140
|
-
const chunk = chunks.get(nextIndex);
|
|
2141
|
-
try {
|
|
2142
|
-
controller.enqueue(chunk);
|
|
2143
|
-
chunks.delete(nextIndex);
|
|
2144
|
-
nextIndex++;
|
|
2145
|
-
} catch (error) {
|
|
2146
|
-
this.debug.error(`Failed to enqueue chunk ${nextIndex}:`, error);
|
|
2147
|
-
break;
|
|
2148
|
-
}
|
|
2149
|
-
}
|
|
2150
|
-
|
|
2151
|
-
streamData.nextIndex = nextIndex;
|
|
2152
|
-
}
|
|
2153
|
-
|
|
2154
|
-
/**
|
|
2155
|
-
* Send a signaling message, using mesh connections for renegotiation
|
|
2156
|
-
* @param {Object} message - The signaling message
|
|
2157
|
-
* @param {string} targetPeerId - Target peer ID (optional)
|
|
2158
|
-
* @returns {Promise<boolean>} Success status
|
|
2159
|
-
*/
|
|
2160
|
-
async sendSignalingMessage(message, targetPeerId = null) {
|
|
2161
|
-
// CRITICAL FIX: Use mesh for renegotiation, WebSocket only for initial handshake
|
|
2162
|
-
const isRenegotiation = message.type === 'renegotiation-offer' || message.type === 'renegotiation-answer';
|
|
2163
|
-
|
|
2164
|
-
if (isRenegotiation && targetPeerId) {
|
|
2165
|
-
// Use existing mesh connection for renegotiation
|
|
2166
|
-
this.debug.log(`🔄 MESH RENEGOTIATION: Sending ${message.type} via mesh to ${targetPeerId.substring(0, 8)}...`);
|
|
2167
|
-
|
|
2168
|
-
const peerConnection = this.connectionManager.getPeer(targetPeerId);
|
|
2169
|
-
if (peerConnection && peerConnection.sendMessage) {
|
|
2170
|
-
const success = peerConnection.sendMessage({
|
|
2171
|
-
type: 'signaling',
|
|
2172
|
-
data: message,
|
|
2173
|
-
fromPeerId: this.peerId,
|
|
2174
|
-
timestamp: Date.now()
|
|
2175
|
-
});
|
|
2176
|
-
|
|
2177
|
-
if (success) {
|
|
2178
|
-
this.debug.log(`✅ MESH RENEGOTIATION: ${message.type} sent via mesh to ${targetPeerId.substring(0, 8)}...`);
|
|
2179
|
-
return true;
|
|
2180
|
-
} else {
|
|
2181
|
-
this.debug.error(`❌ MESH RENEGOTIATION: Failed to send ${message.type} via mesh to ${targetPeerId.substring(0, 8)}...`);
|
|
2182
|
-
}
|
|
2183
|
-
} else {
|
|
2184
|
-
this.debug.error(`❌ MESH RENEGOTIATION: No mesh connection to ${targetPeerId.substring(0, 8)}... for ${message.type}`);
|
|
2185
|
-
}
|
|
2186
|
-
|
|
2187
|
-
// Fall back to WebSocket if mesh fails
|
|
2188
|
-
this.debug.log(`🔄 FALLBACK: Using WebSocket for ${message.type} to ${targetPeerId.substring(0, 8)}...`);
|
|
2189
|
-
}
|
|
2190
|
-
|
|
2191
|
-
// Use WebSocket for initial offers/answers and fallback
|
|
2192
|
-
if (this.signalingClient && this.signalingClient.isConnected()) {
|
|
2193
|
-
this.debug.log(`📡 Using WebSocket signaling for ${message.type} to ${targetPeerId?.substring(0, 8) || 'broadcast'}`);
|
|
2194
|
-
|
|
2195
|
-
// Include targetPeerId in the message if provided
|
|
2196
|
-
const messageWithTarget = { ...message };
|
|
2197
|
-
if (targetPeerId) {
|
|
2198
|
-
messageWithTarget.targetPeerId = targetPeerId;
|
|
2199
|
-
}
|
|
2200
|
-
|
|
2201
|
-
return await this.signalingClient.sendSignalingMessage(messageWithTarget);
|
|
2202
|
-
}
|
|
2203
|
-
|
|
2204
|
-
this.debug.warn(`📡 Cannot send signaling message ${message.type} - WebSocket not connected and mesh failed`);
|
|
2205
|
-
return false;
|
|
2206
|
-
}
|
|
2207
|
-
|
|
2208
|
-
/**
|
|
2209
|
-
* Send an encrypted message to a specific peer
|
|
2210
|
-
* @param {string} peerId - Target peer ID
|
|
2211
|
-
* @param {any} content - Message content
|
|
2212
|
-
* @param {Object} options - Message options
|
|
2213
|
-
* @returns {Promise<string|null>} Message ID if sent successfully
|
|
2214
|
-
*/
|
|
2215
|
-
async sendEncryptedMessage(peerId, content, _options = {}) {
|
|
2216
|
-
if (!this.enableCrypto || !this.cryptoManager) {
|
|
2217
|
-
throw new Error('Crypto not enabled or initialized');
|
|
2218
|
-
}
|
|
2219
|
-
|
|
2220
|
-
try {
|
|
2221
|
-
const encryptedContent = await this.cryptoManager.encryptForPeer(content, peerId);
|
|
2222
|
-
return await this.sendDirectMessage(peerId, encryptedContent);
|
|
2223
|
-
} catch (error) {
|
|
2224
|
-
this.debug.error('Failed to send encrypted message:', error);
|
|
2225
|
-
throw error;
|
|
2226
|
-
}
|
|
2227
|
-
}
|
|
2228
|
-
|
|
2229
|
-
/**
|
|
2230
|
-
* Send an encrypted broadcast message
|
|
2231
|
-
* @param {any} content - Message content
|
|
2232
|
-
* @param {string} groupId - Optional group ID for group encryption
|
|
2233
|
-
* @returns {Promise<string|null>} Message ID if sent successfully
|
|
2234
|
-
*/
|
|
2235
|
-
async sendEncryptedBroadcast(content, groupId = null) {
|
|
2236
|
-
if (!this.enableCrypto || !this.cryptoManager) {
|
|
2237
|
-
throw new Error('Crypto not enabled or initialized');
|
|
2238
|
-
}
|
|
2239
|
-
|
|
2240
|
-
try {
|
|
2241
|
-
let encryptedContent;
|
|
2242
|
-
if (groupId) {
|
|
2243
|
-
encryptedContent = await this.cryptoManager.encryptForGroup(content, groupId);
|
|
2244
|
-
} else {
|
|
2245
|
-
// For broadcast without group, we'll need to encrypt for each peer individually
|
|
2246
|
-
// This is a simplified approach - in practice, you'd use group keys
|
|
2247
|
-
encryptedContent = {
|
|
2248
|
-
encrypted: true,
|
|
2249
|
-
broadcast: true,
|
|
2250
|
-
data: content,
|
|
2251
|
-
from: this.cryptoManager.getPublicKey(),
|
|
2252
|
-
timestamp: Date.now()
|
|
2253
|
-
};
|
|
2254
|
-
}
|
|
2255
|
-
// Use 'encrypted' message type instead of 'chat' for encrypted broadcasts
|
|
2256
|
-
return await this.gossipManager.broadcastMessage(encryptedContent, 'encrypted');
|
|
2257
|
-
} catch (error) {
|
|
2258
|
-
this.debug.error('Failed to send encrypted broadcast:', error);
|
|
2259
|
-
throw error;
|
|
2260
|
-
}
|
|
2261
|
-
}
|
|
2262
|
-
|
|
2263
|
-
/**
|
|
2264
|
-
* Decrypt a received message
|
|
2265
|
-
* @param {Object} encryptedData - Encrypted message data
|
|
2266
|
-
* @returns {Promise<any>} Decrypted content
|
|
2267
|
-
*/
|
|
2268
|
-
async decryptMessage(encryptedData) {
|
|
2269
|
-
if (!this.enableCrypto || !this.cryptoManager) {
|
|
2270
|
-
return encryptedData; // Return as-is if crypto not enabled
|
|
2271
|
-
}
|
|
2272
|
-
|
|
2273
|
-
try {
|
|
2274
|
-
if (encryptedData.group) {
|
|
2275
|
-
return await this.cryptoManager.decryptFromGroup(encryptedData);
|
|
2276
|
-
} else {
|
|
2277
|
-
return await this.cryptoManager.decryptFromPeer(encryptedData);
|
|
2278
|
-
}
|
|
2279
|
-
} catch (error) {
|
|
2280
|
-
this.debug.error('Failed to decrypt message:', error);
|
|
2281
|
-
throw error;
|
|
2282
|
-
}
|
|
2283
|
-
}
|
|
2284
|
-
|
|
2285
|
-
/**
|
|
2286
|
-
* Exchange public keys with a peer
|
|
2287
|
-
* @param {string} peerId - Peer ID to exchange keys with
|
|
2288
|
-
*/
|
|
2289
|
-
async exchangeKeysWithPeer(peerId) {
|
|
2290
|
-
if (!this.enableCrypto || !this.cryptoManager) {
|
|
2291
|
-
throw new Error('Crypto not enabled or initialized');
|
|
2292
|
-
}
|
|
2293
|
-
|
|
2294
|
-
// Check if we're already in the process of exchanging keys with this peer
|
|
2295
|
-
if (this.ongoingKeyExchanges.has(peerId)) {
|
|
2296
|
-
this.debug.log(`🔐 Skipping key exchange with ${peerId.substring(0, 8)}... - exchange already in progress`);
|
|
2297
|
-
return;
|
|
2298
|
-
}
|
|
2299
|
-
|
|
2300
|
-
// Check if we already have this peer's key to avoid duplicate exchanges
|
|
2301
|
-
const hasExistingKey = this.cryptoManager.peerKeys.has(peerId);
|
|
2302
|
-
if (hasExistingKey) {
|
|
2303
|
-
this.debug.log(`🔐 Skipping key exchange with ${peerId.substring(0, 8)}... - key already exists`);
|
|
2304
|
-
return;
|
|
2305
|
-
}
|
|
2306
|
-
|
|
2307
|
-
const keypair = this.cryptoManager.keypair;
|
|
2308
|
-
if (!keypair || !keypair.pub || !keypair.epub) {
|
|
2309
|
-
throw new Error('No complete keypair available (need both pub and epub)');
|
|
2310
|
-
}
|
|
2311
|
-
|
|
2312
|
-
this.debug.log(`🔐 Initiating key exchange with ${peerId.substring(0, 8)}...`);
|
|
2313
|
-
|
|
2314
|
-
// Mark this peer as having an ongoing key exchange
|
|
2315
|
-
this.ongoingKeyExchanges.add(peerId);
|
|
2316
|
-
|
|
2317
|
-
try {
|
|
2318
|
-
// Send both our public key (pub) and encryption public key (epub) to the peer
|
|
2319
|
-
const result = await this.gossipManager.sendDirectMessage(peerId, {
|
|
2320
|
-
type: 'key_exchange',
|
|
2321
|
-
publicKey: {
|
|
2322
|
-
pub: keypair.pub,
|
|
2323
|
-
epub: keypair.epub
|
|
2324
|
-
},
|
|
2325
|
-
timestamp: Date.now()
|
|
2326
|
-
}, 'key_exchange');
|
|
2327
|
-
|
|
2328
|
-
// Clear the ongoing exchange after a short delay (allow time for response)
|
|
2329
|
-
setTimeout(() => {
|
|
2330
|
-
this.ongoingKeyExchanges.delete(peerId);
|
|
2331
|
-
}, 5000); // 5 second timeout
|
|
2332
|
-
|
|
2333
|
-
return result;
|
|
2334
|
-
} catch (error) {
|
|
2335
|
-
// Clear the ongoing exchange on error
|
|
2336
|
-
this.ongoingKeyExchanges.delete(peerId);
|
|
2337
|
-
throw error;
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
|
|
2341
|
-
/**
|
|
2342
|
-
* Add a peer's public key
|
|
2343
|
-
* @param {string} peerId - Peer ID
|
|
2344
|
-
* @param {string} publicKey - Peer's public key
|
|
2345
|
-
* @returns {boolean} True if key was added successfully
|
|
2346
|
-
*/
|
|
2347
|
-
addPeerPublicKey(peerId, publicKey) {
|
|
2348
|
-
if (!this.enableCrypto || !this.cryptoManager) {
|
|
2349
|
-
return false;
|
|
2350
|
-
}
|
|
2351
|
-
|
|
2352
|
-
return this.cryptoManager.addPeerKey(peerId, publicKey);
|
|
2353
|
-
}
|
|
2354
|
-
|
|
2355
|
-
/**
|
|
2356
|
-
* Generate a group key for encrypted group communications
|
|
2357
|
-
* @param {string} groupId - Group identifier
|
|
2358
|
-
* @returns {Promise<Object>} Generated group key
|
|
2359
|
-
*/
|
|
2360
|
-
async generateGroupKey(groupId) {
|
|
2361
|
-
if (!this.enableCrypto || !this.cryptoManager) {
|
|
2362
|
-
throw new Error('Crypto not enabled or initialized');
|
|
2363
|
-
}
|
|
2364
|
-
|
|
2365
|
-
return await this.cryptoManager.generateGroupKey(groupId);
|
|
2366
|
-
}
|
|
2367
|
-
|
|
2368
|
-
/**
|
|
2369
|
-
* Add a group key for encrypted group communications
|
|
2370
|
-
* @param {string} groupId - Group identifier
|
|
2371
|
-
* @param {Object} groupKey - Group key object
|
|
2372
|
-
*/
|
|
2373
|
-
addGroupKey(groupId, groupKey) {
|
|
2374
|
-
if (!this.enableCrypto || !this.cryptoManager) {
|
|
2375
|
-
throw new Error('Crypto not enabled or initialized');
|
|
2376
|
-
}
|
|
2377
|
-
|
|
2378
|
-
this.cryptoManager.addGroupKey(groupId, groupKey);
|
|
2379
|
-
}
|
|
2380
|
-
|
|
2381
|
-
/**
|
|
2382
|
-
* Sign data with our private key
|
|
2383
|
-
* @param {any} data - Data to sign
|
|
2384
|
-
* @returns {Promise<string>} Digital signature
|
|
2385
|
-
*/
|
|
2386
|
-
async signData(data) {
|
|
2387
|
-
if (!this.enableCrypto || !this.cryptoManager) {
|
|
2388
|
-
throw new Error('Crypto not enabled or initialized');
|
|
2389
|
-
}
|
|
2390
|
-
|
|
2391
|
-
return await this.cryptoManager.sign(data);
|
|
2392
|
-
}
|
|
2393
|
-
|
|
2394
|
-
/**
|
|
2395
|
-
* Verify a signature
|
|
2396
|
-
* @param {string} signature - Signature to verify
|
|
2397
|
-
* @param {any} data - Original data
|
|
2398
|
-
* @param {string} publicKey - Signer's public key
|
|
2399
|
-
* @returns {Promise<boolean>} True if signature is valid
|
|
2400
|
-
*/
|
|
2401
|
-
async verifySignature(signature, data, publicKey) {
|
|
2402
|
-
if (!this.enableCrypto || !this.cryptoManager) {
|
|
2403
|
-
return true; // If crypto disabled, assume valid
|
|
2404
|
-
}
|
|
2405
|
-
|
|
2406
|
-
return await this.cryptoManager.verify(signature, data, publicKey);
|
|
2407
|
-
}
|
|
2408
|
-
|
|
2409
|
-
/**
|
|
2410
|
-
* Export our public key for sharing
|
|
2411
|
-
* @returns {Object|null} Public key export data
|
|
2412
|
-
*/
|
|
2413
|
-
exportPublicKey() {
|
|
2414
|
-
if (!this.enableCrypto || !this.cryptoManager) {
|
|
2415
|
-
return null;
|
|
2416
|
-
}
|
|
2417
|
-
|
|
2418
|
-
return this.cryptoManager.exportPublicKey();
|
|
2419
|
-
}
|
|
2420
|
-
|
|
2421
|
-
/**
|
|
2422
|
-
* Run crypto self-tests
|
|
2423
|
-
* @returns {Promise<Object>} Test results
|
|
2424
|
-
*/
|
|
2425
|
-
async runCryptoTests() {
|
|
2426
|
-
if (!this.enableCrypto || !this.cryptoManager) {
|
|
2427
|
-
throw new Error('Crypto not enabled or initialized');
|
|
2428
|
-
}
|
|
2429
|
-
|
|
2430
|
-
return await this.cryptoManager.runSelfTest();
|
|
2431
|
-
}
|
|
2432
|
-
|
|
2433
|
-
/**
|
|
2434
|
-
* Reset crypto state and clear all keys
|
|
2435
|
-
*/
|
|
2436
|
-
resetCrypto() {
|
|
2437
|
-
if (this.cryptoManager) {
|
|
2438
|
-
this.cryptoManager.reset();
|
|
2439
|
-
}
|
|
2440
|
-
// Clear ongoing key exchange tracking
|
|
2441
|
-
this.ongoingKeyExchanges.clear();
|
|
2442
|
-
// Clear emitted key event tracking
|
|
2443
|
-
this.emittedPeerKeyEvents.clear();
|
|
2444
|
-
}
|
|
2445
|
-
|
|
2446
|
-
/**
|
|
2447
|
-
* Handle incoming key exchange messages
|
|
2448
|
-
* @param {Object} data - Key exchange message data
|
|
2449
|
-
* @param {string} from - Sender's peer ID
|
|
2450
|
-
* @private
|
|
2451
|
-
*/
|
|
2452
|
-
async _handleKeyExchange(data, from) {
|
|
2453
|
-
if ((data.type === 'key_exchange' || data.type === 'key_exchange_response') && data.publicKey && this.cryptoManager) {
|
|
2454
|
-
// Try to add the peer key - will return false if it's a duplicate
|
|
2455
|
-
const keyAdded = this.cryptoManager.addPeerKey(from, data.publicKey);
|
|
2456
|
-
|
|
2457
|
-
if (keyAdded) {
|
|
2458
|
-
this.debug.log(`🔐 Stored public key for peer ${from.substring(0, 8)}...`);
|
|
2459
|
-
// Clear any ongoing key exchange tracking for this peer since we now have their key
|
|
2460
|
-
this.ongoingKeyExchanges.delete(from);
|
|
2461
|
-
} else {
|
|
2462
|
-
this.debug.log(`🔐 Key exchange ignored for peer ${from.substring(0, 8)}... - duplicate key`);
|
|
2463
|
-
}
|
|
2464
|
-
|
|
2465
|
-
// Send our public key back if this was an initial exchange (not a response) and the key was actually new
|
|
2466
|
-
if (data.type === 'key_exchange' && keyAdded) {
|
|
2467
|
-
const keypair = this.cryptoManager.keypair;
|
|
2468
|
-
if (keypair && keypair.pub && keypair.epub) {
|
|
2469
|
-
await this.gossipManager.sendDirectMessage(from, {
|
|
2470
|
-
type: 'key_exchange_response',
|
|
2471
|
-
publicKey: {
|
|
2472
|
-
pub: keypair.pub,
|
|
2473
|
-
epub: keypair.epub
|
|
2474
|
-
},
|
|
2475
|
-
timestamp: Date.now()
|
|
2476
|
-
}, 'key_exchange_response');
|
|
2477
|
-
}
|
|
2478
|
-
}
|
|
2479
|
-
}
|
|
2480
|
-
}
|
|
2481
|
-
|
|
2482
|
-
/**
|
|
2483
|
-
* Handle remote stream announcements from gossip protocol
|
|
2484
|
-
* The actual stream forwarding is handled by ConnectionManager
|
|
2485
|
-
* @param {Object} data - Stream announcement data
|
|
2486
|
-
* @private
|
|
2487
|
-
*/
|
|
2488
|
-
async _handleRemoteStreamAnnouncement(data) {
|
|
2489
|
-
const { peerId, event } = data;
|
|
2490
|
-
|
|
2491
|
-
// Don't process our own announcements
|
|
2492
|
-
if (peerId === this.peerId) {
|
|
2493
|
-
return;
|
|
2494
|
-
}
|
|
2495
|
-
|
|
2496
|
-
this.debug.log(`🎵 GOSSIP STREAM: Received stream announcement - ${event} from ${peerId.substring(0, 8)}...`);
|
|
2497
|
-
|
|
2498
|
-
// Stream forwarding is now handled automatically by ConnectionManager
|
|
2499
|
-
// when remoteStream events are received, so we just emit for UI handling
|
|
2500
|
-
this.emit('remoteStreamAnnouncementReceived', data);
|
|
2501
|
-
}
|
|
2502
|
-
}
|