@@ -301,71 +301,71 @@ 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')));
})