Introduce an ID reservation list.

pull/5/head
Péter Szilágyi 7 years ago committed by Ikmyeong Na
parent 611d68fde2
commit f8c226c0f3
No known key found for this signature in database
GPG Key ID: EC674310ADADE2CA
  1. 5
      app.js
  2. 7
      lib/utils/config.js

@ -29,7 +29,8 @@ else
}
}
var banned = require('./lib/utils/config').banned;
var banned = require('./lib/utils/config').banned;
var reserved = require('./lib/utils/config').reserved;
// Init http server
if( process.env.NODE_ENV !== 'production' )
@ -106,7 +107,7 @@ api.on('connection', function (spark)
{
console.info('API', 'CON', 'Hello', data['id']);
if( _.isUndefined(data.secret) || WS_SECRET.indexOf(data.secret) === -1 || banned.indexOf(spark.address.ip) >= 0 )
if( _.isUndefined(data.secret) || WS_SECRET.indexOf(data.secret) === -1 || banned.indexOf(spark.address.ip) >= 0 || _.isUndefined(data.id) || reserved.indexOf(data.id) >= 0 )
{
spark.end(undefined, { reconnect: false });
console.error('API', 'CON', 'Closed - wrong auth', data);

@ -26,6 +26,7 @@ var banned = [
];
module.exports = {
trusted: trusted,
banned: banned
};
trusted: trusted,
banned: banned,
reserved: []
};

Loading…
Cancel
Save