implement admin GET_USER_TOTAL_SIZE call

pull/1/head
ansuz 4 years ago
parent 92560228f5
commit 4a29d9df00

@ -5,6 +5,7 @@ const getFolderSize = require("get-folder-size");
const Util = require("../common-util"); const Util = require("../common-util");
const Ulimit = require("ulimit"); const Ulimit = require("ulimit");
const Decrees = require("../decrees"); const Decrees = require("../decrees");
const Pinning = require("./pin-rpc");
var Fs = require("fs"); var Fs = require("fs");
@ -324,6 +325,13 @@ var getLimits = function (Env, Server, cb) {
cb(void 0, Env.limits); cb(void 0, Env.limits);
}; };
// CryptPad_AsyncStore.rpc.send('ADMIN', ['GET_USER_TOTAL_SIZE', "CrufexqXcY/z+eKJlEbNELVy5Sb7E/EAAEFI8GnEtZ0="], console.log)
var getUserTotalSize = function (Env, Server, cb, data) {
var signingKey = Array.isArray(data) && data[1];
if (typeof(signingKey) !== 'string' || signingKey.length < 44) { return void cb("EINVAL"); } // FIXME use a standard check for this
Pinning.getTotalSize(Env, signingKey, cb)
};
var commands = { var commands = {
ACTIVE_SESSIONS: getActiveSessions, ACTIVE_SESSIONS: getActiveSessions,
ACTIVE_PADS: getActiveChannelCount, ACTIVE_PADS: getActiveChannelCount,
@ -349,6 +357,7 @@ var commands = {
GET_LIMITS: getLimits, GET_LIMITS: getLimits,
SET_LAST_EVICTION: setLastEviction, SET_LAST_EVICTION: setLastEviction,
GET_WORKER_PROFILES: getWorkerProfiles, GET_WORKER_PROFILES: getWorkerProfiles,
GET_USER_TOTAL_SIZE: getUserTotalSize,
}; };
Admin.command = function (Env, safeKey, data, _cb, Server) { Admin.command = function (Env, safeKey, data, _cb, Server) {

Loading…
Cancel
Save