-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
36 lines (33 loc) · 943 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
'use strict'
const Legacy = require('./legacy')
const Notify = require('pull-notify')
module.exports = {
name: 'replicate',
version: '2.0.0',
manifest: require('./manifest.json'),
init (ssbServer, config) {
const notify = Notify()
if (!config.replicate || config.replicate.legacy !== false) {
const replicate = Legacy.call(this, ssbServer, notify, config)
// replication policy is set by calling
// ssbServer.replicate.request(id)
// or by cancelling replication
// ssbServer.replicate.request(id, false)
// this is currently performed from the ssb-friends plugin
return replicate
} else {
return {
request () {},
block (from, to, blocking) {},
changes () {
return function (abort, cb) {
cb(true) // eslint-disable-line
}
},
help () {
return require('./help')
}
}
}
}
}