This commit is contained in:
Feross Aboukhadijeh
2019-07-05 14:26:38 -07:00
parent 46d50ccda2
commit 9ed3533225
9 changed files with 23 additions and 23 deletions

View File

@@ -198,16 +198,16 @@ function buildDarwin (cb) {
infoPlist.CFBundleDocumentTypes = [ infoPlist.CFBundleDocumentTypes = [
{ {
CFBundleTypeExtensions: [ 'torrent' ], CFBundleTypeExtensions: ['torrent'],
CFBundleTypeIconFile: path.basename(config.APP_FILE_ICON) + '.icns', CFBundleTypeIconFile: path.basename(config.APP_FILE_ICON) + '.icns',
CFBundleTypeName: 'BitTorrent Document', CFBundleTypeName: 'BitTorrent Document',
CFBundleTypeRole: 'Editor', CFBundleTypeRole: 'Editor',
LSHandlerRank: 'Owner', LSHandlerRank: 'Owner',
LSItemContentTypes: [ 'org.bittorrent.torrent' ] LSItemContentTypes: ['org.bittorrent.torrent']
}, },
{ {
CFBundleTypeName: 'Any', CFBundleTypeName: 'Any',
CFBundleTypeOSTypes: [ '****' ], CFBundleTypeOSTypes: ['****'],
CFBundleTypeRole: 'Editor', CFBundleTypeRole: 'Editor',
LSHandlerRank: 'Owner', LSHandlerRank: 'Owner',
LSTypeIsPackage: false LSTypeIsPackage: false
@@ -219,13 +219,13 @@ function buildDarwin (cb) {
CFBundleTypeRole: 'Editor', CFBundleTypeRole: 'Editor',
CFBundleURLIconFile: path.basename(config.APP_FILE_ICON) + '.icns', CFBundleURLIconFile: path.basename(config.APP_FILE_ICON) + '.icns',
CFBundleURLName: 'BitTorrent Magnet URL', CFBundleURLName: 'BitTorrent Magnet URL',
CFBundleURLSchemes: [ 'magnet' ] CFBundleURLSchemes: ['magnet']
}, },
{ {
CFBundleTypeRole: 'Editor', CFBundleTypeRole: 'Editor',
CFBundleURLIconFile: path.basename(config.APP_FILE_ICON) + '.icns', CFBundleURLIconFile: path.basename(config.APP_FILE_ICON) + '.icns',
CFBundleURLName: 'BitTorrent Stream-Magnet URL', CFBundleURLName: 'BitTorrent Stream-Magnet URL',
CFBundleURLSchemes: [ 'stream-magnet' ] CFBundleURLSchemes: ['stream-magnet']
} }
] ]
@@ -242,7 +242,7 @@ function buildDarwin (cb) {
UTTypeReferenceURL: 'http://www.bittorrent.org/beps/bep_0000.html', UTTypeReferenceURL: 'http://www.bittorrent.org/beps/bep_0000.html',
UTTypeTagSpecification: { UTTypeTagSpecification: {
'com.apple.ostype': 'TORR', 'com.apple.ostype': 'TORR',
'public.filename-extension': [ 'torrent' ], 'public.filename-extension': ['torrent'],
'public.mime-type': 'application/x-bittorrent' 'public.mime-type': 'application/x-bittorrent'
} }
} }

View File

@@ -19,7 +19,7 @@ function openSeedFile () {
log('openSeedFile') log('openSeedFile')
const opts = { const opts = {
title: 'Select a file for the torrent.', title: 'Select a file for the torrent.',
properties: [ 'openFile' ] properties: ['openFile']
} }
showOpenSeed(opts) showOpenSeed(opts)
} }
@@ -35,11 +35,11 @@ function openSeedDirectory () {
const opts = process.platform === 'darwin' const opts = process.platform === 'darwin'
? { ? {
title: 'Select a file or folder for the torrent.', title: 'Select a file or folder for the torrent.',
properties: [ 'openFile', 'openDirectory' ] properties: ['openFile', 'openDirectory']
} }
: { : {
title: 'Select a folder for the torrent.', title: 'Select a folder for the torrent.',
properties: [ 'openDirectory' ] properties: ['openDirectory']
} }
showOpenSeed(opts) showOpenSeed(opts)
} }
@@ -54,11 +54,11 @@ function openFiles () {
const opts = process.platform === 'darwin' const opts = process.platform === 'darwin'
? { ? {
title: 'Select a file or folder to add.', title: 'Select a file or folder to add.',
properties: [ 'openFile', 'openDirectory' ] properties: ['openFile', 'openDirectory']
} }
: { : {
title: 'Select a file to add.', title: 'Select a file to add.',
properties: [ 'openFile' ] properties: ['openFile']
} }
setTitle(opts.title) setTitle(opts.title)
electron.dialog.showOpenDialog(windows.main.win, opts, function (selectedPaths) { electron.dialog.showOpenDialog(windows.main.win, opts, function (selectedPaths) {
@@ -77,7 +77,7 @@ function openTorrentFile () {
const opts = { const opts = {
title: 'Select a .torrent file.', title: 'Select a .torrent file.',
filters: [{ name: 'Torrent Files', extensions: ['torrent'] }], filters: [{ name: 'Torrent Files', extensions: ['torrent'] }],
properties: [ 'openFile', 'multiSelections' ] properties: ['openFile', 'multiSelections']
} }
setTitle(opts.title) setTitle(opts.title)
electron.dialog.showOpenDialog(windows.main.win, opts, function (selectedPaths) { electron.dialog.showOpenDialog(windows.main.win, opts, function (selectedPaths) {

View File

@@ -42,7 +42,7 @@ function installDarwin () {
function uninstallDarwin () {} function uninstallDarwin () {}
const EXEC_COMMAND = [ process.execPath, '--' ] const EXEC_COMMAND = [process.execPath, '--']
if (!config.IS_PRODUCTION) { if (!config.IS_PRODUCTION) {
EXEC_COMMAND.push(config.ROOT_PATH) EXEC_COMMAND.push(config.ROOT_PATH)

View File

@@ -162,7 +162,7 @@ function onOpen (e, torrentId) {
// Electron issue: https://github.com/atom/electron/issues/4338 // Electron issue: https://github.com/atom/electron/issues/4338
setTimeout(() => windows.main.show(), 100) setTimeout(() => windows.main.show(), 100)
processArgv([ torrentId ]) processArgv([torrentId])
} else { } else {
argv.push(torrentId) argv.push(torrentId)
} }

View File

@@ -77,8 +77,8 @@ function onPlayerPlay () {
function onPlayerUpdate (state) { function onPlayerUpdate (state) {
if (!isEnabled()) return if (!isEnabled()) return
buttons[PREV].flags = [ state.hasPrevious ? 'enabled' : 'disabled' ] buttons[PREV].flags = [state.hasPrevious ? 'enabled' : 'disabled']
buttons[NEXT].flags = [ state.hasNext ? 'enabled' : 'disabled' ] buttons[NEXT].flags = [state.hasNext ? 'enabled' : 'disabled']
update() update()
} }

View File

@@ -32,7 +32,7 @@ class PathSelector extends React.Component {
handleClick () { handleClick () {
const opts = Object.assign({ const opts = Object.assign({
defaultPath: this.props.value, defaultPath: this.props.value,
properties: [ 'openFile', 'openDirectory' ] properties: ['openFile', 'openDirectory']
}, this.props.dialog) }, this.props.dialog)
remote.dialog.showOpenDialog( remote.dialog.showOpenDialog(

View File

@@ -15,8 +15,8 @@ module.exports = class SubtitlesController {
openSubtitles () { openSubtitles () {
remote.dialog.showOpenDialog({ remote.dialog.showOpenDialog({
title: 'Select a subtitles file.', title: 'Select a subtitles file.',
filters: [ { name: 'Subtitles', extensions: ['vtt', 'srt'] } ], filters: [{ name: 'Subtitles', extensions: ['vtt', 'srt'] }],
properties: [ 'openFile' ] properties: ['openFile']
}, (filenames) => { }, (filenames) => {
if (!Array.isArray(filenames)) return if (!Array.isArray(filenames)) return
this.addSubtitles(filenames, true) this.addSubtitles(filenames, true)

View File

@@ -458,7 +458,7 @@ function setDimensions (dimensions) {
// Called when the user adds files (.torrent, files to seed, subtitles) to the app // Called when the user adds files (.torrent, files to seed, subtitles) to the app
// via any method (drag-drop, drag to app icon, command line) // via any method (drag-drop, drag to app icon, command line)
function onOpen (files) { function onOpen (files) {
if (!Array.isArray(files)) files = [ files ] if (!Array.isArray(files)) files = [files]
// File API seems to transform "magnet:?foo" in "magnet:///?foo" // File API seems to transform "magnet:?foo" in "magnet:///?foo"
// this is a sanitization // this is a sanitization

View File

@@ -37,7 +37,7 @@ class PreferencesPage extends React.Component {
<PathSelector <PathSelector
dialog={{ dialog={{
title: 'Select download directory', title: 'Select download directory',
properties: [ 'openDirectory' ] properties: ['openDirectory']
}} }}
onChange={this.handleDownloadPathChange} onChange={this.handleDownloadPathChange}
title='Download location' title='Download location'
@@ -98,7 +98,7 @@ class PreferencesPage extends React.Component {
<PathSelector <PathSelector
dialog={{ dialog={{
title: 'Select media player app', title: 'Select media player app',
properties: [ 'openFile' ] properties: ['openFile']
}} }}
displayValue={playerName} displayValue={playerName}
onChange={this.handleExternalPlayerPathChange} onChange={this.handleExternalPlayerPathChange}
@@ -151,7 +151,7 @@ class PreferencesPage extends React.Component {
<PathSelector <PathSelector
dialog={{ dialog={{
title: 'Select folder to watch for new torrents', title: 'Select folder to watch for new torrents',
properties: [ 'openDirectory' ] properties: ['openDirectory']
}} }}
displayValue={torrentsFolderPath || ''} displayValue={torrentsFolderPath || ''}
onChange={this.handletorrentsFolderPathChange} onChange={this.handletorrentsFolderPathChange}