diff --git a/src/app/config-page.js b/src/app/config-page.js index 7ea4391..e49a183 100644 --- a/src/app/config-page.js +++ b/src/app/config-page.js @@ -47,15 +47,15 @@ export default class ConfigPage extends Page { }} /> + c5.308,6.188,7.074,12.091,4.423,11.212c-2.66-0.896-13.267-7.08-45.104-2.066c-4.126,1.17-21.221-12.682-44.513-12.977 + c-23.283-0.295-40.381,6.346-64.85,72.296c-2.356,5.828-18.866,19.386-27.71,25.865C3.536,162.529,0.007,169.787,0,182.763 + c-0.018,18.158,25.934,27.187,81.648,26.889c55.715-0.292,85.195-9.388,85.195-9.388c-62.789,6.773-158.907,10.52-158.907-18.687 + c0-20.641,28.321-28.47,36.281-28.184c7.958,0.3,13.562,12.673,33.307,5.603c3.247-0.295,1.48,4.423-1.18,7.369 + c-2.651,2.942-0.586,6.487,9.73,6.487c10.315,0,41.183,0.295,47.707,0c6.531-0.299,11.839-11.792-9.384-12.68 + c-18.548,0.311,12.023-5.773,15.915-21.813c0.709-3.927,8.84-4.139,15.918-4.119c20.777,0.029,34.485,38.193,38.912,38.338 + c4.416,0.15,17.979,1.621,17.683-4.273c-0.292-5.897-11.491-3.241-13.854-6.487c-2.359-3.234-10.023-15.504-7.366-21.104 + c2.65-5.59,12.674-21.229,24.463-22.988c11.789-1.777,42.451,7.361,47.459,0c5.012-7.372-6.783-11.512-15.918-28.611 + C243.779,80.572,238.768,71.728,220.195,71.427z"/> }>
@@ -209,24 +209,24 @@ export default class ConfigPage extends Page {
- - - - - - - - - }> + + + }>
{__('P2P Rats network settings')}:
@@ -301,71 +301,71 @@ export default class ConfigPage extends Page { - - + + + + + + + + + - - - - - - - }>
- +
{__('Torrent network scanner settings')}:
- +
{__('Scanner walk speed')} ({__('current')}: {this.options.spider && this.options.spider.walkInterval}) [{__('affected after program reload')}]
@@ -438,7 +438,7 @@ export default class ConfigPage extends Page {
-
+
diff --git a/src/app/search.js b/src/app/search.js index 59ba3c7..5b2271a 100644 --- a/src/app/search.js +++ b/src/app/search.js @@ -264,7 +264,7 @@ class Search extends Component {
diff --git a/src/background/background.js b/src/background/background.js index 23b68b7..060ae1d 100644 --- a/src/background/background.js +++ b/src/background/background.js @@ -131,15 +131,15 @@ if (!gotTheLock) { logT('app', 'closed because of second application') app.exit(0); } else { - app.on('second-instance', (event, commandLine, workingDirectory) => { - // Someone tried to run a second instance, we should focus our window. - logT('app', 'openned second application, just focus this one') - if (mainWindow) { - if (mainWindow.isMinimized()) - mainWindow.restore(); - mainWindow.focus(); - } - }) + app.on('second-instance', (event, commandLine, workingDirectory) => { + // Someone tried to run a second instance, we should focus our window. + logT('app', 'openned second application, just focus this one') + if (mainWindow) { + if (mainWindow.isMinimized()) + mainWindow.restore(); + mainWindow.focus(); + } + }) } // log autoupdate diff --git a/src/background/p2p.js b/src/background/p2p.js index a5e9f53..283941a 100644 --- a/src/background/p2p.js +++ b/src/background/p2p.js @@ -336,7 +336,7 @@ class p2p { server.close(); }) this.p2pStatus = 2 - this.send('p2pStatus', this.p2pStatus) + this.send('p2pStatus', this.p2pStatus) } else { @@ -349,7 +349,7 @@ class p2p { this.connectToRelay(candidatePeer[0]) } this.p2pStatus = 0 - this.send('p2pStatus', this.p2pStatus) + this.send('p2pStatus', this.p2pStatus) } }) } @@ -430,7 +430,7 @@ class p2p { logTE('relay', 'no port in relay request responce'); return; } - + logT('relay', 'try connecting to new relay', relayPeer.peerId) let peers = {} this.relaySocket = new JsonSocket(new net.Socket()); @@ -441,15 +441,15 @@ class p2p { this.send('p2pStatus', this.p2pStatus) tryes = 3; // restore tryies bebause we connected }); - + this.relaySocket.on('message', (data) => { if(!data.id) return - + if(!peers[data.id]) { if(data.close) return - + peers[data.id] = new JsonSocket(new net.Socket()); peers[data.id].on('message', (toPeer) => { //logT('relay', 'client message to relay', data.id); @@ -466,12 +466,12 @@ class p2p { logT('relay', 'peer disconnected'); return } - + //logT('relay', 'client message to my server', data.id); peers[data.id].sendMessage(data.data) } }); - + this.relaySocket.on('close', () => { logT('relay', 'relay client closed because server exit'); for(const id in peers) { @@ -480,14 +480,14 @@ class p2p { peers = null this.relaySocket = null this.p2pStatus = 0 - this.send('p2pStatus', this.p2pStatus) + this.send('p2pStatus', this.p2pStatus) // try reconnect to new relay server let candidatePeer = this.peersList().filter(peer => peer.relay && peer.relay.server && peer != relayPeer) if(candidatePeer && candidatePeer.length > 0 && tryes > 0) { logT('relay', 'reconnect to new relay, because old closed'); this.connectToRelay(candidatePeer[0], --tryes) } - }); + }); }) } } @@ -603,7 +603,7 @@ class p2p { data.relays.forEach(peer => this.add(peer, true)) } } - + // try connect to relay if needed this.connectToRelay(address) diff --git a/src/background/spider.js b/src/background/spider.js index 4195868..de364ec 100644 --- a/src/background/spider.js +++ b/src/background/spider.js @@ -107,18 +107,18 @@ module.exports = function (send, recive, dataDirectory, version, env) const sphinxSingle = await single().waitConnection() let torrentsInfo = await sphinxSingle.query(` - SELECT - MAX(id) as maxid, - COUNT(*) as torrentscount, - SUM(files) as numfiles, - SUM(size) as filessize - FROM torrents - `); + SELECT + MAX(id) as maxid, + COUNT(*) as torrentscount, + SUM(files) as numfiles, + SUM(size) as filessize + FROM torrents + `); let filesInfo = await sphinxSingle.query(` - SELECT - MAX(id) as maxid - FROM files - `); + SELECT + MAX(id) as maxid + FROM files + `); if(torrentsInfo && torrentsInfo[0]) { torrentsInfo = torrentsInfo[0] @@ -168,8 +168,8 @@ module.exports = function (send, recive, dataDirectory, version, env) }) } else { fs.readdirSync(__dirname + '/strategies').forEach((strategie) => { - this.trackers.push(new (require('./strategies/' + strategie))(args)) - logT('tracker', 'loaded strategie', strategie) + this.trackers.push(new (require('./strategies/' + strategie))(args)) + logT('tracker', 'loaded strategie', strategie) }) } } diff --git a/src/background/strategies/1337x.js b/src/background/strategies/1337x.js index 084d18a..9e8eb14 100644 --- a/src/background/strategies/1337x.js +++ b/src/background/strategies/1337x.js @@ -4,60 +4,60 @@ const cheerio = require('cheerio') module.exports = class Stragegie { - get name() { return '1337x' } + get name() { return '1337x' } - async findHash(hash) - { - let html; - try { - html = await fetch(`https://1337x.to/srch?search=${hash}`) - } catch(err) { - return - } - if(!html) - return - html = await html.textConverted() - const $ = cheerio.load(html) + async findHash(hash) + { + let html; + try { + html = await fetch(`https://1337x.to/srch?search=${hash}`) + } catch(err) { + return + } + if(!html) + return + html = await html.textConverted() + const $ = cheerio.load(html) - this.href = $($('.table-list tr td a').get(1)).attr('href') - if(this.href) - this.id = this.href.match(/\/torrent\/([0-9]+)\//)[1]; + this.href = $($('.table-list tr td a').get(1)).attr('href') + if(this.href) + this.id = this.href.match(/\/torrent\/([0-9]+)\//)[1]; - return await this.parse(); - } + return await this.parse(); + } - async parse() - { - let html; - try { - html = await fetch('https://1337x.to' + this.href) - } catch(err) { - return - } - if(!html) - return - html = await html.textConverted() - const $ = cheerio.load(html) - const topicTitle = $('h1').text() - if(!topicTitle) - return + async parse() + { + let html; + try { + html = await fetch('https://1337x.to' + this.href) + } catch(err) { + return + } + if(!html) + return + html = await html.textConverted() + const $ = cheerio.load(html) + const topicTitle = $('h1').text() + if(!topicTitle) + return - let contentCategory; - try { - contentCategory = $('.torrent-category-detail .list li').first().find('span').text() - } catch(er) {} + let contentCategory; + try { + contentCategory = $('.torrent-category-detail .list li').first().find('span').text() + } catch(er) {} - let poster = $('.torrent-image img').attr('src') || $('#description img').attr('data-original'); - if(poster) - poster = poster.replace(/^\/\//, 'https://'); + let poster = $('.torrent-image img').attr('src') || $('#description img').attr('data-original'); + if(poster) + poster = poster.replace(/^\/\//, 'https://'); - return { - name: topicTitle.trim(), - poster, - description: $('#description').text(), - x1337ThreadId: parseInt(this.id), - x1337Href: this.href, - contentCategory - } - } + return { + name: topicTitle.trim(), + poster, + description: $('#description').text(), + x1337ThreadId: parseInt(this.id), + x1337Href: this.href, + contentCategory + } + } } \ No newline at end of file diff --git a/tests/download.test.js b/tests/download.test.js index 1d8c2a4..5dd24d1 100644 --- a/tests/download.test.js +++ b/tests/download.test.js @@ -54,9 +54,9 @@ describe("download", function() { const { app } = this await app.client.waitForExist('.torrentRow .progressDownloading') await app.client.waitUntil(async () => { - return (await app.client.getText('.torrentRow .progressDownloading')) === '100.0%' + return (await app.client.getText('.torrentRow .progressDownloading')) === '100.0%' }, 60000, 'expected that download will be finished', 200) - + // Check Buttons After finish assert(!(await app.client.isExisting('.torrentRow .deleteDownloadBeforeFinish'))); })