From 474654fd163f1bf8298b280937453c04b097749b Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Sun, 18 Feb 2018 15:49:46 -0800 Subject: [PATCH] standard --- bin/package.js | 66 +++++++++---------- src/main/index.js | 2 +- .../controllers/playback-controller.js | 10 +-- .../controllers/torrent-list-controller.js | 18 ++--- src/renderer/pages/player-page.js | 6 +- src/renderer/webtorrent.js | 2 +- test/index.js | 2 +- test/test-add-torrent.js | 4 +- test/test-audio.js | 2 +- test/test-torrent-list.js | 6 +- test/test-video.js | 2 +- 11 files changed, 60 insertions(+), 60 deletions(-) diff --git a/bin/package.js b/bin/package.js index 9f59a193..edf00dfd 100755 --- a/bin/package.js +++ b/bin/package.js @@ -449,51 +449,51 @@ function buildWin32 (cb) { usePackageJson: false, version: pkg.version }) - .then(function () { - console.log(`Windows: Created ${destArch} installer.`) + .then(function () { + console.log(`Windows: Created ${destArch} installer.`) - /** + /** * Delete extraneous Squirrel files (i.e. *.nupkg delta files for older * versions of the app) */ - fs.readdirSync(DIST_PATH) - .filter((name) => name.endsWith('.nupkg') && !name.includes(pkg.version)) - .forEach((filename) => { - fs.unlinkSync(path.join(DIST_PATH, filename)) - }) + fs.readdirSync(DIST_PATH) + .filter((name) => name.endsWith('.nupkg') && !name.includes(pkg.version)) + .forEach((filename) => { + fs.unlinkSync(path.join(DIST_PATH, filename)) + }) - if (destArch === 'ia32') { - console.log('Windows: Renaming ia32 installer files...') + if (destArch === 'ia32') { + console.log('Windows: Renaming ia32 installer files...') - // RELEASES -> RELEASES-ia32 - const relPath = path.join(DIST_PATH, 'RELEASES-ia32') - fs.renameSync( - path.join(DIST_PATH, 'RELEASES'), - relPath - ) + // RELEASES -> RELEASES-ia32 + const relPath = path.join(DIST_PATH, 'RELEASES-ia32') + fs.renameSync( + path.join(DIST_PATH, 'RELEASES'), + relPath + ) - // WebTorrent-vX.X.X-full.nupkg -> WebTorrent-vX.X.X-ia32-full.nupkg - fs.renameSync( - path.join(DIST_PATH, `${config.APP_NAME}-${config.APP_VERSION}-full.nupkg`), - path.join(DIST_PATH, `${config.APP_NAME}-${config.APP_VERSION}-ia32-full.nupkg`) - ) + // WebTorrent-vX.X.X-full.nupkg -> WebTorrent-vX.X.X-ia32-full.nupkg + fs.renameSync( + path.join(DIST_PATH, `${config.APP_NAME}-${config.APP_VERSION}-full.nupkg`), + path.join(DIST_PATH, `${config.APP_NAME}-${config.APP_VERSION}-ia32-full.nupkg`) + ) - // Change file name inside RELEASES-ia32 to match renamed file - const relContent = fs.readFileSync(relPath, 'utf8') - const relContent32 = relContent.replace('full.nupkg', 'ia32-full.nupkg') - fs.writeFileSync(relPath, relContent32) + // Change file name inside RELEASES-ia32 to match renamed file + const relContent = fs.readFileSync(relPath, 'utf8') + const relContent32 = relContent.replace('full.nupkg', 'ia32-full.nupkg') + fs.writeFileSync(relPath, relContent32) - if (relContent === relContent32) { + if (relContent === relContent32) { // Sanity check - throw new Error('Fixing RELEASES-ia32 failed. Replacement did not modify the file.') + throw new Error('Fixing RELEASES-ia32 failed. Replacement did not modify the file.') + } + + console.log('Windows: Renamed ia32 installer files.') } - console.log('Windows: Renamed ia32 installer files.') - } - - cb(null) - }) - .catch(cb) + cb(null) + }) + .catch(cb) } function packagePortable (filesPath, destArch, cb) { diff --git a/src/main/index.js b/src/main/index.js index 9d952f87..33e9fb3a 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -188,7 +188,7 @@ function onAppOpen (newArgv) { function sliceArgv (argv) { return argv.slice(config.IS_PRODUCTION ? 1 : config.IS_TEST ? 4 - : 2) + : 2) } function processArgv (argv) { diff --git a/src/renderer/controllers/playback-controller.js b/src/renderer/controllers/playback-controller.js index 8288baa3..b26ecf5f 100644 --- a/src/renderer/controllers/playback-controller.js +++ b/src/renderer/controllers/playback-controller.js @@ -102,10 +102,10 @@ module.exports = class PlaybackController { const state = this.state if (Playlist.hasNext(state) && state.playing.location !== 'external') { this.updatePlayer( - state.playing.infoHash, Playlist.getNextIndex(state), false, (err) => { - if (err) dispatch('error', err) - else this.play() - }) + state.playing.infoHash, Playlist.getNextIndex(state), false, (err) => { + if (err) dispatch('error', err) + else this.play() + }) } } @@ -271,7 +271,7 @@ module.exports = class PlaybackController { state.playing.fileIndex = index state.playing.type = TorrentPlayer.isVideo(fileSummary) ? 'video' : TorrentPlayer.isAudio(fileSummary) ? 'audio' - : 'other' + : 'other' // pick up where we left off let jumpToTime = 0 diff --git a/src/renderer/controllers/torrent-list-controller.js b/src/renderer/controllers/torrent-list-controller.js index 12cee063..bf503910 100644 --- a/src/renderer/controllers/torrent-list-controller.js +++ b/src/renderer/controllers/torrent-list-controller.js @@ -157,17 +157,17 @@ module.exports = class TorrentListController { prioritizeTorrent (infoHash) { this.state.saved.torrents - .filter((torrent) => { // We're interested in active torrents only. - return (['downloading', 'seeding'].indexOf(torrent.status) !== -1) - }) - .map((torrent) => { // Pause all active torrents except the one that started playing. - if (infoHash === torrent.infoHash) return + .filter((torrent) => { // We're interested in active torrents only. + return (['downloading', 'seeding'].indexOf(torrent.status) !== -1) + }) + .map((torrent) => { // Pause all active torrents except the one that started playing. + if (infoHash === torrent.infoHash) return - // Pause torrent without playing sounds. - this.pauseTorrent(torrent, false) + // Pause torrent without playing sounds. + this.pauseTorrent(torrent, false) - this.state.saved.torrentsToResume.push(torrent.infoHash) - }) + this.state.saved.torrentsToResume.push(torrent.infoHash) + }) console.log('Playback Priority: paused torrents: ', this.state.saved.torrentsToResume) } diff --git a/src/renderer/pages/player-page.js b/src/renderer/pages/player-page.js index 60e4e469..7e768ca7 100644 --- a/src/renderer/pages/player-page.js +++ b/src/renderer/pages/player-page.js @@ -498,9 +498,9 @@ function renderPlayerControls (state) { const volume = state.playing.volume const volumeIcon = 'volume_' + ( volume === 0 ? 'off' - : volume < 0.3 ? 'mute' - : volume < 0.6 ? 'down' - : 'up') + : volume < 0.3 ? 'mute' + : volume < 0.6 ? 'down' + : 'up') const volumeStyle = { background: '-webkit-gradient(linear, left top, right top, ' + 'color-stop(' + (volume * 100) + '%, #eee), ' + diff --git a/src/renderer/webtorrent.js b/src/renderer/webtorrent.js index 1cb6abe5..2d6c39cd 100644 --- a/src/renderer/webtorrent.js +++ b/src/renderer/webtorrent.js @@ -98,7 +98,7 @@ function init () { window.addEventListener('error', (e) => ipc.send('wt-uncaught-error', {message: e.error.message, stack: e.error.stack}), - true) + true) setInterval(updateTorrentProgress, 1000) console.timeEnd('init') diff --git a/test/index.js b/test/index.js index cf9850c6..c8a9c56a 100644 --- a/test/index.js +++ b/test/index.js @@ -10,7 +10,7 @@ test('app runs', function (t) { setup.waitForLoad(app, t) .then(() => setup.screenshotCreateOrCompare(app, t, 'app-basic')) .then(() => setup.endTest(app, t), - (err) => setup.endTest(app, t, err || 'error')) + (err) => setup.endTest(app, t, err || 'error')) }) require('./test-torrent-list') diff --git a/test/test-add-torrent.js b/test/test-add-torrent.js index 65985a25..c8d7bd3e 100644 --- a/test/test-add-torrent.js +++ b/test/test-add-torrent.js @@ -30,7 +30,7 @@ test('add-torrent', function (t) { .then(() => app.client.moveToObject('.torrent')) .then(() => setup.screenshotCreateOrCompare(app, t, 'add-torrent-100-percent')) .then(() => setup.endTest(app, t), - (err) => setup.endTest(app, t, err || 'error')) + (err) => setup.endTest(app, t, err || 'error')) }) test('create-torrent', function (t) { @@ -84,5 +84,5 @@ test('create-torrent', function (t) { config.SAVED_TORRENT_FILE, expectedTorrent)) .then(() => setup.endTest(app, t), - (err) => setup.endTest(app, t, err || 'error')) + (err) => setup.endTest(app, t, err || 'error')) }) diff --git a/test/test-audio.js b/test/test-audio.js index ab002ee9..6c421582 100644 --- a/test/test-audio.js +++ b/test/test-audio.js @@ -53,5 +53,5 @@ test('audio-streaming', function (t) { .then(() => app.webContents.executeJavaScript('dispatch("skipTo", 2)')) .then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired-5')) .then(() => setup.endTest(app, t), - (err) => setup.endTest(app, t, err || 'error')) + (err) => setup.endTest(app, t, err || 'error')) }) diff --git a/test/test-torrent-list.js b/test/test-torrent-list.js index 71c1b2ea..b3b8fe5e 100644 --- a/test/test-torrent-list.js +++ b/test/test-torrent-list.js @@ -22,7 +22,7 @@ test('torrent-list: show download path missing', function (t) { .then((windowTitle) => t.equal(windowTitle, 'Preferences', 'window title')) .then(() => setup.screenshotCreateOrCompare(app, t, 'prefs-basic')) .then(() => setup.endTest(app, t), - (err) => setup.endTest(app, t, err || 'error')) + (err) => setup.endTest(app, t, err || 'error')) }) test('torrent-list: start, stop, and delete torrents', function (t) { @@ -54,7 +54,7 @@ test('torrent-list: start, stop, and delete torrents', function (t) { .then(() => app.client.click('.control.ok')) .then(() => setup.screenshotCreateOrCompare(app, t, 'torrent-list-deleted')) .then(() => setup.endTest(app, t), - (err) => setup.endTest(app, t, err || 'error')) + (err) => setup.endTest(app, t, err || 'error')) }) test('torrent-list: expand torrent, unselect file', function (t) { @@ -101,5 +101,5 @@ test('torrent-list: expand torrent, unselect file', function (t) { // Make sure that all the files are gone .then(() => setup.compareDownloadFolder(t, 'CosmosLaundromatFirstCycle', null)) .then(() => setup.endTest(app, t), - (err) => setup.endTest(app, t, err || 'error')) + (err) => setup.endTest(app, t, err || 'error')) }) diff --git a/test/test-video.js b/test/test-video.js index b2b6a322..4dfe484e 100644 --- a/test/test-video.js +++ b/test/test-video.js @@ -31,5 +31,5 @@ test('video-streaming', function (t) { // Take another screenshot to verify that the window resized correctly .then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-return')) .then(() => setup.endTest(app, t), - (err) => setup.endTest(app, t, err || 'error')) + (err) => setup.endTest(app, t, err || 'error')) })