trac-peer 0.0.22 → 0.0.23
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/package.json +1 -1
- package/src/index.js +6 -6
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -103,41 +103,41 @@ export class Peer extends ReadyResource {
|
|
|
103
103
|
if(null !== admin &&
|
|
104
104
|
op.value.msg.key === op.key &&
|
|
105
105
|
op.value.msg.type === 'addIndexer' &&
|
|
106
|
-
null === await view.get('sh/'+op.
|
|
106
|
+
null === await view.get('sh/'+op.value.hash)) {
|
|
107
107
|
const verified = _this.wallet.verify(op.value.hash, JSON.stringify(op.value.msg), admin.value);
|
|
108
108
|
if(verified){
|
|
109
109
|
const writerKey = b4a.from(op.key, 'hex');
|
|
110
110
|
await base.addWriter(writerKey);
|
|
111
111
|
console.log(`Indexer added: ${op.key}`);
|
|
112
112
|
}
|
|
113
|
-
await view.put('sh/'+op.
|
|
113
|
+
await view.put('sh/'+op.value.hash, '');
|
|
114
114
|
}
|
|
115
115
|
} else if (op.type === 'addWriter') {
|
|
116
116
|
const admin = await view.get('admin');
|
|
117
117
|
if(null !== admin &&
|
|
118
118
|
op.value.msg.key === op.key &&
|
|
119
119
|
op.value.msg.type === 'addWriter' &&
|
|
120
|
-
null === await view.get('sh/'+op.
|
|
120
|
+
null === await view.get('sh/'+op.value.hash)) {
|
|
121
121
|
const verified = _this.wallet.verify(op.value.hash, JSON.stringify(op.value.msg), admin.value);
|
|
122
122
|
if(verified){
|
|
123
123
|
const writerKey = b4a.from(op.key, 'hex');
|
|
124
124
|
await base.addWriter(writerKey, { isIndexer : false });
|
|
125
125
|
console.log(`Writer added: ${op.key}`);
|
|
126
126
|
}
|
|
127
|
-
await view.put('sh/'+op.
|
|
127
|
+
await view.put('sh/'+op.value.hash, '');
|
|
128
128
|
}
|
|
129
129
|
} else if (op.type === 'setAutoAddWriters') {
|
|
130
130
|
const admin = await view.get('admin');
|
|
131
131
|
if(null !== admin && op.value.msg.key === op.key &&
|
|
132
132
|
op.value.msg.type === 'setAutoAddWriters' &&
|
|
133
133
|
(op.key === 'on' || op.key === 'off') &&
|
|
134
|
-
null === await view.get('sh/'+op.
|
|
134
|
+
null === await view.get('sh/'+op.value.hash)) {
|
|
135
135
|
const verified = _this.wallet.verify(op.value.hash, JSON.stringify(op.value.msg), admin.value);
|
|
136
136
|
if(verified){
|
|
137
137
|
await view.put('auto_add_writers', op.key);
|
|
138
138
|
console.log(`Set auto_add_writers: ${op.key}`);
|
|
139
139
|
}
|
|
140
|
-
await view.put('sh/'+op.
|
|
140
|
+
await view.put('sh/'+op.value.hash, '');
|
|
141
141
|
}
|
|
142
142
|
} else if (op.type === 'autoAddWriter') {
|
|
143
143
|
const auto_add_writers = await view.get('auto_add_writers');
|