diff --git a/AUTHORS.md b/AUTHORS.md index 3113e5d6..bceeb904 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -34,5 +34,8 @@ - PurgingPanda (t3ch0wn3r@gmail.com) - Kai Curtis (morecode@kcurtis.com) - Omri Litov (omrilitov@gmail.com) +- Alexey Romanov (romanalexey@gmail.com) +- Karan Thakkar (karanjthakkar@gmail.com) +- Nuno Campos (nuno.campos@me.com) #### Generated by bin/update-authors.sh. diff --git a/CHANGELOG.md b/CHANGELOG.md index 20bb4ee8..7c9e33f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,24 @@ # WebTorrent Desktop Version History -## UNRELEASED +## v0.18.0 + +### Added +- Add a new "Transfers" menu for pausing or resuming all torrents (#1027) ### Changed -- Update Electron to 1.4.3 +- Update Electron to 1.4.15 - Windows 32-bit: App can use 4GB of memory instead of just 2GB + - Fix "Portable App" writing crash reports to "%APPDATA%\Temp" (Windows) +- Updated WebTorrent engine to 0.98.5 + - Fix issue where http web seeds would sometimes stall + - Don't send 'completed' event to tracker again if torrent is already complete + - Add more peer ID entropy + - Set user-agent header for tracker http requests + +### Fixed +- Fix paste shortcut in tracker list on Create Torrent page (#1112) +- Auto-focus the 'OK' button in modal dialogs (#1058) +- Fix formatting issue in the speed stats on the Player page (#1039) ## v0.17.2 - 2016-10-10 @@ -53,7 +67,7 @@ ## v0.16.0 - 2016-09-18 ### Added -- **Windows 64-bit support!** ([#931](https://github.com/feross/webtorrent-desktop/pull/931)) +- **Windows 64-bit support!** ([#931](https://github.com/webtorrent/webtorrent-desktop/pull/931)) - Existing 32-bit users will update to 64-bit automatically in next release - 64-bit reduces likelihood of out-of-memory errors by increasing the address space @@ -113,16 +127,13 @@ ## v0.12.0 - 2016-08-23 ### Added - - Custom external media player - Linux: add system-wide launcher and icons for Debian, including Ubuntu ### Changed - - Telemetry improvements: redact stacktraces, log app version ### Fixed - - Fix playback and download of default torrents ("missing path" error) (#804) - Fix Delete Torrent + Data for newly added magnet links - Fix jumpToTime error (#804) @@ -135,13 +146,11 @@ - Check for missing default download path and torrent folders on start up (#776) ### Changed - - Do not automatically set WebTorrent as the default handler for torrents (#771) - Torrents can only be created from the home screen (#770) - Update Electron to 1.3.3 (#772) ### Fixed - - Allow modifying the default tracker list on the Create Torrent page (#775) - Prevent opening multiple stacked Preference windows or Create Torrent windows (#770) - Windows: Player window auto-resize does not match video aspect ratio (#565) @@ -150,13 +159,11 @@ ## v0.10.0 - 2016-08-05 ### Added - - Drag-and-drop magnet links (selected text) is now supported (#284) - Windows: Add "User Tasks" shortcuts to app icon in Start Menu (#114) - Linux: Show badge count for completed torrent downloads ### Changed - - Change WebTorrent Desktop peer ID prefix to 'WD' to distinguish from WebTorrent in the browser, 'WW' (#688) - Switch UI to React to improve UI rendering speed (#729) - The primary bottleneck was actually `hyperx`, not `virtual-dom`. @@ -173,7 +180,6 @@ - Location history abstraction released independently as [`location-history`](https://www.npmjs.com/package/location-history) ### Fixed - - When streaming to VLC, set VLC window title to torrent file name (#746) - Fix "Cannot read property 'numPiecesPresent' of undefined" exception (#695) - Fix rare case where config file could not be completely written (#733) @@ -181,35 +187,29 @@ ## v0.9.0 - 2016-07-20 ### Added - - Save selected subtitles - Ask for confirmation before deleting torrents - Support Debian Jessie ### Changed - - Only send telemetry in production - Clean up the code. Split main.js, refactor lots of things ### Fixed - - Fix state.playing.jumpToTime behavior - Remove torrent file and poster image when deleting a torrent ## v0.8.1 - 2016-06-24 ### Added - - New URI handler: stream-magnet ### Fixed - - DLNA crashing bug ## v0.8.0 - 2016-06-23 ### Added - - Cast menu: choose which Chromecast, Airplay, or DLNA device you want to use - Telemetry: send basic data, plus stats on how often the play button works - Make posters from jpeg files, not just jpg @@ -217,17 +217,14 @@ - Windows thumbnail bar with a play/pause button ### Changed - - Nicer modal styles ### Fixed - - Windows tray icon now stays in the right state ## v0.7.2 - 2016-06-02 ### Fixed - - Fix exception that affects users upgrading from v0.5.1 or older - Ensure `state.saved.prefs` configuration exists - Fix window title on "About WebTorrent" window @@ -235,23 +232,19 @@ ## v0.7.1 - 2016-06-02 ### Changed - - Change "Step Forward" keyboard shortcut to `Alt+Left` (Windows) - Change "Step Backward" keyboard shortcut to to `Alt+Right` (Windows) ### Fixed - - First time startup bug -- invalid torrent/poster paths ## v0.7.0 - 2016-06-02 ### Added - - Improved AirPlay support -- using the new [`airplayer`](https://www.npmjs.com/package/airplayer) package - Remember volume setting in player, for as long as the app is open ### Changed - - Add (+) button now also accepts non .torrent files and creates a torrent from those files - Show prompt text in title bar for open dialogs (OS X) @@ -261,7 +254,6 @@ - Fix crash reporter not working (Windows) ### Fixed - - Re-enable WebRTC (web peers)! (OS X, Windows) - Windows support was disabled in v0.6.1 to work around a bug in Electron - OS X support was disabled in v0.4.0 to work around a 100% CPU bug @@ -272,7 +264,6 @@ - Fix torrent loading message UI misalignment ### Known issues - - When upgrading to WebTorrent Desktop v0.7.0, some torrent metadata (file list, selected files, whether torrent is streamable) will be cleared. Just start the torrent to re-populate the metadata. @@ -280,7 +271,6 @@ ## v0.6.1 - 2016-05-26 ### Fixed - - Disable WebRTC to work around Electron crash (Windows) - Will be re-enabled in the next version of WebTorrent, which will be based on the next version of Electron, where the bug is fixed. @@ -292,7 +282,6 @@ ## v0.6.0 - 2016-05-24 ### Added - - Added Preferences page to set Download folder - Save video position, resume playback from saved position - Add additional video player keyboard shortcuts (#275) @@ -302,7 +291,6 @@ - Add announcement feature ### Changed - - Nicer player UI - Reduce startup jank, improve startup time (#568) - Cleanup unsupported codec detection (#569, #570) @@ -310,7 +298,6 @@ - Improve subtitle positioning (#551) ### Fixed - - Fix Uncaught TypeError: Cannot read property 'update' of undefined (#567) - Fix bugs in LocationHistory - When player is active, and magnet link is pasted, go back to list @@ -321,23 +308,19 @@ ## v0.5.1 - 2016-05-18 ### Fixed - - Fix auto-updater (OS X, Windows). ## v0.5.0 - 2016-05-17 ### Added - - Select/deselect individual files to torrent. - Automatically include subtitle files (.srt, .vtt) from torrent in the subtitles menu. - "Add Subtitle File..." menu item. ### Changed - - When manually adding subtitle track(s), always switch to the new track. ### Fixed - - Magnet links throw exception on app launch. (OS X) - Multi-file torrents would not seed in-place, were copied to Downloads folder. - Missing 'About WebTorrent' menu item. (Windows) @@ -346,7 +329,6 @@ ## v0.4.0 - 2016-05-13 ### Added - - Better Windows support! - Windows 32-bit build. - Windows Portable App build. @@ -369,7 +351,6 @@ - New default torrent on first launch: The WIRED CD. ### Changed - - Improve app startup time by 40%. - UI tweaks: Reduce font size, reduce torrent list item height. - Add Playback menu for playback-related functionality. @@ -380,7 +361,6 @@ - Remove "Add Fake Airplay/Chromecast" menu items. ### Fixed - - Disable WebRTC to fix 100% CPU usage/crashes caused by Chromium issue. This is temporary. (OS X) - When fullscreen, make controls use the full window. (OS X) @@ -405,24 +385,20 @@ to this release! ## v0.3.3 - 2016-04-07 ### Fixed - - App icon was incorrect (OS X) ## v0.3.2 - 2016-04-07 ### Added - - Register WebTorrent as default handler for magnet links (OS X) ### Changed - - Faster startup time (50ms) - Update Electron to 0.37.5 - Remove the white flash when loading pages and resizing the window - Fix crash when sending IPC messages ### Fixed - - Fix installation bugs with .deb file (Linux) - Pause audio reliably when closing the window - Enforce minimimum window size when resizing player (for audio-only .mov files, which are 0x0) @@ -430,17 +406,14 @@ to this release! ## v0.3.1 - 2016-04-06 ### Added - - Add crash reporter to torrent engine process ### Fixed - - Fix cast screen background: cover, don't tile ## v0.3.0 - 2016-04-06 ### Added - - **Ubuntu/Debian support!** (.deb installer) - **DLNA streaming support** - Add "File > Quit" menu item (Linux) @@ -448,14 +421,12 @@ to this release! - Crash reporting ### Changed - - On startup, do not re-verify files when timestamps are unchanged - Moved torrent engine to an independent process, for better UI performance - Removed media queries (UI resizing based on window width) - Improved Chromecast icon, when connected ### Fixed - - "Download Complete" notification shows consistently - Create new torrents and seed them without copying to temporary folder - Clicking the "Download Complete" notification will always activate app @@ -474,7 +445,6 @@ Thanks to @dcposch, @grunjol, and @feross for contributing to this release. ## v0.2.0 - 2016-03-29 ### Added - - Minimise to tray (Windows, Linux) - Show spinner and download speed when player is stalled waiting for data - Highlight window on drag-and-drop @@ -483,12 +453,10 @@ Thanks to @dcposch, @grunjol, and @feross for contributing to this release. Linux users need to download new versions manually. ### Changed - - Renamed WebTorrent.app to WebTorrent Desktop - Add Cosmos Laundromat as a default torrent ### Fixed - - Only capture media keys when player is active - Update WebTorrent to 0.88.1 for performance improvements - When seeding, do not proactively connect to new peers @@ -548,7 +516,7 @@ Windows, and Linux. For now, we're only releasing binaries for OS X. WebTorrent Desktop is in ALPHA and under very active development – expect lots more polish in the coming weeks! If you know JavaScript and want to help us out, there's -[lots to do](https://github.com/feross/webtorrent-desktop/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+contribution%22)! +[lots to do](https://github.com/webtorrent/webtorrent-desktop/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+contribution%22)! ### Features diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 048ab258..16b6118c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,7 +24,7 @@ and to avoid style arguments. `npm test` runs `standard` automatically, so you d to! [standard-image]: https://cdn.rawgit.com/feross/standard/master/badge.svg -[standard-url]: https://github.com/feross/standard +[standard-url]: https://standardjs.com ## Project Governance @@ -36,7 +36,7 @@ standard guarded open source project. There are a few basic ground-rules for contributors: -1. **No `--force` pushes** or modifying the Git history in any way. +1. **No `--force` pushes to master** or modifying history in any way. Rebasing and force pushing your own PR branch is fine. 2. **Non-master branches** should be used for ongoing work. 3. **Significant modifications** like API changes should be subject to a **pull request** to solicit feedback from other contributors. @@ -74,6 +74,99 @@ By making a contribution to this project, I certify that: including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. +## Release Procedure + +### 1. Create a new version + +- Update `AUTHORS` + + ``` + npm run update-authors + ``` + + Commit if necessary. The commit message should be "authors". + +- Write the changelog + + You can use `git log --oneline ..HEAD` to get a list of changes. + + Summarize them concisely in `CHANGELOG.md`. The commit message should be "changelog". + +- Update the version + + ``` + npm version [major|minor|patch] + ``` + + This creates both a commit and a git tag. + +- Make a PR + + Once the PR is reviewed, merge it: + + ``` + git push origin :master + ``` + + This makes it so that the commit hash on master matches the commit hash of the version tag. + + Finally, run: + + ``` + git push --tags + ``` + +### 2. Create the release binaries + +- On a Mac: + + ``` + npm run package -- darwin --sign + npm run package -- linux --sign + ``` + +- On Windows, or in a Windows VM: + + ``` + npm run package -- win32 --sign + ``` + +- Then, upload the release binaries to Github: + + ``` + npm run gh-release + ``` + + Follow the URL to a newly created Github release page. Manually upload the binaries from + `webtorrent-desktop/dist/`. Open the previous release in another tab, and make sure that you + are uploading the same set of files, no more, no less. + +### 3. Test it + +**This is the most important part.** + + - Manually download the binaries for each platform from Github. + + **Do not use your locally built binaries.** Modern OSs treat executables differently if they've + been downloaded, even though the files are byte for byte identical. This ensures that the + codesigning worked and is valid. + +- Smoke test WebTorrent Desktop on each platform. + + See Smoke Tests below for details. Open DevTools + on Windows and Mac, and ensure that the auto updater is running. If the auto updater does not + run, users will successfully auto update to this new version, and then be stuck there forever. + +### 4. Ship it + +- Update the website + + Create a pull request in [webtorrent.io](https://github.com/webtorrent/webtorrent.io). Update + `config.js`, updating the desktop app version. + + As soon as this PR is merged, Jenkins will automatically redeploy the WebTorrent website, and + hundreds of thousands of users around the world will start auto updating. **Merge with care.** + ## Smoke Tests Before a release, check that the following basic use cases work correctly: diff --git a/README.md b/README.md index 8ecc9d7d..26a517ce 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@


- WebTorrent + + WebTorrent +
WebTorrent Desktop
@@ -10,16 +12,17 @@

The streaming torrent app. For Mac, Windows, and Linux.

- Gitter - Travis - Release + gitter + github release + travis + Standard - JavaScript Style Guide

## Install Download the latest version of WebTorrent Desktop from [the official website](https://webtorrent.io/desktop/) or the -[GitHub releases](https://github.com/feross/webtorrent-desktop/releases) page. +[GitHub releases](https://github.com/webtorrent/webtorrent-desktop/releases) page. **WebTorrent Desktop** is under very active development. You can try out the current (unstable) development version by cloning the Git repo. See the @@ -37,7 +40,7 @@ instructions below in the ["How to Contribute"](#how-to-contribute) section. ### Get the code ``` -$ git clone https://github.com/feross/webtorrent-desktop.git +$ git clone https://github.com/webtorrent/webtorrent-desktop.git $ cd webtorrent-desktop $ npm install ``` @@ -68,19 +71,25 @@ $ npm test $ npm run test-integration ``` -The integration tests use Spectron and Tape. They click through the app, taking screenshots and comparing each one to a reference. Why screenshots? +The integration tests use Spectron and Tape. They click through the app, taking screenshots and +comparing each one to a reference. Why screenshots? * Ad-hoc checking makes the tests a lot more work to write -* Even diffing the whole HTML is not as thorough as screenshot diffing. For example, it wouldn't catch an bug where hitting ESC from a video doesn't correctly restore window size. +* Even diffing the whole HTML is not as thorough as screenshot diffing. For example, it wouldn't + catch an bug where hitting ESC from a video doesn't correctly restore window size. * Chrome's own integration tests use screenshot diffing iirc -* Small UI changes will break a few tests, but the fix is as easy as deleting the offending screenshots and running the tests, which will recreate them with the new look. -* The resulting Github PR will then show, pixel by pixel, the exact UI changes that were made! Ses https://github.com/blog/817-behold-image-view-modes +* Small UI changes will break a few tests, but the fix is as easy as deleting the offending + screenshots and running the tests, which will recreate them with the new look. +* The resulting Github PR will then show, pixel by pixel, the exact UI changes that were made! See + https://github.com/blog/817-behold-image-view-modes -For MacOS, you'll need a Retina screen for the integration tests to pass. Your screen should have the same resolution as a 2016 12" Macbook. +For MacOS, you'll need a Retina screen for the integration tests to pass. Your screen should have +the same resolution as a 2016 12" Macbook. For Windows, you'll need Windows 10 with a 1366x768 screen. -When running integration tests, keep the mouse on the edge of the screen and don't touch the mouse or keyboard while the tests are running. +When running integration tests, keep the mouse on the edge of the screen and don't touch the mouse +or keyboard while the tests are running. ### Package the app @@ -110,7 +119,7 @@ The following optional arguments are available: - `all` - All platforms (default) Note: Even with the `--package` option, the auto-update files (.nupkg for Windows, -*-darwin.zip for Mac) will always be produced. +-darwin.zip for Mac) will always be produced. #### Windows build notes @@ -145,10 +154,6 @@ Time out? Show a missing codec error? The app never sends any personally identifying information, nor does it track which torrents you add. -### Code Style - -[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) - ## License MIT. Copyright (c) [WebTorrent, LLC](https://webtorrent.io). diff --git a/bin/clean.js b/bin/clean.js index c86ff019..d094dc16 100755 --- a/bin/clean.js +++ b/bin/clean.js @@ -25,7 +25,7 @@ let tmpPath try { tmpPath = path.join(fs.statSync('/tmp') && '/tmp', 'webtorrent') } catch (err) { - tmpPath = path.join(os.tmpDir(), 'webtorrent') + tmpPath = path.join(os.tmpdir(), 'webtorrent') } rimraf.sync(tmpPath) diff --git a/bin/package.js b/bin/package.js index 65b12260..9f59a193 100755 --- a/bin/package.js +++ b/bin/package.js @@ -21,6 +21,7 @@ const pkg = require('../package.json') const BUILD_NAME = config.APP_NAME + '-v' + config.APP_VERSION const BUILD_PATH = path.join(config.ROOT_PATH, 'build') const DIST_PATH = path.join(config.ROOT_PATH, 'dist') +const NODE_MODULES_PATH = path.join(config.ROOT_PATH, 'node_modules') const argv = minimist(process.argv.slice(2), { boolean: [ @@ -36,6 +37,12 @@ const argv = minimist(process.argv.slice(2), { }) function build () { + console.log('Reinstalling node_modules...') + rimraf.sync(NODE_MODULES_PATH) + cp.execSync('npm install', { stdio: 'inherit' }) + cp.execSync('npm dedupe', { stdio: 'inherit' }) + + console.log('Nuking dist/ and build/...') rimraf.sync(DIST_PATH) rimraf.sync(BUILD_PATH) @@ -104,8 +111,8 @@ const all = { // "devDependencies" before starting to package the app. prune: true, - // The Electron version with which the app is built (without the leading 'v') - version: require('electron/package.json').version + // The Electron version that the app is built with (without the leading 'v') + electronVersion: require('electron/package.json').version } const darwin = { diff --git a/bin/release-_post.sh b/bin/release-_post.sh deleted file mode 100755 index 71961623..00000000 --- a/bin/release-_post.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -npm run update-authors -git diff --exit-code -npm run package -- --sign -git push -git push --tags -npm run gh-release diff --git a/bin/release-_pre.sh b/bin/release-_pre.sh deleted file mode 100755 index 230d66a6..00000000 --- a/bin/release-_pre.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -set -e - -git pull -rm -rf node_modules/ -npm install -npm dedupe -npm test diff --git a/bin/release-major.sh b/bin/release-major.sh deleted file mode 100755 index 85efc1d2..00000000 --- a/bin/release-major.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -set -e -BIN=`dirname $0` - -$BIN/release-_pre.sh -npm version major -$BIN/release-_post.sh diff --git a/bin/release-minor.sh b/bin/release-minor.sh deleted file mode 100755 index 8c1cbd36..00000000 --- a/bin/release-minor.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -set -e -BIN=`dirname $0` - -$BIN/release-_pre.sh -npm version minor -$BIN/release-_post.sh diff --git a/bin/release-patch.sh b/bin/release-patch.sh deleted file mode 100755 index 62fd7fcc..00000000 --- a/bin/release-patch.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -set -e -BIN=`dirname $0` - -$BIN/release-_pre.sh -npm version patch -$BIN/release-_post.sh diff --git a/package.json b/package.json index 2512cc34..a32de078 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { "name": "webtorrent-desktop", "description": "WebTorrent, the streaming torrent client. For Mac, Windows, and Linux.", - "version": "0.17.2", + "version": "0.18.0", "author": { "name": "WebTorrent, LLC", "email": "feross@webtorrent.io", "url": "https://webtorrent.io" }, "bugs": { - "url": "https://github.com/feross/webtorrent-desktop/issues" + "url": "https://github.com/webtorrent/webtorrent-desktop/issues" }, "dependencies": { "airplayer": "^2.0.0", @@ -30,7 +30,7 @@ "iso-639-1": "^1.2.1", "languagedetect": "^1.1.1", "location-history": "^1.0.0", - "material-ui": "^0.16.0", + "material-ui": "^0.17.0", "mkdirp": "^0.5.1", "ms": "^0.7.2", "musicmetadata": "^2.0.2", @@ -38,8 +38,8 @@ "node-notifier": "^5.0.2", "parse-torrent": "^5.7.3", "prettier-bytes": "^1.0.1", - "react": "^15.2.1", - "react-dom": "^15.2.1", + "react": "^15.4.2", + "react-dom": "^15.4.2", "react-tap-event-plugin": "^2.0.1", "rimraf": "^2.5.2", "run-parallel": "^1.1.6", @@ -54,16 +54,16 @@ "zero-fill": "^2.2.3" }, "devDependencies": { - "buble": "^0.14.0", + "buble": "^0.15.2", "cross-zip": "^2.0.1", "depcheck": "^0.6.4", - "electron": "1.4.3", - "electron-osx-sign": "^0.3.0", - "electron-packager": "^8.0.0", - "electron-winstaller": "^2.3.0", + "electron": "1.6.0", + "electron-osx-sign": "0.4.3", + "electron-packager": "~8.5.1", + "electron-winstaller": "~2.5.2", "gh-release": "^2.0.3", "minimist": "^1.2.0", - "nobin-debian-installer": "^0.0.10", + "nobin-debian-installer": "0.0.10", "nodemon": "^1.10.2", "open": "0.0.5", "plist": "^2.0.1", @@ -97,7 +97,7 @@ "productName": "WebTorrent", "repository": { "type": "git", - "url": "git://github.com/feross/webtorrent-desktop.git" + "url": "git://github.com/webtorrent/webtorrent-desktop.git" }, "scripts": { "build": "buble src --output build", @@ -107,7 +107,7 @@ "package": "node ./bin/package.js", "prepublish": "npm run build", "start": "npm run build && electron .", - "test": "standard && depcheck --ignores=buble,lodash.merge,nodemon,gh-release --ignore-dirs=build,dist && node ./bin/extra-lint.js", + "test": "standard && depcheck --ignores=buble,nodemon,gh-release --ignore-dirs=build,dist && node ./bin/extra-lint.js", "test-integration": "npm run build && node ./test", "update-authors": "./bin/update-authors.sh", "watch": "nodemon --exec \"npm run start\" --ext js,css --ignore build/ --ignore dist/" diff --git a/src/config.js b/src/config.js index 8751e54b..c3eb1048 100644 --- a/src/config.js +++ b/src/config.js @@ -25,7 +25,7 @@ const exports = module.exports = { CRASH_REPORT_URL: 'https://webtorrent.io/desktop/crash-report', TELEMETRY_URL: 'https://webtorrent.io/desktop/telemetry', - APP_COPYRIGHT: 'Copyright © 2014-2016 ' + APP_TEAM, + APP_COPYRIGHT: 'Copyright © 2014-2017 ' + APP_TEAM, APP_FILE_ICON: path.join(__dirname, '..', 'static', 'WebTorrentFile'), APP_ICON: path.join(__dirname, '..', 'static', 'WebTorrent'), APP_NAME: APP_NAME, @@ -72,9 +72,9 @@ const exports = module.exports = { DEFAULT_DOWNLOAD_PATH: getDefaultDownloadPath(), - GITHUB_URL: 'https://github.com/feross/webtorrent-desktop', - GITHUB_URL_ISSUES: 'https://github.com/feross/webtorrent-desktop/issues', - GITHUB_URL_RAW: 'https://raw.githubusercontent.com/feross/webtorrent-desktop/master', + GITHUB_URL: 'https://github.com/webtorrent/webtorrent-desktop', + GITHUB_URL_ISSUES: 'https://github.com/webtorrent/webtorrent-desktop/issues', + GITHUB_URL_RAW: 'https://raw.githubusercontent.com/webtorrent/webtorrent-desktop/master', HOME_PAGE_URL: 'https://webtorrent.io', diff --git a/src/main/dock.js b/src/main/dock.js index c882f1a0..1eaabd7d 100644 --- a/src/main/dock.js +++ b/src/main/dock.js @@ -32,7 +32,7 @@ function downloadFinished (path) { */ function setBadge (count) { if (process.platform === 'darwin' || - process.platform === 'linux' && app.isUnityRunning()) { + (process.platform === 'linux' && app.isUnityRunning())) { log(`setBadge: ${count}`) app.setBadgeCount(Number(count)) } diff --git a/src/main/external-player.js b/src/main/external-player.js index 45f655e2..39b80061 100644 --- a/src/main/external-player.js +++ b/src/main/external-player.js @@ -17,8 +17,8 @@ let proc = null function checkInstall (playerPath, cb) { // check for VLC if external player has not been specified by the user // otherwise assume the player is installed - if (playerPath == null) return vlcCommand((err) => cb(!err)) - process.nextTick(() => cb(true)) + if (playerPath == null) return vlcCommand(cb) + process.nextTick(() => cb(null)) } function spawn (playerPath, url, title) { diff --git a/src/main/index.js b/src/main/index.js index c61aea87..357b0805 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -227,7 +227,7 @@ function processArgv (argv) { // Ignore hidden argument, already being handled } else if (arg.startsWith('-psn')) { // Ignore Mac launchd "process serial number" argument - // Issue: https://github.com/feross/webtorrent-desktop/issues/214 + // Issue: https://github.com/webtorrent/webtorrent-desktop/issues/214 } else if (arg.startsWith('--')) { // Ignore Spectron flags } else if (arg === 'data:,') { diff --git a/src/main/ipc.js b/src/main/ipc.js index 6728ff3d..e6110626 100644 --- a/src/main/ipc.js +++ b/src/main/ipc.js @@ -166,8 +166,8 @@ function init () { ipc.on('checkForExternalPlayer', function (e, path) { const externalPlayer = require('./external-player') - externalPlayer.checkInstall(path, function (isInstalled) { - windows.main.send('checkForExternalPlayer', isInstalled) + externalPlayer.checkInstall(path, function (err) { + windows.main.send('checkForExternalPlayer', !err) }) }) diff --git a/src/main/menu.js b/src/main/menu.js index df400891..226c6853 100644 --- a/src/main/menu.js +++ b/src/main/menu.js @@ -288,9 +288,6 @@ function getMenuTemplate () { label: 'Pause All', click: () => windows.main.dispatch('pauseAllTorrents') }, - { - type: 'separator' - }, { label: 'Resume All', click: () => windows.main.dispatch('resumeAllTorrents') @@ -330,7 +327,7 @@ function getMenuTemplate () { ] if (process.platform === 'darwin') { - // Add WebTorrent app menu (Mac) + // WebTorrent menu (Mac) template.unshift({ label: config.APP_NAME, submenu: [ @@ -373,8 +370,26 @@ function getMenuTemplate () { ] }) - // Add Window menu (Mac) - template.splice(5, 0, { + // Edit menu (Mac) + template[2].submenu.push( + { + type: 'separator' + }, + { + label: 'Speech', + submenu: [ + { + role: 'startspeaking' + }, + { + role: 'stopspeaking' + } + ] + } + ) + + // Window menu (Mac) + template.splice(6, 0, { role: 'window', submenu: [ { @@ -414,7 +429,7 @@ function getMenuTemplate () { }) // Help menu (Windows, Linux) - template[4].submenu.push( + template[5].submenu.push( { type: 'separator' }, diff --git a/src/main/tray.js b/src/main/tray.js index e0395723..889d1c86 100644 --- a/src/main/tray.js +++ b/src/main/tray.js @@ -36,8 +36,8 @@ function setWindowFocus (flag) { } function initLinux () { - checkLinuxTraySupport(function (supportsTray) { - if (supportsTray) createTray() + checkLinuxTraySupport(function (err) { + if (!err) createTray() }) } @@ -55,10 +55,14 @@ function checkLinuxTraySupport (cb) { // libappindicator1. If WebTorrent was installed from the deb file, we should // always have it. If it was installed from the zip file, we might not. cp.exec('dpkg --get-selections libappindicator1', function (err, stdout) { - if (err) return cb(false) + if (err) return cb(err) // Unfortunately there's no cleaner way, as far as I can tell, to check // whether a debian package is installed: - cb(stdout.endsWith('\tinstall\n')) + if (stdout.endsWith('\tinstall\n')) { + cb(null) + } else { + cb(new Error('debian package not installed')) + } }) } diff --git a/src/main/windows/main.js b/src/main/windows/main.js index 713effaf..6f1b3cfe 100644 --- a/src/main/windows/main.js +++ b/src/main/windows/main.js @@ -32,16 +32,17 @@ function init (state, options, decorate) { let windowOptions = { backgroundColor: '#282828', + backgroundThrottling: false, // do not throttle animations/timers when page is background darkTheme: true, // Forces dark theme (GTK+3) + height: initialBounds.height, icon: getIconPath(), // Window icon (Windows, Linux) - minWidth: config.WINDOW_MIN_WIDTH, minHeight: config.WINDOW_MIN_HEIGHT, + minWidth: config.WINDOW_MIN_WIDTH, + show: false, title: config.APP_WINDOW_TITLE, titleBarStyle: 'hidden-inset', // Hide title bar (Mac) useContentSize: true, // Specify web page size without OS chrome - show: false, width: initialBounds.width, - height: initialBounds.height, x: initialBounds.x, y: initialBounds.y } @@ -168,8 +169,8 @@ function setBounds (bounds, maximize) { if (bounds.x === null && bounds.y === null) { // X and Y not specified? By default, center on current screen const scr = electron.screen.getDisplayMatching(main.win.getBounds()) - bounds.x = Math.round(scr.bounds.x + scr.bounds.width / 2 - bounds.width / 2) - bounds.y = Math.round(scr.bounds.y + scr.bounds.height / 2 - bounds.height / 2) + bounds.x = Math.round(scr.bounds.x + (scr.bounds.width / 2) - (bounds.width / 2)) + bounds.y = Math.round(scr.bounds.y + (scr.bounds.height / 2) - (bounds.height / 2)) log('setBounds: centered to ' + JSON.stringify(bounds)) } // Resize the window's content area (so window border doesn't need to be taken diff --git a/src/main/windows/webtorrent.js b/src/main/windows/webtorrent.js index fb1d1d83..ca2d8f3e 100644 --- a/src/main/windows/webtorrent.js +++ b/src/main/windows/webtorrent.js @@ -13,6 +13,7 @@ const config = require('../../config') function init (decorate) { let options = { backgroundColor: '#1E1E1E', + backgroundThrottling: false, // do not throttle animations/timers when page is background center: true, fullscreen: false, fullscreenable: false, diff --git a/src/renderer/components/update-available-modal.js b/src/renderer/components/update-available-modal.js index 03c84605..f610dcb5 100644 --- a/src/renderer/components/update-available-modal.js +++ b/src/renderer/components/update-available-modal.js @@ -23,7 +23,8 @@ module.exports = class UpdateAvailableModal extends React.Component { ) function handleShow () { - electron.shell.openExternal('https://github.com/feross/webtorrent-desktop/releases') + // TODO: use the GitHub urls from config.js + electron.shell.openExternal('https://github.com/webtorrent/webtorrent-desktop/releases') dispatch('exitModal') } diff --git a/src/renderer/controllers/playback-controller.js b/src/renderer/controllers/playback-controller.js index 7acfb90e..8288baa3 100644 --- a/src/renderer/controllers/playback-controller.js +++ b/src/renderer/controllers/playback-controller.js @@ -27,6 +27,8 @@ module.exports = class PlaybackController { // * Stream, if not already fully downloaded // * If no file index is provided, restore the most recently viewed file or autoplay the first playFile (infoHash, index /* optional */) { + this.pauseActiveTorrents(infoHash) + const state = this.state if (state.location.url() === 'player') { this.updatePlayer(infoHash, index, false, (err) => { @@ -84,6 +86,17 @@ module.exports = class PlaybackController { else this.pause() } + pauseActiveTorrents (infoHash) { + // Playback Priority: pause all active torrents if needed. + if (!this.state.saved.prefs.highestPlaybackPriority) return + + // Do not pause active torrents if playing a fully downloaded torrent. + const torrentSummary = TorrentSummary.getByKey(this.state, infoHash) + if (torrentSummary.status === 'seeding') return + + dispatch('prioritizeTorrent', infoHash) + } + // Play next file in list (if any) nextTrack () { const state = this.state @@ -341,6 +354,11 @@ module.exports = class PlaybackController { ipcRenderer.send('onPlayerClose') + // Playback Priority: resume previously paused downloads. + if (this.state.saved.prefs.highestPlaybackPriority) { + dispatch('resumePausedTorrents') + } + this.update() } } diff --git a/src/renderer/controllers/torrent-list-controller.js b/src/renderer/controllers/torrent-list-controller.js index aabf1522..12cee063 100644 --- a/src/renderer/controllers/torrent-list-controller.js +++ b/src/renderer/controllers/torrent-list-controller.js @@ -121,11 +121,10 @@ module.exports = class TorrentListController { torrentSummary.status = 'new' this.startTorrentingSummary(torrentSummary.torrentKey) sound.play('ENABLE') - } else { - torrentSummary.status = 'paused' - ipcRenderer.send('wt-stop-torrenting', torrentSummary.infoHash) - sound.play('DISABLE') + return } + + this.pauseTorrent(torrentSummary, true) } pauseAllTorrents () { @@ -149,6 +148,40 @@ module.exports = class TorrentListController { sound.play('ENABLE') } + pauseTorrent (torrentSummary, playSound) { + torrentSummary.status = 'paused' + ipcRenderer.send('wt-stop-torrenting', torrentSummary.infoHash) + + if (playSound) sound.play('DISABLE') + } + + 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 + + // Pause torrent without playing sounds. + this.pauseTorrent(torrent, false) + + this.state.saved.torrentsToResume.push(torrent.infoHash) + }) + + console.log('Playback Priority: paused torrents: ', this.state.saved.torrentsToResume) + } + + resumePausedTorrents () { + console.log('Playback Priority: resuming paused torrents') + this.state.saved.torrentsToResume.map((infoHash) => { + this.toggleTorrent(infoHash) + }) + + // reset paused torrents + this.state.saved.torrentsToResume = [] + } + toggleTorrentFile (infoHash, index) { const torrentSummary = TorrentSummary.getByKey(this.state, infoHash) torrentSummary.selections[index] = !torrentSummary.selections[index] @@ -281,7 +314,7 @@ module.exports = class TorrentListController { // Recursively finds {name, path, size} for all files in a folder // Calls `cb` on success, calls `onError` on failure -function findFilesRecursive (paths, cb) { +function findFilesRecursive (paths, cb_) { if (paths.length > 1) { let numComplete = 0 let ret = [] @@ -290,7 +323,7 @@ function findFilesRecursive (paths, cb) { ret.push(...fileObjs) if (++numComplete === paths.length) { ret.sort((a, b) => a.path < b.path ? -1 : a.path > b.path) - cb(ret) + cb_(ret) } }) }) @@ -304,7 +337,7 @@ function findFilesRecursive (paths, cb) { // Files: return name, path, and size if (!stat.isDirectory()) { const filePath = fileOrFolder - return cb([{ + return cb_([{ name: path.basename(filePath), path: filePath, size: stat.size @@ -316,7 +349,7 @@ function findFilesRecursive (paths, cb) { fs.readdir(folderPath, function (err, fileNames) { if (err) return dispatch('error', err) const paths = fileNames.map((fileName) => path.join(folderPath, fileName)) - findFilesRecursive(paths, cb) + findFilesRecursive(paths, cb_) }) }) } diff --git a/src/renderer/lib/migrations.js b/src/renderer/lib/migrations.js index 2fad6b13..ece7125d 100644 --- a/src/renderer/lib/migrations.js +++ b/src/renderer/lib/migrations.js @@ -78,7 +78,7 @@ function migrate_0_7_0 (saved) { } // Fix exception caused by incorrect file ordering. - // https://github.com/feross/webtorrent-desktop/pull/604#issuecomment-222805214 + // https://github.com/webtorrent/webtorrent-desktop/pull/604#issuecomment-222805214 delete ts.defaultPlayFileIndex delete ts.files delete ts.selections @@ -111,7 +111,7 @@ function migrate_0_12_0 (saved) { // Undo a terrible bug where clicking Play on a default torrent on a fresh // install results in a "path missing" error - // See https://github.com/feross/webtorrent-desktop/pull/806 + // See https://github.com/webtorrent/webtorrent-desktop/pull/806 const defaultTorrentFiles = [ '6a9759bffd5c0af65319979fb7832189f4f3c35d.torrent', '88594aaacbde40ef3e2510c47374ec0aa396c08e.torrent', @@ -153,7 +153,7 @@ function migrate_0_17_0 (saved) { function migrate_0_17_2 (saved) { // Remove the trailing dot (.) from the Wired CD torrent name, since // folders/files that end in a trailing dot (.) or space are not deletable from - // Windows Explorer. See: https://github.com/feross/webtorrent-desktop/issues/905 + // Windows Explorer. See: https://github.com/webtorrent/webtorrent-desktop/issues/905 const cpFile = require('cp-file') const rimraf = require('rimraf') diff --git a/src/renderer/lib/state.js b/src/renderer/lib/state.js index 1bd9bcd3..6a909d96 100644 --- a/src/renderer/lib/state.js +++ b/src/renderer/lib/state.js @@ -124,6 +124,7 @@ function setupStateSaved (cb) { startup: false }, torrents: config.DEFAULT_TORRENTS.map(createTorrentObject), + torrentsToResume: [], version: config.APP_VERSION /* make sure we can upgrade gracefully later */ } diff --git a/src/renderer/lib/torrent-player.js b/src/renderer/lib/torrent-player.js index 1be19e32..6a77d25b 100644 --- a/src/renderer/lib/torrent-player.js +++ b/src/renderer/lib/torrent-player.js @@ -37,6 +37,7 @@ function isAudio (file) { '.mp3', '.ogg', '.wav', + '.flac', '.m4a' ].includes(getFileExtension(file)) } diff --git a/src/renderer/main.js b/src/renderer/main.js index 8afe2ef6..7acb24f5 100644 --- a/src/renderer/main.js +++ b/src/renderer/main.js @@ -24,6 +24,7 @@ const State = require('./lib/state') State.load(onState) const createGetter = require('fn-getter') +const debounce = require('debounce') const dragDrop = require('drag-drop') const electron = require('electron') const fs = require('fs') @@ -145,6 +146,18 @@ function onState (err, _state) { // ...same thing if you paste a torrent document.addEventListener('paste', onPaste) + const debouncedFullscreenToggle = debounce(function () { + dispatch('toggleFullScreen') + }, 1000, true) + + document.addEventListener('wheel', function (event) { + // ctrlKey detects pinch to zoom, http://crbug.com/289887 + if (event.ctrlKey) { + event.preventDefault() + debouncedFullscreenToggle() + } + }) + // ...focus and blur. Needed to show correct dock icon text ('badge') in OSX window.addEventListener('focus', onFocus) window.addEventListener('blur', onBlur) @@ -241,6 +254,8 @@ const dispatchHandlers = { controllers.torrentList().startTorrentingSummary(torrentKey), 'saveTorrentFileAs': (torrentKey) => controllers.torrentList().saveTorrentFileAs(torrentKey), + 'prioritizeTorrent': (infoHash) => controllers.torrentList().prioritizeTorrent(infoHash), + 'resumePausedTorrents': () => controllers.torrentList().resumePausedTorrents(), // Playback 'playFile': (infoHash, index) => controllers.playback().playFile(infoHash, index), @@ -341,6 +356,7 @@ function setupIpc () { ipcRenderer.on('wt-infohash', (e, ...args) => tc.torrentInfoHash(...args)) ipcRenderer.on('wt-metadata', (e, ...args) => tc.torrentMetadata(...args)) ipcRenderer.on('wt-done', (e, ...args) => tc.torrentDone(...args)) + ipcRenderer.on('wt-done', () => controllers.torrentList().resumePausedTorrents()) ipcRenderer.on('wt-warning', (e, ...args) => tc.torrentWarning(...args)) ipcRenderer.on('wt-error', (e, ...args) => tc.torrentError(...args)) @@ -472,8 +488,10 @@ function onError (err) { update() } +const editableHtmlTags = new Set(['input', 'textarea']) + function onPaste (e) { - if (e.target.tagName.toLowerCase() === 'input') return + if (editableHtmlTags.has(e.target.tagName.toLowerCase())) return controllers.torrentList().addTorrent(electron.clipboard.readText()) update() diff --git a/src/renderer/pages/preferences-page.js b/src/renderer/pages/preferences-page.js index 57ae9670..bf729141 100644 --- a/src/renderer/pages/preferences-page.js +++ b/src/renderer/pages/preferences-page.js @@ -62,6 +62,24 @@ class PreferencesPage extends React.Component { dispatch('updatePreferences', 'openExternalPlayer', !isChecked) } + highestPlaybackPriorityCheckbox () { + return ( + + +

Pauses all active torrents to allow playback to use all of the available bandwidth.

+
+ ) + } + + handleHighestPlaybackPriorityChange (e, isChecked) { + dispatch('updatePreferences', 'highestPlaybackPriority', isChecked) + } + externalPlayerPathSelector () { const playerPath = this.props.state.unsaved.prefs.externalPlayerPath const playerName = this.props.state.getExternalPlayerName() @@ -151,6 +169,7 @@ class PreferencesPage extends React.Component { {this.openExternalPlayerCheckbox()} {this.externalPlayerPathSelector()} + {this.highestPlaybackPriorityCheckbox()} {this.setDefaultAppButton()} diff --git a/src/renderer/webtorrent.js b/src/renderer/webtorrent.js index b080beca..1cb6abe5 100644 --- a/src/renderer/webtorrent.js +++ b/src/renderer/webtorrent.js @@ -128,6 +128,7 @@ function startTorrenting (torrentKey, torrentID, path, fileModtimes, selections) } function stopTorrenting (infoHash) { + console.log('--- STOP TORRENTING: ', infoHash) const torrent = client.get(infoHash) if (torrent) torrent.destroy() } diff --git a/test/screenshots/darwin/create-torrent-advanced.png b/test/screenshots/darwin/create-torrent-advanced.png index abe1dead..3b33e274 100644 Binary files a/test/screenshots/darwin/create-torrent-advanced.png and b/test/screenshots/darwin/create-torrent-advanced.png differ diff --git a/test/setup.js b/test/setup.js index fe537d14..7e8b932f 100644 --- a/test/setup.js +++ b/test/setup.js @@ -122,7 +122,7 @@ function compareIgnoringTransparency (bufActual, bufExpected) { const de = pngE.data for (let y = 0; y < h; y++) { for (let x = 0; x < w; x++) { - const i = (y * w + x) * 4 + const i = ((y * w) + x) * 4 if (de[i + 3] === 0) continue // Skip transparent pixels const ca = (da[i] << 16) | (da[i + 1] << 8) | da[i + 2] const ce = (de[i] << 16) | (de[i + 1] << 8) | de[i + 2] diff --git a/test/test-add-torrent.js b/test/test-add-torrent.js index cc88c86c..65985a25 100644 --- a/test/test-add-torrent.js +++ b/test/test-add-torrent.js @@ -38,11 +38,12 @@ test('create-torrent', function (t) { const expectedTorrent = { announce: [ - 'udp://exodus.desync.com:6969', + 'udp://explodie.org:6969', 'udp://tracker.coppersurfer.tk:6969', - 'udp://tracker.internetwarriors.net:1337', 'udp://tracker.leechers-paradise.org:6969', 'udp://tracker.openbittorrent.com:80', + 'udp://tracker.opentrackr.org:1337', + 'udp://zer0day.ch:1337', 'wss://tracker.btorrent.xyz', 'wss://tracker.fastcast.nz', 'wss://tracker.openwebtorrent.com' diff --git a/test/test-torrent-list.js b/test/test-torrent-list.js index 896edff5..71c1b2ea 100644 --- a/test/test-torrent-list.js +++ b/test/test-torrent-list.js @@ -79,7 +79,7 @@ test('torrent-list: expand torrent, unselect file', function (t) { // Make sure that it creates all files EXCEPT the deslected one .then(() => setup.compareDownloadFolder(t, 'CosmosLaundromatFirstCycle', [ // TODO: the .gif should NOT be here, since we just deselected it. - // This is a bug. See https://github.com/feross/webtorrent-desktop/issues/719 + // This is a bug. See https://github.com/webtorrent/webtorrent-desktop/issues/719 'Cosmos Laundromat - First Cycle (1080p).gif', 'Cosmos Laundromat - First Cycle (1080p).mp4', 'Cosmos Laundromat - First Cycle (1080p).ogv',