ssb: Add some plausible API and a table for storing instance-wide blocks.
This commit is contained in:
36
core/core.js
36
core/core.js
@@ -494,18 +494,34 @@ async function getProcessBlob(blobId, key, options) {
|
||||
);
|
||||
}
|
||||
};
|
||||
imports.ssb.swapWithServerIdentity = function (id) {
|
||||
if (
|
||||
process.credentials &&
|
||||
process.credentials.session &&
|
||||
process.credentials.session.name
|
||||
) {
|
||||
return ssb.swapWithServerIdentity(
|
||||
process.credentials.session.name,
|
||||
id
|
||||
if (process.credentials?.permissions?.administration) {
|
||||
imports.ssb.swapWithServerIdentity = function (id) {
|
||||
if (
|
||||
process.credentials &&
|
||||
process.credentials.session &&
|
||||
process.credentials.session.name
|
||||
) {
|
||||
return ssb.swapWithServerIdentity(
|
||||
process.credentials.session.name,
|
||||
id
|
||||
);
|
||||
}
|
||||
};
|
||||
imports.ssb.addBlock = async function (id) {
|
||||
await imports.core.permissionTest(
|
||||
'modify_blocks',
|
||||
`Block ${id}.`
|
||||
);
|
||||
await ssb_internal.addBlock(id);
|
||||
}
|
||||
};
|
||||
imports.ssb.removeBlock = async function (id) {
|
||||
await imports.core.permissionTest(
|
||||
'modify_blocks',
|
||||
`Unblock ${id}.`
|
||||
);
|
||||
await ssb_internal.removeBlock(id);
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
process.credentials &&
|
||||
|
||||
Reference in New Issue
Block a user