фейковое обновление торрентов
This commit is contained in:
parent
00d4cd79da
commit
2252fcaac4
@ -1,10 +1,11 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
indexer: true,
|
indexer: false,
|
||||||
|
|
||||||
domain: 'ratsontheboat.org',
|
domain: 'ratsontheboat.org',
|
||||||
httpPort: 8095,
|
httpPort: 8095,
|
||||||
spiderPort: 4445,
|
spiderPort: 4445,
|
||||||
udpTrackersPort: 4446,
|
udpTrackersPort: 4446,
|
||||||
|
udpTrackersTimeout: 3 * 60 * 1000,
|
||||||
|
|
||||||
sitemapMaxSize: 25000,
|
sitemapMaxSize: 25000,
|
||||||
|
|
||||||
|
23
index.js
23
index.js
@ -147,8 +147,6 @@ app.get('*', function(req, res)
|
|||||||
|
|
||||||
// start
|
// start
|
||||||
|
|
||||||
io.on('connection', function(socket)
|
|
||||||
{
|
|
||||||
function baseRowData(row)
|
function baseRowData(row)
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
@ -168,6 +166,8 @@ io.on('connection', function(socket)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
io.on('connection', function(socket)
|
||||||
|
{
|
||||||
socket.on('recentTorrents', function(callback)
|
socket.on('recentTorrents', function(callback)
|
||||||
{
|
{
|
||||||
if(typeof callback != 'function')
|
if(typeof callback != 'function')
|
||||||
@ -506,4 +506,23 @@ client.on('complete', function (metadata, infohash, rinfo) {
|
|||||||
|
|
||||||
if(config.indexer) {
|
if(config.indexer) {
|
||||||
spider.listen(config.spiderPort)
|
spider.listen(config.spiderPort)
|
||||||
|
} else {
|
||||||
|
function showFakeTorrents(page)
|
||||||
|
{
|
||||||
|
listenerMysql.query('SELECT * FROM torrents LIMIT ?, 100', [page], function(err, torrents) {
|
||||||
|
console.log(page)
|
||||||
|
if(!torrents)
|
||||||
|
return;
|
||||||
|
|
||||||
|
torrents.forEach((torrent, index) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
io.sockets.emit('newTorrent', baseRowData(torrent));
|
||||||
|
updateTorrentTrackers(torrent.hash);
|
||||||
|
}, 700 * index)
|
||||||
|
})
|
||||||
|
|
||||||
|
setTimeout(()=>showFakeTorrents(torrents.length > 0 ? page + torrents.length : 0), 700 * torrents.length);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
showFakeTorrents(0);
|
||||||
}
|
}
|
@ -34,7 +34,7 @@ let connectTracker = function(connection) {
|
|||||||
|
|
||||||
// очистка старых соединений
|
// очистка старых соединений
|
||||||
for(transaction in requests) {
|
for(transaction in requests) {
|
||||||
if((new Date).getTime() - requests[transaction].date.getTime() > 3 * 60 * 1000) {
|
if((new Date).getTime() - requests[transaction].date.getTime() > config.udpTrackersTimeout) {
|
||||||
delete requests[transaction];
|
delete requests[transaction];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user