http: allow admin status for noAuth.

This commit is contained in:
Christopher Jeffrey 2016-10-05 05:59:56 -07:00
parent 383c8f085f
commit 745c12ef3a
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -164,8 +164,10 @@ HTTPServer.prototype._init = function _init() {
this.use(function(req, res, send, next) {
var hash;
if (!this.apiHash)
if (!this.apiHash) {
req.admin = true;
return next();
}
hash = hash256(req.password);
@ -1105,6 +1107,8 @@ HTTPServer.prototype._initIO = function _initIO() {
if (!crypto.ccmp(hash, self.apiHash))
return callback({ error: 'Bad key.' });
}
} else {
socket.admin = true;
}
socket.auth = true;