mirror of https://codeberg.org/pzp/pzp-promise.git
change secret-stack plugin structure
This commit is contained in:
parent
6b96852808
commit
41e1f9502f
35
lib/index.js
35
lib/index.js
|
@ -50,27 +50,11 @@ function assertValidConfig(config) {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: 'promise',
|
||||
manifest: {
|
||||
// management
|
||||
create: 'async',
|
||||
revoke: 'async',
|
||||
// promises
|
||||
follow: 'async',
|
||||
accountAdd: 'async',
|
||||
},
|
||||
permissions: {
|
||||
anonymous: {
|
||||
allow: ['follow', 'accountAdd'],
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {{ db: PPPPPDB | null; set: PPPPPSet | null }} peer
|
||||
* @param {Config} config
|
||||
*/
|
||||
init(peer, config) {
|
||||
function initPromise(peer, config) {
|
||||
assertDBPlugin(peer)
|
||||
assertValidConfig(config)
|
||||
const devicePromisesFile = Path.join(config.global.path, 'promises.json')
|
||||
|
@ -85,7 +69,6 @@ module.exports = {
|
|||
if (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
save((err, _) => {
|
||||
// prettier-ignore
|
||||
if (err) return console.log('Problem creating promises file:', err)
|
||||
else loaded = true
|
||||
})
|
||||
|
@ -121,7 +104,6 @@ module.exports = {
|
|||
break
|
||||
}
|
||||
default:
|
||||
// prettier-ignore
|
||||
return Error('Invalid promise type: ' + JSON.stringify(promise))
|
||||
}
|
||||
return null
|
||||
|
@ -313,5 +295,20 @@ module.exports = {
|
|||
}
|
||||
|
||||
return { create, revoke, follow, accountAdd }
|
||||
}
|
||||
|
||||
exports.name = 'promise'
|
||||
exports.manifest = {
|
||||
// management
|
||||
create: 'async',
|
||||
revoke: 'async',
|
||||
// promises
|
||||
follow: 'async',
|
||||
accountAdd: 'async',
|
||||
}
|
||||
exports.init = initPromise
|
||||
exports.permissions = {
|
||||
anonymous: {
|
||||
allow: ['follow', 'accountAdd'],
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue