Anonymous RPC GET_FILE_SIZE does not work correctly unless at least one authenticated RPC has been called first. Also RPC failures (throw error) are silent in the logs
This commit is contained in:
23
rpc.js
23
rpc.js
@@ -1057,11 +1057,9 @@ RPC.create = function (config /*:typeof(ConfigType)*/, cb /*:(?Error, ?Function)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var rpc = function (
|
var rpc0 = function (ctx, data, respond) {
|
||||||
ctx /*:{ store: Object }*/,
|
if (!Env.msgStore) { Env.msgStore = ctx.store; }
|
||||||
data /*:Array<Array<any>>*/,
|
|
||||||
respond /*:(?string, ?Array<any>)=>void*/)
|
|
||||||
{
|
|
||||||
if (!Array.isArray(data)) {
|
if (!Array.isArray(data)) {
|
||||||
return void respond('INVALID_ARG_FORMAT');
|
return void respond('INVALID_ARG_FORMAT');
|
||||||
}
|
}
|
||||||
@@ -1140,8 +1138,6 @@ RPC.create = function (config /*:typeof(ConfigType)*/, cb /*:(?Error, ?Function)
|
|||||||
Respond('E_ACCESS_DENIED');
|
Respond('E_ACCESS_DENIED');
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!Env.msgStore) { Env.msgStore = ctx.store; }
|
|
||||||
|
|
||||||
var handleMessage = function (privileged) {
|
var handleMessage = function (privileged) {
|
||||||
if (config.logRPC) { console.log(msg[0]); }
|
if (config.logRPC) { console.log(msg[0]); }
|
||||||
switch (msg[0]) {
|
switch (msg[0]) {
|
||||||
@@ -1272,6 +1268,19 @@ RPC.create = function (config /*:typeof(ConfigType)*/, cb /*:(?Error, ?Function)
|
|||||||
handleMessage(session.privilege);
|
handleMessage(session.privilege);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var rpc = function (
|
||||||
|
ctx /*:{ store: Object }*/,
|
||||||
|
data /*:Array<Array<any>>*/,
|
||||||
|
respond /*:(?string, ?Array<any>)=>void*/)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return rpc0(ctx, data, respond);
|
||||||
|
} catch (e) {
|
||||||
|
console.log("Error from RPC with data " + JSON.stringify(data));
|
||||||
|
console.log(e.stack);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var updateLimitDaily = function () {
|
var updateLimitDaily = function () {
|
||||||
updateLimits(config, undefined, function (e) {
|
updateLimits(config, undefined, function (e) {
|
||||||
if (e) {
|
if (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user