|
|
|
@ -26,6 +26,7 @@ DISABLE_INTEGRATED_EVICTION
|
|
|
|
|
|
|
|
|
|
// BROADCAST
|
|
|
|
|
SET_LAST_BROADCAST_HASH
|
|
|
|
|
SET_SURVEY_URL
|
|
|
|
|
|
|
|
|
|
NOT IMPLEMENTED:
|
|
|
|
|
|
|
|
|
@ -124,23 +125,29 @@ commands.SET_ARCHIVE_RETENTION_TIME = makeIntegerSetter('archiveRetentionTime');
|
|
|
|
|
// CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['SET_ACCOUNT_RETENTION_TIME', [365]]], console.log)
|
|
|
|
|
commands.SET_ACCOUNT_RETENTION_TIME = makeIntegerSetter('accountRetentionTime');
|
|
|
|
|
|
|
|
|
|
// CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['SET_LAST_BROADCAST_HASH', [hash]]], console.log)
|
|
|
|
|
commands.SET_LAST_BROADCAST_HASH = function (Env, args) {
|
|
|
|
|
if (!Array.isArray(args) || typeof(args[0]) !== "string") {
|
|
|
|
|
throw new Error('INVALID_ARGS');
|
|
|
|
|
}
|
|
|
|
|
if (args[0] && args[0].length !== 64) {
|
|
|
|
|
var args_isString = function (args) {
|
|
|
|
|
return Array.isArray(args) && typeof(args[0]) === "string";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var makeBroadcastSetter = function (attr) {
|
|
|
|
|
return function (Env, args) {
|
|
|
|
|
if (!args_isString(args)) {
|
|
|
|
|
throw new Error('INVALID_ARGS');
|
|
|
|
|
}
|
|
|
|
|
var hash = args[0];
|
|
|
|
|
if (hash === Env.lastBroadcastHash) { return false; }
|
|
|
|
|
|
|
|
|
|
// Hash is valid and has changed: update it and clear the broadcast cache
|
|
|
|
|
Env.lastBroadcastHash = hash;
|
|
|
|
|
var str = args[0];
|
|
|
|
|
if (str === Env[attr]) { return false; }
|
|
|
|
|
Env[attr] = str;
|
|
|
|
|
Env.broadcastCache = {};
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['SET_LAST_BROADCAST_HASH', [hash]]], console.log)
|
|
|
|
|
commands.SET_LAST_BROADCAST_HASH = makeBroadcastSetter('lastBroadcastHash');
|
|
|
|
|
|
|
|
|
|
// CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['SET_SURVEY_URL', [url]]], console.log)
|
|
|
|
|
commands.SET_SURVEY_URL = makeBroadcastSetter('surveyURL');
|
|
|
|
|
|
|
|
|
|
var Quota = require("./commands/quota");
|
|
|
|
|
var Keys = require("./keys");
|
|
|
|
|
var Util = require("./common-util");
|
|
|
|
|