From 81b3d64f4244bde38d270b2229be270312adc55a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Sun, 26 Apr 2020 15:14:36 +0100 Subject: [PATCH] Use object shorthand for properties --- bin/package.js | 2 +- src/config.js | 16 ++++++++-------- src/main/index.js | 2 +- src/main/ipc.js | 4 ++-- src/renderer/controllers/media-controller.js | 2 +- src/renderer/controllers/subtitles-controller.js | 2 +- src/renderer/controllers/torrent-controller.js | 2 +- .../controllers/torrent-list-controller.js | 2 +- src/renderer/controllers/update-controller.js | 2 +- src/renderer/lib/torrent-poster.js | 2 +- src/renderer/main.js | 10 +++++----- src/renderer/webtorrent.js | 4 ++-- 12 files changed, 25 insertions(+), 25 deletions(-) diff --git a/bin/package.js b/bin/package.js index 81ff3b03..ddbce54f 100755 --- a/bin/package.js +++ b/bin/package.js @@ -430,7 +430,7 @@ function buildWin32 (cb) { // remoteToken: process.env.WEBTORRENT_GITHUB_API_TOKEN, setupExe: config.APP_NAME + 'Setup-v' + config.APP_VERSION + '.exe', setupIcon: config.APP_ICON + '.ico', - signWithParams: signWithParams, + signWithParams, title: config.APP_NAME, usePackageJson: false, version: pkg.version diff --git a/src/config.js b/src/config.js index 54e93c67..c55e73fa 100644 --- a/src/config.js +++ b/src/config.js @@ -26,9 +26,9 @@ module.exports = { APP_COPYRIGHT: `Copyright © 2014-${new Date().getFullYear()} ${APP_TEAM}`, APP_FILE_ICON: path.join(__dirname, '..', 'static', 'WebTorrentFile'), APP_ICON: path.join(__dirname, '..', 'static', 'WebTorrent'), - APP_NAME: APP_NAME, - APP_TEAM: APP_TEAM, - APP_VERSION: APP_VERSION, + APP_NAME, + APP_TEAM, + APP_VERSION, APP_WINDOW_TITLE: APP_NAME, CONFIG_PATH: getConfigPath(), @@ -78,9 +78,9 @@ module.exports = { HOME_PAGE_URL: 'https://webtorrent.io', TWITTER_PAGE_URL: 'https://twitter.com/WebTorrentApp', - IS_PORTABLE: IS_PORTABLE, - IS_PRODUCTION: IS_PRODUCTION, - IS_TEST: IS_TEST, + IS_PORTABLE, + IS_PRODUCTION, + IS_TEST, OS_SYSARCH: arch() === 'x64' ? 'x64' : 'ia32', @@ -100,8 +100,8 @@ module.exports = { WINDOW_MIN_HEIGHT: UI_HEADER_HEIGHT + (UI_TORRENT_HEIGHT * 2), // header + 2 torrents WINDOW_MIN_WIDTH: 425, - UI_HEADER_HEIGHT: UI_HEADER_HEIGHT, - UI_TORRENT_HEIGHT: UI_TORRENT_HEIGHT + UI_HEADER_HEIGHT, + UI_TORRENT_HEIGHT } function getConfigPath () { diff --git a/src/main/index.js b/src/main/index.js index df5f1537..d670caba 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -81,7 +81,7 @@ function init () { isReady = true const state = results.state - windows.main.init(state, { hidden: hidden }) + windows.main.init(state, { hidden }) windows.webtorrent.init() menu.init() diff --git a/src/main/ipc.js b/src/main/ipc.js index baf76f72..216b7e5f 100644 --- a/src/main/ipc.js +++ b/src/main/ipc.js @@ -235,8 +235,8 @@ function init () { } else { // Queue message for webtorrent window, it hasn't finished loading yet messageQueueMainToWebTorrent.push({ - name: name, - args: args + name, + args }) log('webtorrent: queueing %s', name) } diff --git a/src/renderer/controllers/media-controller.js b/src/renderer/controllers/media-controller.js index 78179061..e57be056 100644 --- a/src/renderer/controllers/media-controller.js +++ b/src/renderer/controllers/media-controller.js @@ -26,7 +26,7 @@ module.exports = class MediaController { ipcRenderer.once('checkForExternalPlayer', function (e, isInstalled) { state.modal = { id: 'unsupported-media-modal', - error: error, + error, externalPlayerInstalled: isInstalled } }) diff --git a/src/renderer/controllers/subtitles-controller.js b/src/renderer/controllers/subtitles-controller.js index deabb3b3..f9311aaa 100644 --- a/src/renderer/controllers/subtitles-controller.js +++ b/src/renderer/controllers/subtitles-controller.js @@ -109,7 +109,7 @@ function loadSubtitle (file, cb) { buffer: 'data:text/vtt;base64,' + buf.toString('base64'), language: langDetected, label: langDetected, - filePath: filePath + filePath } cb(null, track) diff --git a/src/renderer/controllers/torrent-controller.js b/src/renderer/controllers/torrent-controller.js index dda18d5e..89da8202 100644 --- a/src/renderer/controllers/torrent-controller.js +++ b/src/renderer/controllers/torrent-controller.js @@ -25,7 +25,7 @@ module.exports = class TorrentController { } torrentSummary = { - torrentKey: torrentKey, + torrentKey, status: 'new' } torrents.unshift(torrentSummary) diff --git a/src/renderer/controllers/torrent-list-controller.js b/src/renderer/controllers/torrent-list-controller.js index 66abfbcf..05345c39 100644 --- a/src/renderer/controllers/torrent-list-controller.js +++ b/src/renderer/controllers/torrent-list-controller.js @@ -55,7 +55,7 @@ module.exports = class TorrentListController { if (files.length === 0 || typeof files[0] !== 'string') { this.state.location.go({ url: 'create-torrent', - files: files, + files, setup: (cb) => { this.state.window.title = 'Create New Torrent' cb(null) diff --git a/src/renderer/controllers/update-controller.js b/src/renderer/controllers/update-controller.js index 70ddbdab..cc7c1e82 100644 --- a/src/renderer/controllers/update-controller.js +++ b/src/renderer/controllers/update-controller.js @@ -13,7 +13,7 @@ module.exports = class UpdateController { console.log('new version skipped by user: v' + version) return } - this.state.modal = { id: 'update-available-modal', version: version } + this.state.modal = { id: 'update-available-modal', version } } // Don't show the modal again until the next version diff --git a/src/renderer/lib/torrent-poster.js b/src/renderer/lib/torrent-poster.js index 13eefadc..d71f7533 100644 --- a/src/renderer/lib/torrent-poster.js +++ b/src/renderer/lib/torrent-poster.js @@ -117,7 +117,7 @@ function torrentPosterFromAudio (torrent, cb) { const bestCover = imageFiles.map(file => { return { - file: file, + file, score: scoreAudioCoverFile(file) } }).reduce((a, b) => { diff --git a/src/renderer/main.js b/src/renderer/main.js index be363d6c..8f5f8a9e 100644 --- a/src/renderer/main.js +++ b/src/renderer/main.js @@ -312,7 +312,7 @@ const dispatchHandlers = { // Preferences screen preferences: () => controllers.prefs().show(), updatePreferences: (key, value) => controllers.prefs().update(key, value), - checkDownloadPath: checkDownloadPath, + checkDownloadPath, startFolderWatcher: () => controllers.folderWatcher().start(), stopFolderWatcher: () => controllers.folderWatcher().stop(), @@ -322,20 +322,20 @@ const dispatchHandlers = { // Navigation between screens (back, forward, ESC, etc) exitModal: () => { state.modal = null }, - backToList: backToList, - escapeBack: escapeBack, + backToList, + escapeBack, back: () => state.location.back(), forward: () => state.location.forward(), cancel: () => state.location.cancel(), // Controlling the window - setDimensions: setDimensions, + setDimensions, toggleFullScreen: (setTo) => ipcRenderer.send('toggleFullScreen', setTo), setTitle: (title) => { state.window.title = title }, resetTitle: () => { state.window.title = config.APP_WINDOW_TITLE }, // Everything else - onOpen: onOpen, + onOpen, error: onError, uncaughtError: (proc, err) => telemetry.logUncaughtError(proc, err), stateSave: () => State.save(state), diff --git a/src/renderer/webtorrent.js b/src/renderer/webtorrent.js index 0279a8bd..88a53d88 100644 --- a/src/renderer/webtorrent.js +++ b/src/renderer/webtorrent.js @@ -113,8 +113,8 @@ function startTorrenting (torrentKey, torrentID, path, fileModtimes, selections) console.log('starting torrent %s: %s', torrentKey, torrentID) const torrent = client.add(torrentID, { - path: path, - fileModtimes: fileModtimes + path, + fileModtimes }) torrent.key = torrentKey