|
|
@ -175,7 +175,7 @@ var restoreArchivedDocument = function (Env, Server, cb) {
|
|
|
|
cb("NOT_IMPLEMENTED");
|
|
|
|
cb("NOT_IMPLEMENTED");
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// CryptPad_AsyncStore.rpc.send('ADMIN', ['CLEAR_CHANNEL_INDEX', documentID], console.log)
|
|
|
|
// CryptPad_AsyncStore.rpc.send('ADMIN', ['CLEAR_CACHED_CHANNEL_INDEX', documentID], console.log)
|
|
|
|
var clearChannelIndex = function (Env, Server, cb, data) {
|
|
|
|
var clearChannelIndex = function (Env, Server, cb, data) {
|
|
|
|
var id = Array.isArray(data) && data[1];
|
|
|
|
var id = Array.isArray(data) && data[1];
|
|
|
|
if (typeof(id) !== 'string' || id.length < 32) { return void cb("EINVAL"); }
|
|
|
|
if (typeof(id) !== 'string' || id.length < 32) { return void cb("EINVAL"); }
|
|
|
@ -183,7 +183,7 @@ var clearChannelIndex = function (Env, Server, cb, data) {
|
|
|
|
cb();
|
|
|
|
cb();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// CryptPad_AsyncStore.rpc.send('ADMIN', ['GET_CHANNEL_INDEX', documentID], console.log)
|
|
|
|
// CryptPad_AsyncStore.rpc.send('ADMIN', ['GET_CACHED_CHANNEL_INDEX', documentID], console.log)
|
|
|
|
var getChannelIndex = function (Env, Server, cb, data) {
|
|
|
|
var getChannelIndex = function (Env, Server, cb, data) {
|
|
|
|
var id = Array.isArray(data) && data[1];
|
|
|
|
var id = Array.isArray(data) && data[1];
|
|
|
|
if (typeof(id) !== 'string' || id.length < 32) { return void cb("EINVAL"); }
|
|
|
|
if (typeof(id) !== 'string' || id.length < 32) { return void cb("EINVAL"); }
|
|
|
@ -193,6 +193,24 @@ var getChannelIndex = function (Env, Server, cb, data) {
|
|
|
|
cb(void 0, index);
|
|
|
|
cb(void 0, index);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CryptPad_AsyncStore.rpc.send('ADMIN', ['CLEAR_CACHED_CHANNEL_METADATA', documentID], console.log)
|
|
|
|
|
|
|
|
var clearChannelMetadata = function (Env, Server, cb, data) {
|
|
|
|
|
|
|
|
var id = Array.isArray(data) && data[1];
|
|
|
|
|
|
|
|
if (typeof(id) !== 'string' || id.length < 32) { return void cb("EINVAL"); }
|
|
|
|
|
|
|
|
delete Env.metadata_cache[id];
|
|
|
|
|
|
|
|
cb();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CryptPad_AsyncStore.rpc.send('ADMIN', ['GET_CACHED_CHANNEL_METADATA', documentID], console.log)
|
|
|
|
|
|
|
|
var getChannelMetadata = function (Env, Server, cb, data) {
|
|
|
|
|
|
|
|
var id = Array.isArray(data) && data[1];
|
|
|
|
|
|
|
|
if (typeof(id) !== 'string' || id.length < 32) { return void cb("EINVAL"); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var index = Util.find(Env, ['metadata_cache', id]);
|
|
|
|
|
|
|
|
if (!index) { return void cb("ENOENT"); }
|
|
|
|
|
|
|
|
cb(void 0, index);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['RESTRICT_REGISTRATION', [true]]], console.log)
|
|
|
|
// CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['RESTRICT_REGISTRATION', [true]]], console.log)
|
|
|
|
var adminDecree = function (Env, Server, cb, data, unsafeKey) {
|
|
|
|
var adminDecree = function (Env, Server, cb, data, unsafeKey) {
|
|
|
|
var value = data[1];
|
|
|
|
var value = data[1];
|
|
|
@ -287,8 +305,11 @@ var commands = {
|
|
|
|
ARCHIVE_DOCUMENT: archiveDocument,
|
|
|
|
ARCHIVE_DOCUMENT: archiveDocument,
|
|
|
|
RESTORE_ARCHIVED_DOCUMENT: restoreArchivedDocument,
|
|
|
|
RESTORE_ARCHIVED_DOCUMENT: restoreArchivedDocument,
|
|
|
|
|
|
|
|
|
|
|
|
CLEAR_CHANNEL_INDEX: clearChannelIndex,
|
|
|
|
CLEAR_CACHED_CHANNEL_INDEX: clearChannelIndex,
|
|
|
|
GET_CHANNEL_INDEX: getChannelIndex,
|
|
|
|
GET_CACHED_CHANNEL_INDEX: getChannelIndex,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CLEAR_CACHED_CHANNEL_METADATA: clearChannelMetadata,
|
|
|
|
|
|
|
|
GET_CACHED_CHANNEL_METADATA: getChannelMetadata,
|
|
|
|
|
|
|
|
|
|
|
|
ADMIN_DECREE: adminDecree,
|
|
|
|
ADMIN_DECREE: adminDecree,
|
|
|
|
INSTANCE_STATUS: instanceStatus,
|
|
|
|
INSTANCE_STATUS: instanceStatus,
|
|
|
|