Introduce an ID reservation list.
This commit is contained in:
parent
82e2fa36e1
commit
4e9492fc83
3
app.js
3
app.js
@ -30,6 +30,7 @@ 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
|
// Init http server
|
||||||
if( process.env.NODE_ENV !== 'production' )
|
if( process.env.NODE_ENV !== 'production' )
|
||||||
@ -106,7 +107,7 @@ api.on('connection', function (spark)
|
|||||||
{
|
{
|
||||||
console.info('API', 'CON', 'Hello', data['id']);
|
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 });
|
spark.end(undefined, { reconnect: false });
|
||||||
console.error('API', 'CON', 'Closed - wrong auth', data);
|
console.error('API', 'CON', 'Closed - wrong auth', data);
|
||||||
|
@ -27,5 +27,6 @@ var banned = [
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
trusted: trusted,
|
trusted: trusted,
|
||||||
banned: banned
|
banned: banned,
|
||||||
|
reserved: []
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user