|
|
@ -19,15 +19,15 @@ const UNAUTHENTICATED_CALLS = {
|
|
|
|
GET_DELETED_PADS: Pinning.getDeletedPads,
|
|
|
|
GET_DELETED_PADS: Pinning.getDeletedPads,
|
|
|
|
IS_CHANNEL_PINNED: Pinning.isChannelPinned,
|
|
|
|
IS_CHANNEL_PINNED: Pinning.isChannelPinned,
|
|
|
|
IS_NEW_CHANNEL: Channel.isNewChannel,
|
|
|
|
IS_NEW_CHANNEL: Channel.isNewChannel,
|
|
|
|
WRITE_PRIVATE_MESSAGE: Channel.writePrivateMessage, // XXX RESTRICT
|
|
|
|
WRITE_PRIVATE_MESSAGE: Channel.writePrivateMessage,
|
|
|
|
GET_METADATA: Metadata.getMetadata, // XXX RESTRICT
|
|
|
|
GET_METADATA: Metadata.getMetadata,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var isUnauthenticateMessage = function (msg) {
|
|
|
|
var isUnauthenticateMessage = function (msg) {
|
|
|
|
return msg && msg.length === 2 && typeof(UNAUTHENTICATED_CALLS[msg[0]]) === 'function';
|
|
|
|
return msg && msg.length === 2 && typeof(UNAUTHENTICATED_CALLS[msg[0]]) === 'function';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var handleUnauthenticatedMessage = function (Env, msg, respond, Server) {
|
|
|
|
var handleUnauthenticatedMessage = function (Env, msg, respond, Server, netfluxId) {
|
|
|
|
Env.Log.silly('LOG_RPC', msg[0]);
|
|
|
|
Env.Log.silly('LOG_RPC', msg[0]);
|
|
|
|
|
|
|
|
|
|
|
|
var method = UNAUTHENTICATED_CALLS[msg[0]];
|
|
|
|
var method = UNAUTHENTICATED_CALLS[msg[0]];
|
|
|
@ -37,7 +37,7 @@ var handleUnauthenticatedMessage = function (Env, msg, respond, Server) {
|
|
|
|
return void respond(err);
|
|
|
|
return void respond(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
respond(err, [null, value, null]);
|
|
|
|
respond(err, [null, value, null]);
|
|
|
|
}, Server);
|
|
|
|
}, Server, netfluxId);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const AUTHENTICATED_USER_TARGETED = {
|
|
|
|
const AUTHENTICATED_USER_TARGETED = {
|
|
|
@ -137,7 +137,7 @@ var rpc = function (Env, Server, userId, data, respond) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isUnauthenticateMessage(msg)) {
|
|
|
|
if (isUnauthenticateMessage(msg)) {
|
|
|
|
return handleUnauthenticatedMessage(Env, msg, respond, Server);
|
|
|
|
return handleUnauthenticatedMessage(Env, msg, respond, Server, userId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var signature = msg.shift();
|
|
|
|
var signature = msg.shift();
|
|
|
|