From 7a22e73840fcabe7687365036cc1479e9eef1f1c Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 2 Mar 2016 02:33:18 -0800 Subject: [PATCH] new menu option: creating new torrents --- index.js | 9 ++++----- main/index.js | 4 ++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 3f086ab3..addc2130 100644 --- a/index.js +++ b/index.js @@ -85,16 +85,15 @@ var template = [ label: 'File', submenu: [ { - label: 'Create Torrent File...', + label: 'Create New Torrent...', accelerator: 'CmdOrCtrl+N', click: function () { electron.dialog.showOpenDialog({ title: 'Select a file or folder for the torrent file.', - properties: [ 'openFile', 'multiSelections' ] + properties: [ 'openFile', 'openDirectory', 'multiSelections' ] }, function (filenames) { - filenames.forEach(function (filename) { - mainWindow.send('action', 'addTorrent', filename) - }) + if (!Array.isArray(filenames)) return + mainWindow.send('action', 'seed', filenames) }) } }, diff --git a/main/index.js b/main/index.js index 6fd9557d..d601763b 100644 --- a/main/index.js +++ b/main/index.js @@ -69,6 +69,10 @@ function handler (action, ...args) { var torrentId = args[0] addTorrent(torrentId) } + if (action === 'seed') { + var files = args[0] + seed(files) + } if (action === 'openPlayer') { var torrent = args[0] openPlayer(torrent)