From 03bc4cf9b1b9cfbc16242131e0f795651f3b63d5 Mon Sep 17 00:00:00 2001 From: Benjamin Tan Date: Sun, 31 Jul 2016 16:29:38 +0800 Subject: [PATCH 1/3] Add User Tasks for Windows. Closes #114. --- src/main/index.js | 2 ++ src/main/user-tasks.js | 43 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src/main/user-tasks.js diff --git a/src/main/index.js b/src/main/index.js index c81517e1..20b5a3fe 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -17,6 +17,7 @@ var menu = require('./menu') var squirrelWin32 = require('./squirrel-win32') var tray = require('./tray') var updater = require('./updater') +var userTasks = require('./user-tasks') var windows = require('./windows') var shouldQuit = false @@ -109,6 +110,7 @@ function delayedInit () { handlers.install() tray.init() updater.init() + userTasks.init() } function onOpen (e, torrentId) { diff --git a/src/main/user-tasks.js b/src/main/user-tasks.js new file mode 100644 index 00000000..47e63f8a --- /dev/null +++ b/src/main/user-tasks.js @@ -0,0 +1,43 @@ +module.exports = { + init +} + +var electron = require('electron') + +var app = electron.app + +/** + * Add a user task menu to the app icon on right-click. (Windows) + */ +function init () { + if (process.platform !== 'win32') return + app.setUserTasks(getUserTasks()) +} + +function getUserTasks () { + return [ + { + arguments: '-n', + title: 'Create New Torrent...', + description: 'Create a new torrent' + }, + { + arguments: '-o', + title: 'Open Torrent File...', + description: 'Open a .torrent file' + }, + { + arguments: '-u', + title: 'Open Torrent Address...', + description: 'Open a torrent from a URL' + } + ].map(getUserTasksItem) +} + +function getUserTasksItem (item) { + return Object.assign(item, { + program: process.execPath, + iconPath: process.execPath, + iconIndex: 0 + }) +} From fc53c68dd931b419cf071443bec2f1219c1ec6b8 Mon Sep 17 00:00:00 2001 From: Benjamin Tan Date: Sun, 31 Jul 2016 16:36:43 +0800 Subject: [PATCH 2/3] Use `rimraf` instead of `rm -rf` for Windows. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 492e1a2b..8a53d849 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "scripts": { "clean": "node ./bin/clean.js", "open-config": "node ./bin/open-config.js", - "package": "rm -rf build/ && jsx --es6module src/ build/ && node ./bin/package.js", + "package": "rimraf build/ && jsx --es6module src/ build/ && node ./bin/package.js", "start": "jsx --es6module src/ build/ && electron .", "test": "standard && node ./bin/check-deps.js", "update-authors": "./bin/update-authors.sh" From 91a4c0cff5915bd92dd8b939b26ff8a560cb5103 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Tue, 2 Aug 2016 19:11:06 -0700 Subject: [PATCH 3/3] electron-prebuilt@1.3.2 Changelog: https://github.com/electron/electron/releases/tag/v1.3.2 Nothing in the changelog fixes known WebTorrent Desktop issues. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8a53d849..d80c3115 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "deep-equal": "^1.0.1", "dlnacasts": "^0.1.0", "drag-drop": "^2.11.0", - "electron-prebuilt": "1.3.1", + "electron-prebuilt": "1.3.2", "fs-extra": "^0.30.0", "hat": "0.0.3", "iso-639-1": "^1.2.1",