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
|
||||
* @param {String} padIdOrReadonlyPadId read only id or real pad id
|
||||
*/
|
||||
exports.getIds = function(padIdOrReadonlyPadId, callback) {
|
||||
var handleRealPadId = function () {
|
||||
exports.getReadOnlyId(padIdOrReadonlyPadId, function (err, value) {
|
||||
exports.getIds = function(id, callback) {
|
||||
if (id.indexOf("r.") == 0)
|
||||
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, {
|
||||
readOnlyPadId: value,
|
||||
padId: padIdOrReadonlyPadId,
|
||||
padId: id,
|
||||
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)
|
||||
{
|
||||
var statusObject;
|
||||
|
||||
if(!padID) {
|
||||
callback(null, {accessStatus: "deny"});
|
||||
return;
|
||||
}
|
||||
|
||||
// a valid session is required (api-only mode)
|
||||
if(settings.requireSession)
|
||||
|
|
|
@ -144,15 +144,16 @@ exports.handleDisconnect = function(client)
|
|||
*/
|
||||
exports.handleMessage = function(client, message)
|
||||
{
|
||||
|
||||
if(message == null)
|
||||
{
|
||||
messageLogger.warn("Message is null!");
|
||||
return;
|
||||
}
|
||||
if(!message.type)
|
||||
{
|
||||
messageLogger.warn("Message has no type attribute!");
|
||||
return;
|
||||
}
|
||||
if(!sessioninfos[client.id]) {
|
||||
messageLogger.warn("Dropped message from an unknown connection.")
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue