trac-peer 0.1.65 → 0.1.66

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +15 -9
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "trac-peer",
3
3
  "main": "src/index.js",
4
- "version": "0.1.65",
4
+ "version": "0.1.66",
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "assert": "npm:bare-node-assert",
package/src/index.js CHANGED
@@ -718,20 +718,26 @@ export class Peer extends ReadyResource {
718
718
  try{
719
719
  if(true === _this.base.writable && msg.inviteMyKey !== undefined &&
720
720
  msg.bootstrap === _this.bootstrap && b4a.toString(connection.publicKey, 'hex') === msg.to){
721
- await _this.base.append({
722
- type : 'autoAddWriter',
723
- key : msg.inviteMyKey
724
- });
721
+ const auto_add_writers = await _this.base.view.get('auto_add_writers');
722
+ if(auto_add_writers !== null && auto_add_writers.value === 'on') {
723
+ await _this.base.append({
724
+ type : 'autoAddWriter',
725
+ key : msg.inviteMyKey
726
+ });
727
+ }
725
728
  }
726
729
  }catch(e){}
727
730
  }});
728
731
 
729
732
  if(false === _this.base.writable){
730
- message.send({
731
- inviteMyKey : _this.writerLocalKey,
732
- bootstrap : _this.bootstrap,
733
- to : b4a.toString(connection.remotePublicKey, 'hex')
734
- });
733
+ const auto_add_writers = await _this.base.view.get('auto_add_writers');
734
+ if(auto_add_writers !== null && auto_add_writers.value === 'on') {
735
+ message.send({
736
+ inviteMyKey : _this.writerLocalKey,
737
+ bootstrap : _this.bootstrap,
738
+ to : b4a.toString(connection.remotePublicKey, 'hex')
739
+ });
740
+ }
735
741
  }
736
742
 
737
743
  const remotePublicKey = b4a.toString(connection.remotePublicKey, 'hex');