continue refactoring rpc

This commit is contained in:
ansuz
2020-02-05 17:31:44 -05:00
parent d17e180420
commit bde17a62a1
7 changed files with 86 additions and 170 deletions

View File

@@ -2,6 +2,8 @@
const BatchRead = require("../batch-read");
const nThen = require("nthen");
const getFolderSize = require("get-folder-size");
const Util = require("../common-util");
var Fs = require("fs");
var Admin = module.exports;
@@ -90,9 +92,10 @@ var getDiskUsage = function (Env, cb) {
});
};
Admin.command = function (Env, Server, publicKey, data, cb) {
Admin.command = function (Env, safeKey, data, cb, Server) {
var admins = Env.admins;
if (admins.indexOf(publicKey) === -1) {
var unsafeKey = Util.unescapeKeyCharacters(safeKey);
if (admins.indexOf(unsafeKey) === -1) {
return void cb("FORBIDDEN");
}