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 {{ db: PPPPPDB | null; set: PPPPPSet | null }} peer
|
||||||
* @param {Config} config
|
* @param {Config} config
|
||||||
*/
|
*/
|
||||||
init(peer, config) {
|
function initPromise(peer, config) {
|
||||||
assertDBPlugin(peer)
|
assertDBPlugin(peer)
|
||||||
assertValidConfig(config)
|
assertValidConfig(config)
|
||||||
const devicePromisesFile = Path.join(config.global.path, 'promises.json')
|
const devicePromisesFile = Path.join(config.global.path, 'promises.json')
|
||||||
|
@ -85,7 +69,6 @@ module.exports = {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err.code === 'ENOENT') {
|
if (err.code === 'ENOENT') {
|
||||||
save((err, _) => {
|
save((err, _) => {
|
||||||
// prettier-ignore
|
|
||||||
if (err) return console.log('Problem creating promises file:', err)
|
if (err) return console.log('Problem creating promises file:', err)
|
||||||
else loaded = true
|
else loaded = true
|
||||||
})
|
})
|
||||||
|
@ -121,7 +104,6 @@ module.exports = {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
// prettier-ignore
|
|
||||||
return Error('Invalid promise type: ' + JSON.stringify(promise))
|
return Error('Invalid promise type: ' + JSON.stringify(promise))
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
|
@ -313,5 +295,20 @@ module.exports = {
|
||||||
}
|
}
|
||||||
|
|
||||||
return { create, revoke, follow, accountAdd }
|
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