внешняя конфигурация
This commit is contained in:
20
index.js
20
index.js
@ -1,7 +1,4 @@
|
||||
const config = require('./config');
|
||||
let settings = {
|
||||
dhtDisabled: false
|
||||
}
|
||||
const client = new (require('./bt/client'))
|
||||
const spider = new (require('./bt/spider'))(client)
|
||||
const mysql = require('mysql');
|
||||
@ -401,7 +398,9 @@ io.on('connection', function(socket)
|
||||
if(typeof callback != 'function')
|
||||
return;
|
||||
|
||||
callback(settings)
|
||||
callback({
|
||||
dhtDisabled: !config.indexer
|
||||
})
|
||||
});
|
||||
|
||||
socket.on('setAdmin', function(options, callback)
|
||||
@ -409,13 +408,15 @@ io.on('connection', function(socket)
|
||||
if(typeof options !== 'object')
|
||||
return;
|
||||
|
||||
settings.dhtDisabled = !!options.dhtDisabled;
|
||||
spider.ignore = settings.dhtDisabled;
|
||||
config.indexer = !options.dhtDisabled;
|
||||
spider.ignore = !config.indexer;
|
||||
|
||||
if(settings.dhtDisabled)
|
||||
if(!config.indexer)
|
||||
showFakeTorrents()
|
||||
else
|
||||
else {
|
||||
hideFakeTorrents()
|
||||
spider.listen(config.spiderPort)
|
||||
}
|
||||
|
||||
if(typeof callback === 'function')
|
||||
callback(true)
|
||||
@ -498,7 +499,7 @@ let popDatabaseBalance = () => {
|
||||
if(undoneQueries == 0)
|
||||
{
|
||||
balanceDebug('balance done, queries:', undoneQueries);
|
||||
spider.ignore = settings.dhtDisabled;
|
||||
spider.ignore = !config.indexer;
|
||||
}
|
||||
};
|
||||
|
||||
@ -768,7 +769,6 @@ function hideFakeTorrents()
|
||||
fakeTorrentsDebug('hidding fake torrents');
|
||||
}
|
||||
|
||||
|
||||
if(config.indexer) {
|
||||
spider.listen(config.spiderPort)
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user