Merge branch 'develop' into release/1.2.12
This commit is contained in:
commit
614ca6bd90
|
@ -77,28 +77,22 @@ exports.getPadId = function(readOnlyId, callback)
|
||||||
* returns a the padId and readonlyPadId in an object for any id
|
* returns a the padId and readonlyPadId in an object for any id
|
||||||
* @param {String} padIdOrReadonlyPadId read only id or real pad id
|
* @param {String} padIdOrReadonlyPadId read only id or real pad id
|
||||||
*/
|
*/
|
||||||
exports.getIds = function(padIdOrReadonlyPadId, callback) {
|
exports.getIds = function(id, callback) {
|
||||||
var handleRealPadId = function () {
|
if (id.indexOf("r.") == 0)
|
||||||
exports.getReadOnlyId(padIdOrReadonlyPadId, function (err, value) {
|
exports.getPadId(id, function (err, value) {
|
||||||
|
if(ERR(err, callback)) return;
|
||||||
|
callback(null, {
|
||||||
|
readOnlyPadId: id,
|
||||||
|
padId: value, // Might be null, if this is an unknown read-only id
|
||||||
|
readonly: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
else
|
||||||
|
exports.getReadOnlyId(id, function (err, value) {
|
||||||
callback(null, {
|
callback(null, {
|
||||||
readOnlyPadId: value,
|
readOnlyPadId: value,
|
||||||
padId: padIdOrReadonlyPadId,
|
padId: id,
|
||||||
readonly: false
|
readonly: false
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
if (padIdOrReadonlyPadId.indexOf("r.") != 0)
|
|
||||||
return handleRealPadId();
|
|
||||||
|
|
||||||
exports.getPadId(padIdOrReadonlyPadId, function (err, value) {
|
|
||||||
if(ERR(err, callback)) return;
|
|
||||||
if (value == null)
|
|
||||||
return handleRealPadId();
|
|
||||||
callback(null, {
|
|
||||||
readOnlyPadId: padIdOrReadonlyPadId,
|
|
||||||
padId: value,
|
|
||||||
readonly: true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,11 @@ var authLogger = log4js.getLogger("auth");
|
||||||
exports.checkAccess = function (padID, sessionCookie, token, password, callback)
|
exports.checkAccess = function (padID, sessionCookie, token, password, callback)
|
||||||
{
|
{
|
||||||
var statusObject;
|
var statusObject;
|
||||||
|
|
||||||
|
if(!padID) {
|
||||||
|
callback(null, {accessStatus: "deny"});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// a valid session is required (api-only mode)
|
// a valid session is required (api-only mode)
|
||||||
if(settings.requireSession)
|
if(settings.requireSession)
|
||||||
|
|
|
@ -144,15 +144,16 @@ exports.handleDisconnect = function(client)
|
||||||
*/
|
*/
|
||||||
exports.handleMessage = function(client, message)
|
exports.handleMessage = function(client, message)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(message == null)
|
if(message == null)
|
||||||
{
|
{
|
||||||
messageLogger.warn("Message is null!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!message.type)
|
if(!message.type)
|
||||||
{
|
{
|
||||||
messageLogger.warn("Message has no type attribute!");
|
return;
|
||||||
|
}
|
||||||
|
if(!sessioninfos[client.id]) {
|
||||||
|
messageLogger.warn("Dropped message from an unknown connection.")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue