Compare commits
166 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fbb3fa6a27 | ||
|
|
e10debed2f | ||
|
|
437dd3adb1 | ||
|
|
e48191381e | ||
|
|
abb7c72b84 | ||
|
|
20d9ea5a00 | ||
|
|
0da29e4eb2 | ||
|
|
10f92c78eb | ||
|
|
924dbeeebb | ||
|
|
3c363595ce | ||
|
|
695154099d | ||
|
|
21edc05f19 | ||
|
|
cf729b0d31 | ||
|
|
74b806737d | ||
|
|
88cbcc2959 | ||
|
|
eab15876cc | ||
|
|
c6a7b7c1d2 | ||
|
|
7f2c91b230 | ||
|
|
dab0802a88 | ||
|
|
34f06267b8 | ||
|
|
99062175eb | ||
|
|
f47055c51b | ||
|
|
4752c2e689 | ||
|
|
57c1a97ebf | ||
|
|
793ccebf0b | ||
|
|
c688313239 | ||
|
|
afd7f6ef0a | ||
|
|
cc78251846 | ||
|
|
30693d7d16 | ||
|
|
bd2fbe60db | ||
|
|
a114a22770 | ||
|
|
8d657d93e0 | ||
|
|
5802cd3591 | ||
|
|
2d17cfa7e1 | ||
|
|
cf2a3b8948 | ||
|
|
b89a74e6e9 | ||
|
|
9b74602119 | ||
|
|
34463d9084 | ||
|
|
3dcab9e78b | ||
|
|
fce0003912 | ||
|
|
c720f65fee | ||
|
|
a725726e25 | ||
|
|
e5a64d9550 | ||
|
|
0572f8a932 | ||
|
|
23d37d7da1 | ||
|
|
474654fd16 | ||
|
|
070d3ff242 | ||
|
|
d5a62cb1a7 | ||
|
|
ba1f82faa0 | ||
|
|
0cce110c52 | ||
|
|
bc91cde244 | ||
|
|
30c9934694 | ||
|
|
f56f3c62e9 | ||
|
|
ac180a7cc5 | ||
|
|
d1f3a16b7f | ||
|
|
e6c495417b | ||
|
|
c301608881 | ||
|
|
7d2290a773 | ||
|
|
ba0d0b755e | ||
|
|
b5e9923469 | ||
|
|
b5bbd9b6a5 | ||
|
|
5bf7618dde | ||
|
|
d02f6c7d18 | ||
|
|
e69a18e548 | ||
|
|
991e2d2024 | ||
|
|
9f31f30925 | ||
|
|
340658c747 | ||
|
|
5bbd9cfabb | ||
|
|
03a8b40ee9 | ||
|
|
d0cc157003 | ||
|
|
01971e2a46 | ||
|
|
08cb82e255 | ||
|
|
cae40b44e6 | ||
|
|
ab0bbcea94 | ||
|
|
06a7eff0ab | ||
|
|
341333c287 | ||
|
|
0f00985b75 | ||
|
|
c11a86d849 | ||
|
|
52e16c33b4 | ||
|
|
54e15644b6 | ||
|
|
6aa3a6c660 | ||
|
|
83350b3b57 | ||
|
|
8868128d6e | ||
|
|
a81156b363 | ||
|
|
4b501ab90b | ||
|
|
90347c72e0 | ||
|
|
a51ab3573e | ||
|
|
96f5f855a3 | ||
|
|
a82498ba16 | ||
|
|
3b05b52e57 | ||
|
|
b02d6f3cdb | ||
|
|
6e67cae494 | ||
|
|
23eef1a058 | ||
|
|
2ad3f6d6e2 | ||
|
|
996a81ddaa | ||
|
|
4a8ab6e1f6 | ||
|
|
7f817241ed | ||
|
|
a6c53d06d2 | ||
|
|
a70c4d1bf2 | ||
|
|
cdfb907c75 | ||
|
|
c2abb50e9e | ||
|
|
99f4fc96bf | ||
|
|
043f81996e | ||
|
|
213f2f124d | ||
|
|
96e7e83e20 | ||
|
|
e5fccd93a8 | ||
|
|
78e46f5576 | ||
|
|
69ce07fbf7 | ||
|
|
827131e136 | ||
|
|
c764bf4884 | ||
|
|
972203d675 | ||
|
|
2c382e14b5 | ||
|
|
c298950d34 | ||
|
|
00f2e5ccd6 | ||
|
|
8d86cffabd | ||
|
|
95d6ec5fdd | ||
|
|
9fbee6cfeb | ||
|
|
9892f88530 | ||
|
|
10ad990f97 | ||
|
|
0ee7e80fd2 | ||
|
|
7d1520f858 | ||
|
|
77ba258fbf | ||
|
|
06366529cc | ||
|
|
d1c263f1b0 | ||
|
|
d7a031a457 | ||
|
|
b7201f424d | ||
|
|
89f2785244 | ||
|
|
cffe416f50 | ||
|
|
d0eea34e9b | ||
|
|
4e82718788 | ||
|
|
293ca60e72 | ||
|
|
af4a6a5960 | ||
|
|
e01c0b6f43 | ||
|
|
efc984f1dd | ||
|
|
a046db40d2 | ||
|
|
9068909b4d | ||
|
|
4bb2056bc9 | ||
|
|
ed0f05abc4 | ||
|
|
0c44e10ca7 | ||
|
|
d8c9014471 | ||
|
|
7cf1d96a80 | ||
|
|
ffd9fbda57 | ||
|
|
d8904aaf6e | ||
|
|
de2db211cc | ||
|
|
e8ab172d1b | ||
|
|
32f96c03dd | ||
|
|
5158606740 | ||
|
|
0de80165ed | ||
|
|
dcaa99d2bf | ||
|
|
1a1a4cd5d0 | ||
|
|
4cbad1fccd | ||
|
|
f818564dd1 | ||
|
|
8be690a26e | ||
|
|
8081d42477 | ||
|
|
b0b6069fe2 | ||
|
|
994aed9af7 | ||
|
|
852fc86cbd | ||
|
|
8801a87a58 | ||
|
|
1e10f0083c | ||
|
|
bb40f0f11a | ||
|
|
78d7243a08 | ||
|
|
44a0f760de | ||
|
|
1e5ac1df9c | ||
|
|
4cdc3085ff | ||
|
|
e483263d70 | ||
|
|
bd41bd4db8 |
2
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,3 +1,5 @@
|
|||||||
|
<!-- DO NOT POST LINKS OR REFERENCES TO COPYRIGHTED CONTENT IN YOUR ISSUE. -->
|
||||||
|
|
||||||
**What version of WebTorrent Desktop?** (See the 'About WebTorrent' menu)
|
**What version of WebTorrent Desktop?** (See the 'About WebTorrent' menu)
|
||||||
|
|
||||||
**What operating system and version?**
|
**What operating system and version?**
|
||||||
|
|||||||
13
AUTHORS.md
@@ -34,5 +34,18 @@
|
|||||||
- PurgingPanda (t3ch0wn3r@gmail.com)
|
- PurgingPanda (t3ch0wn3r@gmail.com)
|
||||||
- Kai Curtis (morecode@kcurtis.com)
|
- Kai Curtis (morecode@kcurtis.com)
|
||||||
- Omri Litov (omrilitov@gmail.com)
|
- Omri Litov (omrilitov@gmail.com)
|
||||||
|
- Alexey Romanov (romanalexey@gmail.com)
|
||||||
|
- Karan Thakkar (karanjthakkar@gmail.com)
|
||||||
|
- Nuno Campos (nuno.campos@me.com)
|
||||||
|
- Ebrahim Byagowi (ebrahim@gnu.org)
|
||||||
|
- Josip Janzic (josip@jjanzic.com)
|
||||||
|
- Emil Bay (github@tixz.dk)
|
||||||
|
- Borewit (borewit@users.noreply.github.com)
|
||||||
|
- greenkeeper[bot] (greenkeeper[bot]@users.noreply.github.com)
|
||||||
|
- Auyer (rafa_auyer@icloud.com)
|
||||||
|
- SimplyAhmazing (ahmad19526@gmail.com)
|
||||||
|
- Cezar Carneiro (cezargcarneiro@gmail.com)
|
||||||
|
- Terry Hau (terryhau@gmail.com)
|
||||||
|
- Vítor Galvão (info@vitorgalvao.com)
|
||||||
|
|
||||||
#### Generated by bin/update-authors.sh.
|
#### Generated by bin/update-authors.sh.
|
||||||
|
|||||||
113
CHANGELOG.md
@@ -1,5 +1,68 @@
|
|||||||
# WebTorrent Desktop Version History
|
# WebTorrent Desktop Version History
|
||||||
|
|
||||||
|
## v0.20.0 - 2018-04-26
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added support for additional audio extensions: 'aiff', 'ape', 'mp2', 'oga', 'opus', 'wma' (#1240)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Displaying filename while music metadata is being downloaded (#1361)
|
||||||
|
- Improved the poster selection for audio/music based torrents (#1334)
|
||||||
|
- Launch VLC player without the `--video-on-top` flag (#1286)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fix silently failing to open magnets links on Linux (#1367)
|
||||||
|
|
||||||
|
## v0.19.0 - 2018-01-26
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Added watch folder feature: Automatically add new torrent files added to a folder on disk (#1154)
|
||||||
|
- Added highest playback priority feature: pauses other active torrents when playback starts (#840)
|
||||||
|
- Add 'Start Speaking' and 'Stop Speaking' menu item (Mac) (#439)
|
||||||
|
- Add pinch-to-zoom gesture to enter/exit fullscreen (#1148)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- [SECURITY] Mitigate Electron protocol handler issue (Windows)
|
||||||
|
- Moved project from Feross's GitHub account to the WebTorrent GitHub organization
|
||||||
|
- Updated to electron@1.6.16
|
||||||
|
- Updated to material-ui@0.17
|
||||||
|
- Treat .FLAC as playable audio (#1127)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Fix time and duration so it doesn't bounce in the UI (#1233)
|
||||||
|
- Fix 'About WebTorrent' menu location on Windows (#1120)
|
||||||
|
|
||||||
|
## v0.18.0 - 2017-02-03
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Add a new "Transfers" menu for pausing or resuming all torrents (#1027)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- 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
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Windows: Fix impossible-to-delete "Wired CD" default torrent
|
||||||
|
- Throttle browser-window 'move' and 'resize' events
|
||||||
|
- Fix crash ("Cannot read property 'files' of null" error)
|
||||||
|
- Fix crash ("TypeError: Cannot read property 'startPiece' of undefined")
|
||||||
|
|
||||||
## v0.17.1 - 2016-10-03
|
## v0.17.1 - 2016-10-03
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
@@ -39,7 +102,7 @@
|
|||||||
## v0.16.0 - 2016-09-18
|
## v0.16.0 - 2016-09-18
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- **Windows 64-bit support!** ([#931](https://github.com/feross/webtorrent-desktop/pull/931))
|
- **Windows 64-bit support!** (#931)
|
||||||
- Existing 32-bit users will update to 64-bit automatically in next release
|
- 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
|
- 64-bit reduces likelihood of out-of-memory errors by increasing the address space
|
||||||
|
|
||||||
@@ -99,16 +162,13 @@
|
|||||||
## v0.12.0 - 2016-08-23
|
## v0.12.0 - 2016-08-23
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Custom external media player
|
- Custom external media player
|
||||||
- Linux: add system-wide launcher and icons for Debian, including Ubuntu
|
- Linux: add system-wide launcher and icons for Debian, including Ubuntu
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Telemetry improvements: redact stacktraces, log app version
|
- Telemetry improvements: redact stacktraces, log app version
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fix playback and download of default torrents ("missing path" error) (#804)
|
- Fix playback and download of default torrents ("missing path" error) (#804)
|
||||||
- Fix Delete Torrent + Data for newly added magnet links
|
- Fix Delete Torrent + Data for newly added magnet links
|
||||||
- Fix jumpToTime error (#804)
|
- Fix jumpToTime error (#804)
|
||||||
@@ -121,13 +181,11 @@
|
|||||||
- Check for missing default download path and torrent folders on start up (#776)
|
- Check for missing default download path and torrent folders on start up (#776)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Do not automatically set WebTorrent as the default handler for torrents (#771)
|
- Do not automatically set WebTorrent as the default handler for torrents (#771)
|
||||||
- Torrents can only be created from the home screen (#770)
|
- Torrents can only be created from the home screen (#770)
|
||||||
- Update Electron to 1.3.3 (#772)
|
- Update Electron to 1.3.3 (#772)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Allow modifying the default tracker list on the Create Torrent page (#775)
|
- Allow modifying the default tracker list on the Create Torrent page (#775)
|
||||||
- Prevent opening multiple stacked Preference windows or Create Torrent windows (#770)
|
- Prevent opening multiple stacked Preference windows or Create Torrent windows (#770)
|
||||||
- Windows: Player window auto-resize does not match video aspect ratio (#565)
|
- Windows: Player window auto-resize does not match video aspect ratio (#565)
|
||||||
@@ -136,13 +194,11 @@
|
|||||||
## v0.10.0 - 2016-08-05
|
## v0.10.0 - 2016-08-05
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Drag-and-drop magnet links (selected text) is now supported (#284)
|
- Drag-and-drop magnet links (selected text) is now supported (#284)
|
||||||
- Windows: Add "User Tasks" shortcuts to app icon in Start Menu (#114)
|
- Windows: Add "User Tasks" shortcuts to app icon in Start Menu (#114)
|
||||||
- Linux: Show badge count for completed torrent downloads
|
- Linux: Show badge count for completed torrent downloads
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Change WebTorrent Desktop peer ID prefix to 'WD' to distinguish from WebTorrent in the browser, 'WW' (#688)
|
- 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)
|
- Switch UI to React to improve UI rendering speed (#729)
|
||||||
- The primary bottleneck was actually `hyperx`, not `virtual-dom`.
|
- The primary bottleneck was actually `hyperx`, not `virtual-dom`.
|
||||||
@@ -159,7 +215,6 @@
|
|||||||
- Location history abstraction released independently as [`location-history`](https://www.npmjs.com/package/location-history)
|
- Location history abstraction released independently as [`location-history`](https://www.npmjs.com/package/location-history)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- When streaming to VLC, set VLC window title to torrent file name (#746)
|
- When streaming to VLC, set VLC window title to torrent file name (#746)
|
||||||
- Fix "Cannot read property 'numPiecesPresent' of undefined" exception (#695)
|
- Fix "Cannot read property 'numPiecesPresent' of undefined" exception (#695)
|
||||||
- Fix rare case where config file could not be completely written (#733)
|
- Fix rare case where config file could not be completely written (#733)
|
||||||
@@ -167,35 +222,29 @@
|
|||||||
## v0.9.0 - 2016-07-20
|
## v0.9.0 - 2016-07-20
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Save selected subtitles
|
- Save selected subtitles
|
||||||
- Ask for confirmation before deleting torrents
|
- Ask for confirmation before deleting torrents
|
||||||
- Support Debian Jessie
|
- Support Debian Jessie
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Only send telemetry in production
|
- Only send telemetry in production
|
||||||
- Clean up the code. Split main.js, refactor lots of things
|
- Clean up the code. Split main.js, refactor lots of things
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fix state.playing.jumpToTime behavior
|
- Fix state.playing.jumpToTime behavior
|
||||||
- Remove torrent file and poster image when deleting a torrent
|
- Remove torrent file and poster image when deleting a torrent
|
||||||
|
|
||||||
## v0.8.1 - 2016-06-24
|
## v0.8.1 - 2016-06-24
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- New URI handler: stream-magnet
|
- New URI handler: stream-magnet
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- DLNA crashing bug
|
- DLNA crashing bug
|
||||||
|
|
||||||
## v0.8.0 - 2016-06-23
|
## v0.8.0 - 2016-06-23
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Cast menu: choose which Chromecast, Airplay, or DLNA device you want to use
|
- 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
|
- Telemetry: send basic data, plus stats on how often the play button works
|
||||||
- Make posters from jpeg files, not just jpg
|
- Make posters from jpeg files, not just jpg
|
||||||
@@ -203,17 +252,14 @@
|
|||||||
- Windows thumbnail bar with a play/pause button
|
- Windows thumbnail bar with a play/pause button
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Nicer modal styles
|
- Nicer modal styles
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Windows tray icon now stays in the right state
|
- Windows tray icon now stays in the right state
|
||||||
|
|
||||||
## v0.7.2 - 2016-06-02
|
## v0.7.2 - 2016-06-02
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fix exception that affects users upgrading from v0.5.1 or older
|
- Fix exception that affects users upgrading from v0.5.1 or older
|
||||||
- Ensure `state.saved.prefs` configuration exists
|
- Ensure `state.saved.prefs` configuration exists
|
||||||
- Fix window title on "About WebTorrent" window
|
- Fix window title on "About WebTorrent" window
|
||||||
@@ -221,23 +267,19 @@
|
|||||||
## v0.7.1 - 2016-06-02
|
## v0.7.1 - 2016-06-02
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Change "Step Forward" keyboard shortcut to `Alt+Left` (Windows)
|
- Change "Step Forward" keyboard shortcut to `Alt+Left` (Windows)
|
||||||
- Change "Step Backward" keyboard shortcut to to `Alt+Right` (Windows)
|
- Change "Step Backward" keyboard shortcut to to `Alt+Right` (Windows)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- First time startup bug -- invalid torrent/poster paths
|
- First time startup bug -- invalid torrent/poster paths
|
||||||
|
|
||||||
## v0.7.0 - 2016-06-02
|
## v0.7.0 - 2016-06-02
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Improved AirPlay support -- using the new [`airplayer`](https://www.npmjs.com/package/airplayer) package
|
- 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
|
- Remember volume setting in player, for as long as the app is open
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Add (+) button now also accepts non .torrent files and creates a torrent from
|
- Add (+) button now also accepts non .torrent files and creates a torrent from
|
||||||
those files
|
those files
|
||||||
- Show prompt text in title bar for open dialogs (OS X)
|
- Show prompt text in title bar for open dialogs (OS X)
|
||||||
@@ -247,7 +289,6 @@
|
|||||||
- Fix crash reporter not working (Windows)
|
- Fix crash reporter not working (Windows)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Re-enable WebRTC (web peers)! (OS X, Windows)
|
- Re-enable WebRTC (web peers)! (OS X, Windows)
|
||||||
- Windows support was disabled in v0.6.1 to work around a bug in Electron
|
- 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
|
- OS X support was disabled in v0.4.0 to work around a 100% CPU bug
|
||||||
@@ -258,7 +299,6 @@
|
|||||||
- Fix torrent loading message UI misalignment
|
- Fix torrent loading message UI misalignment
|
||||||
|
|
||||||
### Known issues
|
### Known issues
|
||||||
|
|
||||||
- When upgrading to WebTorrent Desktop v0.7.0, some torrent metadata (file list,
|
- 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
|
selected files, whether torrent is streamable) will be cleared. Just start the
|
||||||
torrent to re-populate the metadata.
|
torrent to re-populate the metadata.
|
||||||
@@ -266,7 +306,6 @@
|
|||||||
## v0.6.1 - 2016-05-26
|
## v0.6.1 - 2016-05-26
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Disable WebRTC to work around Electron crash (Windows)
|
- Disable WebRTC to work around Electron crash (Windows)
|
||||||
- Will be re-enabled in the next version of WebTorrent, which will be based on
|
- 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.
|
the next version of Electron, where the bug is fixed.
|
||||||
@@ -278,7 +317,6 @@
|
|||||||
## v0.6.0 - 2016-05-24
|
## v0.6.0 - 2016-05-24
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Added Preferences page to set Download folder
|
- Added Preferences page to set Download folder
|
||||||
- Save video position, resume playback from saved position
|
- Save video position, resume playback from saved position
|
||||||
- Add additional video player keyboard shortcuts (#275)
|
- Add additional video player keyboard shortcuts (#275)
|
||||||
@@ -288,7 +326,6 @@
|
|||||||
- Add announcement feature
|
- Add announcement feature
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Nicer player UI
|
- Nicer player UI
|
||||||
- Reduce startup jank, improve startup time (#568)
|
- Reduce startup jank, improve startup time (#568)
|
||||||
- Cleanup unsupported codec detection (#569, #570)
|
- Cleanup unsupported codec detection (#569, #570)
|
||||||
@@ -296,7 +333,6 @@
|
|||||||
- Improve subtitle positioning (#551)
|
- Improve subtitle positioning (#551)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fix Uncaught TypeError: Cannot read property 'update' of undefined (#567)
|
- Fix Uncaught TypeError: Cannot read property 'update' of undefined (#567)
|
||||||
- Fix bugs in LocationHistory
|
- Fix bugs in LocationHistory
|
||||||
- When player is active, and magnet link is pasted, go back to list
|
- When player is active, and magnet link is pasted, go back to list
|
||||||
@@ -307,23 +343,19 @@
|
|||||||
## v0.5.1 - 2016-05-18
|
## v0.5.1 - 2016-05-18
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fix auto-updater (OS X, Windows).
|
- Fix auto-updater (OS X, Windows).
|
||||||
|
|
||||||
## v0.5.0 - 2016-05-17
|
## v0.5.0 - 2016-05-17
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Select/deselect individual files to torrent.
|
- Select/deselect individual files to torrent.
|
||||||
- Automatically include subtitle files (.srt, .vtt) from torrent in the subtitles menu.
|
- Automatically include subtitle files (.srt, .vtt) from torrent in the subtitles menu.
|
||||||
- "Add Subtitle File..." menu item.
|
- "Add Subtitle File..." menu item.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- When manually adding subtitle track(s), always switch to the new track.
|
- When manually adding subtitle track(s), always switch to the new track.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Magnet links throw exception on app launch. (OS X)
|
- Magnet links throw exception on app launch. (OS X)
|
||||||
- Multi-file torrents would not seed in-place, were copied to Downloads folder.
|
- Multi-file torrents would not seed in-place, were copied to Downloads folder.
|
||||||
- Missing 'About WebTorrent' menu item. (Windows)
|
- Missing 'About WebTorrent' menu item. (Windows)
|
||||||
@@ -332,7 +364,6 @@
|
|||||||
## v0.4.0 - 2016-05-13
|
## v0.4.0 - 2016-05-13
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Better Windows support!
|
- Better Windows support!
|
||||||
- Windows 32-bit build.
|
- Windows 32-bit build.
|
||||||
- Windows Portable App build.
|
- Windows Portable App build.
|
||||||
@@ -355,7 +386,6 @@
|
|||||||
- New default torrent on first launch: The WIRED CD.
|
- New default torrent on first launch: The WIRED CD.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Improve app startup time by 40%.
|
- Improve app startup time by 40%.
|
||||||
- UI tweaks: Reduce font size, reduce torrent list item height.
|
- UI tweaks: Reduce font size, reduce torrent list item height.
|
||||||
- Add Playback menu for playback-related functionality.
|
- Add Playback menu for playback-related functionality.
|
||||||
@@ -366,7 +396,6 @@
|
|||||||
- Remove "Add Fake Airplay/Chromecast" menu items.
|
- Remove "Add Fake Airplay/Chromecast" menu items.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Disable WebRTC to fix 100% CPU usage/crashes caused by Chromium issue. This is
|
- Disable WebRTC to fix 100% CPU usage/crashes caused by Chromium issue. This is
|
||||||
temporary. (OS X)
|
temporary. (OS X)
|
||||||
- When fullscreen, make controls use the full window. (OS X)
|
- When fullscreen, make controls use the full window. (OS X)
|
||||||
@@ -391,24 +420,20 @@ to this release!
|
|||||||
## v0.3.3 - 2016-04-07
|
## v0.3.3 - 2016-04-07
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- App icon was incorrect (OS X)
|
- App icon was incorrect (OS X)
|
||||||
|
|
||||||
## v0.3.2 - 2016-04-07
|
## v0.3.2 - 2016-04-07
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Register WebTorrent as default handler for magnet links (OS X)
|
- Register WebTorrent as default handler for magnet links (OS X)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Faster startup time (50ms)
|
- Faster startup time (50ms)
|
||||||
- Update Electron to 0.37.5
|
- Update Electron to 0.37.5
|
||||||
- Remove the white flash when loading pages and resizing the window
|
- Remove the white flash when loading pages and resizing the window
|
||||||
- Fix crash when sending IPC messages
|
- Fix crash when sending IPC messages
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fix installation bugs with .deb file (Linux)
|
- Fix installation bugs with .deb file (Linux)
|
||||||
- Pause audio reliably when closing the window
|
- Pause audio reliably when closing the window
|
||||||
- Enforce minimimum window size when resizing player (for audio-only .mov files, which are 0x0)
|
- Enforce minimimum window size when resizing player (for audio-only .mov files, which are 0x0)
|
||||||
@@ -416,17 +441,14 @@ to this release!
|
|||||||
## v0.3.1 - 2016-04-06
|
## v0.3.1 - 2016-04-06
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Add crash reporter to torrent engine process
|
- Add crash reporter to torrent engine process
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fix cast screen background: cover, don't tile
|
- Fix cast screen background: cover, don't tile
|
||||||
|
|
||||||
## v0.3.0 - 2016-04-06
|
## v0.3.0 - 2016-04-06
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- **Ubuntu/Debian support!** (.deb installer)
|
- **Ubuntu/Debian support!** (.deb installer)
|
||||||
- **DLNA streaming support**
|
- **DLNA streaming support**
|
||||||
- Add "File > Quit" menu item (Linux)
|
- Add "File > Quit" menu item (Linux)
|
||||||
@@ -434,14 +456,12 @@ to this release!
|
|||||||
- Crash reporting
|
- Crash reporting
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- On startup, do not re-verify files when timestamps are unchanged
|
- On startup, do not re-verify files when timestamps are unchanged
|
||||||
- Moved torrent engine to an independent process, for better UI performance
|
- Moved torrent engine to an independent process, for better UI performance
|
||||||
- Removed media queries (UI resizing based on window width)
|
- Removed media queries (UI resizing based on window width)
|
||||||
- Improved Chromecast icon, when connected
|
- Improved Chromecast icon, when connected
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- "Download Complete" notification shows consistently
|
- "Download Complete" notification shows consistently
|
||||||
- Create new torrents and seed them without copying to temporary folder
|
- Create new torrents and seed them without copying to temporary folder
|
||||||
- Clicking the "Download Complete" notification will always activate app
|
- Clicking the "Download Complete" notification will always activate app
|
||||||
@@ -460,7 +480,6 @@ Thanks to @dcposch, @grunjol, and @feross for contributing to this release.
|
|||||||
## v0.2.0 - 2016-03-29
|
## v0.2.0 - 2016-03-29
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Minimise to tray (Windows, Linux)
|
- Minimise to tray (Windows, Linux)
|
||||||
- Show spinner and download speed when player is stalled waiting for data
|
- Show spinner and download speed when player is stalled waiting for data
|
||||||
- Highlight window on drag-and-drop
|
- Highlight window on drag-and-drop
|
||||||
@@ -469,12 +488,10 @@ Thanks to @dcposch, @grunjol, and @feross for contributing to this release.
|
|||||||
Linux users need to download new versions manually.
|
Linux users need to download new versions manually.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Renamed WebTorrent.app to WebTorrent Desktop
|
- Renamed WebTorrent.app to WebTorrent Desktop
|
||||||
- Add Cosmos Laundromat as a default torrent
|
- Add Cosmos Laundromat as a default torrent
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Only capture media keys when player is active
|
- Only capture media keys when player is active
|
||||||
- Update WebTorrent to 0.88.1 for performance improvements
|
- Update WebTorrent to 0.88.1 for performance improvements
|
||||||
- When seeding, do not proactively connect to new peers
|
- When seeding, do not proactively connect to new peers
|
||||||
@@ -534,7 +551,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
|
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
|
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
|
### Features
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ and to avoid style arguments. `npm test` runs `standard` automatically, so you d
|
|||||||
to!
|
to!
|
||||||
|
|
||||||
[standard-image]: https://cdn.rawgit.com/feross/standard/master/badge.svg
|
[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
|
## Project Governance
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ standard guarded open source project.
|
|||||||
|
|
||||||
There are a few basic ground-rules for contributors:
|
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.
|
2. **Non-master branches** should be used for ongoing work.
|
||||||
3. **Significant modifications** like API changes should be subject to a **pull request**
|
3. **Significant modifications** like API changes should be subject to a **pull request**
|
||||||
to solicit feedback from other contributors.
|
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
|
including my sign-off) is maintained indefinitely and may be redistributed consistent
|
||||||
with this project or the open source license(s) involved.
|
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 <last version tag>..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 <branch-name>: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
|
## Smoke Tests
|
||||||
|
|
||||||
Before a release, check that the following basic use cases work correctly:
|
Before a release, check that the following basic use cases work correctly:
|
||||||
|
|||||||
43
README.md
@@ -1,6 +1,8 @@
|
|||||||
<h1 align="center">
|
<h1 align="center">
|
||||||
<br>
|
<br>
|
||||||
<a href="https://webtorrent.io"><img src="https://webtorrent.io/img/WebTorrent.png" alt="WebTorrent" width="200"></a>
|
<a href="https://webtorrent.io">
|
||||||
|
<img src="https://webtorrent.io/img/WebTorrent.png" alt="WebTorrent" width="200">
|
||||||
|
</a>
|
||||||
<br>
|
<br>
|
||||||
WebTorrent Desktop
|
WebTorrent Desktop
|
||||||
<br>
|
<br>
|
||||||
@@ -10,16 +12,21 @@
|
|||||||
<h4 align="center">The streaming torrent app. For Mac, Windows, and Linux.</h4>
|
<h4 align="center">The streaming torrent app. For Mac, Windows, and Linux.</h4>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://gitter.im/feross/webtorrent"><img src="https://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg" alt="Gitter"></a>
|
<a href="https://gitter.im/webtorrent/webtorrent"><img src="https://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg" alt="gitter"></a>
|
||||||
<a href="https://travis-ci.org/feross/webtorrent-desktop"><img src="https://img.shields.io/travis/feross/webtorrent-desktop/master.svg" alt="Travis"></a>
|
<a href="https://github.com/webtorrent/webtorrent-desktop/releases"><img src="https://img.shields.io/github/release/webtorrent/webtorrent-desktop.svg" alt="github release"></a>
|
||||||
<a href="https://github.com/feross/webtorrent-desktop/releases"><img src="https://img.shields.io/github/release/feross/webtorrent-desktop.svg" alt="Release"></a>
|
<a href="https://travis-ci.org/webtorrent/webtorrent-desktop"><img src="https://img.shields.io/travis/webtorrent/webtorrent-desktop/master.svg" alt="travis"></a>
|
||||||
|
<a href="https://standardjs.com"><img src="https://img.shields.io/badge/code_style-standard-brightgreen.svg" alt="Standard - JavaScript Style Guide"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
Download the latest version of WebTorrent Desktop from
|
Download the latest version of WebTorrent Desktop from
|
||||||
[the official website](https://webtorrent.io/desktop/) or the
|
[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. Alternatively, you can install it with [Homebrew-Cask](https://github.com/caskroom/homebrew-cask):
|
||||||
|
|
||||||
|
```
|
||||||
|
$ brew cask install webtorrent
|
||||||
|
```
|
||||||
|
|
||||||
**WebTorrent Desktop** is under very active development. You can try out the
|
**WebTorrent Desktop** is under very active development. You can try out the
|
||||||
current (unstable) development version by cloning the Git repo. See the
|
current (unstable) development version by cloning the Git repo. See the
|
||||||
@@ -37,7 +44,7 @@ instructions below in the ["How to Contribute"](#how-to-contribute) section.
|
|||||||
### Get the code
|
### Get the code
|
||||||
|
|
||||||
```
|
```
|
||||||
$ git clone https://github.com/feross/webtorrent-desktop.git
|
$ git clone https://github.com/webtorrent/webtorrent-desktop.git
|
||||||
$ cd webtorrent-desktop
|
$ cd webtorrent-desktop
|
||||||
$ npm install
|
$ npm install
|
||||||
```
|
```
|
||||||
@@ -68,19 +75,25 @@ $ npm test
|
|||||||
$ npm run test-integration
|
$ 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
|
* 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
|
* 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.
|
* Small UI changes will break a few tests, but the fix is as easy as deleting the offending
|
||||||
* 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
|
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.
|
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
|
### Package the app
|
||||||
|
|
||||||
@@ -110,7 +123,7 @@ The following optional arguments are available:
|
|||||||
- `all` - All platforms (default)
|
- `all` - All platforms (default)
|
||||||
|
|
||||||
Note: Even with the `--package` option, the auto-update files (.nupkg for Windows,
|
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
|
#### Windows build notes
|
||||||
|
|
||||||
@@ -145,10 +158,6 @@ Time out? Show a missing codec error?
|
|||||||
The app never sends any personally identifying information, nor does it track which
|
The app never sends any personally identifying information, nor does it track which
|
||||||
torrents you add.
|
torrents you add.
|
||||||
|
|
||||||
### Code Style
|
|
||||||
|
|
||||||
[](https://github.com/feross/standard)
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT. Copyright (c) [WebTorrent, LLC](https://webtorrent.io).
|
MIT. Copyright (c) [WebTorrent, LLC](https://webtorrent.io).
|
||||||
|
|||||||
43
SECURITY.md
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Security Policies and Procedures
|
||||||
|
|
||||||
|
This document outlines security procedures and general policies for the WebTorrent
|
||||||
|
project.
|
||||||
|
|
||||||
|
* [Reporting a Bug](#reporting-a-bug)
|
||||||
|
* [Disclosure Policy](#disclosure-policy)
|
||||||
|
* [Comments on this Policy](#comments-on-this-policy)
|
||||||
|
|
||||||
|
## Reporting a Bug
|
||||||
|
|
||||||
|
The WebTorrent team and community take all security bugs in WebTorrent seriously.
|
||||||
|
Thank you for improving the security of WebTorrent. We appreciate your efforts and
|
||||||
|
responsible disclosure and will make every effort to acknowledge your
|
||||||
|
contributions.
|
||||||
|
|
||||||
|
Report security bugs by emailing the lead maintainer at feross@feross.org.
|
||||||
|
|
||||||
|
The lead maintainer will acknowledge your email within 48 hours, and will send a
|
||||||
|
more detailed response within 48 hours indicating the next steps in handling
|
||||||
|
your report. After the initial reply to your report, the security team will
|
||||||
|
endeavor to keep you informed of the progress towards a fix and full
|
||||||
|
announcement, and may ask for additional information or guidance.
|
||||||
|
|
||||||
|
Report security bugs in third-party modules to the person or team maintaining
|
||||||
|
the module. You can also report a vulnerability through the
|
||||||
|
[Node Security Project](https://nodesecurity.io/report).
|
||||||
|
|
||||||
|
## Disclosure Policy
|
||||||
|
|
||||||
|
When the security team receives a security bug report, they will assign it to a
|
||||||
|
primary handler. This person will coordinate the fix and release process,
|
||||||
|
involving the following steps:
|
||||||
|
|
||||||
|
* Confirm the problem and determine the affected versions.
|
||||||
|
* Audit code to find any potential similar problems.
|
||||||
|
* Prepare fixes for all releases still under maintenance. These fixes will be
|
||||||
|
released as fast as possible to npm.
|
||||||
|
|
||||||
|
## Comments on this Policy
|
||||||
|
|
||||||
|
If you have suggestions on how this process could be improved please submit a
|
||||||
|
pull request.
|
||||||
@@ -25,7 +25,7 @@ let tmpPath
|
|||||||
try {
|
try {
|
||||||
tmpPath = path.join(fs.statSync('/tmp') && '/tmp', 'webtorrent')
|
tmpPath = path.join(fs.statSync('/tmp') && '/tmp', 'webtorrent')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
tmpPath = path.join(os.tmpDir(), 'webtorrent')
|
tmpPath = path.join(os.tmpdir(), 'webtorrent')
|
||||||
}
|
}
|
||||||
rimraf.sync(tmpPath)
|
rimraf.sync(tmpPath)
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ const pkg = require('../package.json')
|
|||||||
const BUILD_NAME = config.APP_NAME + '-v' + config.APP_VERSION
|
const BUILD_NAME = config.APP_NAME + '-v' + config.APP_VERSION
|
||||||
const BUILD_PATH = path.join(config.ROOT_PATH, 'build')
|
const BUILD_PATH = path.join(config.ROOT_PATH, 'build')
|
||||||
const DIST_PATH = path.join(config.ROOT_PATH, 'dist')
|
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), {
|
const argv = minimist(process.argv.slice(2), {
|
||||||
boolean: [
|
boolean: [
|
||||||
@@ -36,6 +37,12 @@ const argv = minimist(process.argv.slice(2), {
|
|||||||
})
|
})
|
||||||
|
|
||||||
function build () {
|
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(DIST_PATH)
|
||||||
rimraf.sync(BUILD_PATH)
|
rimraf.sync(BUILD_PATH)
|
||||||
|
|
||||||
@@ -89,7 +96,7 @@ const all = {
|
|||||||
|
|
||||||
// Pattern which specifies which files to ignore when copying files to create the
|
// Pattern which specifies which files to ignore when copying files to create the
|
||||||
// package(s).
|
// package(s).
|
||||||
ignore: /^\/src|^\/dist|\/(appveyor.yml|\.appveyor.yml|\.github|appdmg|AUTHORS|CONTRIBUTORS|bench|benchmark|benchmark\.js|bin|bower\.json|component\.json|coverage|doc|docs|docs\.mli|dragdrop\.min\.js|example|examples|example\.html|example\.js|externs|ipaddr\.min\.js|Makefile|min|minimist|perf|rusha|simplepeer\.min\.js|simplewebsocket\.min\.js|static\/screenshot\.png|test|tests|test\.js|tests\.js|webtorrent\.min\.js|\.[^\/]*|.*\.md|.*\.markdown)$/,
|
ignore: /^\/src|^\/dist|\/(appveyor.yml|\.appveyor.yml|\.github|appdmg|AUTHORS|CONTRIBUTORS|bench|benchmark|benchmark\.js|bin|bower\.json|component\.json|coverage|doc|docs|docs\.mli|dragdrop\.min\.js|example|examples|example\.html|example\.js|externs|ipaddr\.min\.js|Makefile|min|minimist|perf|rusha|simplepeer\.min\.js|simplewebsocket\.min\.js|static\/screenshot\.png|test|tests|test\.js|tests\.js|webtorrent\.min\.js|\.[^/]*|.*\.md|.*\.markdown)$/,
|
||||||
|
|
||||||
// The application name.
|
// The application name.
|
||||||
name: config.APP_NAME,
|
name: config.APP_NAME,
|
||||||
@@ -104,8 +111,8 @@ const all = {
|
|||||||
// "devDependencies" before starting to package the app.
|
// "devDependencies" before starting to package the app.
|
||||||
prune: true,
|
prune: true,
|
||||||
|
|
||||||
// The Electron version with which the app is built (without the leading 'v')
|
// The Electron version that the app is built with (without the leading 'v')
|
||||||
version: require('electron/package.json').version
|
electronVersion: require('electron/package.json').version
|
||||||
}
|
}
|
||||||
|
|
||||||
const darwin = {
|
const darwin = {
|
||||||
@@ -134,7 +141,7 @@ const win32 = {
|
|||||||
platform: 'win32',
|
platform: 'win32',
|
||||||
|
|
||||||
// Build ia32 and x64 binaries.
|
// Build ia32 and x64 binaries.
|
||||||
arch: 'all',
|
arch: ['ia32', 'x64'],
|
||||||
|
|
||||||
// Object hash of application metadata to embed into the executable (Windows only)
|
// Object hash of application metadata to embed into the executable (Windows only)
|
||||||
win32metadata: {
|
win32metadata: {
|
||||||
@@ -168,7 +175,7 @@ const linux = {
|
|||||||
platform: 'linux',
|
platform: 'linux',
|
||||||
|
|
||||||
// Build ia32 and x64 binaries.
|
// Build ia32 and x64 binaries.
|
||||||
arch: 'all'
|
arch: ['ia32', 'x64']
|
||||||
|
|
||||||
// Note: Application icon for Linux is specified via the BrowserWindow `icon` option.
|
// Note: Application icon for Linux is specified via the BrowserWindow `icon` option.
|
||||||
}
|
}
|
||||||
@@ -442,51 +449,51 @@ function buildWin32 (cb) {
|
|||||||
usePackageJson: false,
|
usePackageJson: false,
|
||||||
version: pkg.version
|
version: pkg.version
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
console.log(`Windows: Created ${destArch} installer.`)
|
console.log(`Windows: Created ${destArch} installer.`)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete extraneous Squirrel files (i.e. *.nupkg delta files for older
|
* Delete extraneous Squirrel files (i.e. *.nupkg delta files for older
|
||||||
* versions of the app)
|
* versions of the app)
|
||||||
*/
|
*/
|
||||||
fs.readdirSync(DIST_PATH)
|
fs.readdirSync(DIST_PATH)
|
||||||
.filter((name) => name.endsWith('.nupkg') && !name.includes(pkg.version))
|
.filter((name) => name.endsWith('.nupkg') && !name.includes(pkg.version))
|
||||||
.forEach((filename) => {
|
.forEach((filename) => {
|
||||||
fs.unlinkSync(path.join(DIST_PATH, filename))
|
fs.unlinkSync(path.join(DIST_PATH, filename))
|
||||||
})
|
})
|
||||||
|
|
||||||
if (destArch === 'ia32') {
|
if (destArch === 'ia32') {
|
||||||
console.log('Windows: Renaming ia32 installer files...')
|
console.log('Windows: Renaming ia32 installer files...')
|
||||||
|
|
||||||
// RELEASES -> RELEASES-ia32
|
// RELEASES -> RELEASES-ia32
|
||||||
const relPath = path.join(DIST_PATH, 'RELEASES-ia32')
|
const relPath = path.join(DIST_PATH, 'RELEASES-ia32')
|
||||||
fs.renameSync(
|
fs.renameSync(
|
||||||
path.join(DIST_PATH, 'RELEASES'),
|
path.join(DIST_PATH, 'RELEASES'),
|
||||||
relPath
|
relPath
|
||||||
)
|
)
|
||||||
|
|
||||||
// WebTorrent-vX.X.X-full.nupkg -> WebTorrent-vX.X.X-ia32-full.nupkg
|
// WebTorrent-vX.X.X-full.nupkg -> WebTorrent-vX.X.X-ia32-full.nupkg
|
||||||
fs.renameSync(
|
fs.renameSync(
|
||||||
path.join(DIST_PATH, `${config.APP_NAME}-${config.APP_VERSION}-full.nupkg`),
|
path.join(DIST_PATH, `${config.APP_NAME}-${config.APP_VERSION}-full.nupkg`),
|
||||||
path.join(DIST_PATH, `${config.APP_NAME}-${config.APP_VERSION}-ia32-full.nupkg`)
|
path.join(DIST_PATH, `${config.APP_NAME}-${config.APP_VERSION}-ia32-full.nupkg`)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Change file name inside RELEASES-ia32 to match renamed file
|
// Change file name inside RELEASES-ia32 to match renamed file
|
||||||
const relContent = fs.readFileSync(relPath, 'utf8')
|
const relContent = fs.readFileSync(relPath, 'utf8')
|
||||||
const relContent32 = relContent.replace('full.nupkg', 'ia32-full.nupkg')
|
const relContent32 = relContent.replace('full.nupkg', 'ia32-full.nupkg')
|
||||||
fs.writeFileSync(relPath, relContent32)
|
fs.writeFileSync(relPath, relContent32)
|
||||||
|
|
||||||
if (relContent === relContent32) {
|
if (relContent === relContent32) {
|
||||||
// Sanity check
|
// Sanity check
|
||||||
throw new Error('Fixing RELEASES-ia32 failed. Replacement did not modify the file.')
|
throw new Error('Fixing RELEASES-ia32 failed. Replacement did not modify the file.')
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Windows: Renamed ia32 installer files.')
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Windows: Renamed ia32 installer files.')
|
cb(null)
|
||||||
}
|
})
|
||||||
|
.catch(cb)
|
||||||
cb(null)
|
|
||||||
})
|
|
||||||
.catch(cb)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function packagePortable (filesPath, destArch, cb) {
|
function packagePortable (filesPath, destArch, cb) {
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
|
|
||||||
git pull
|
|
||||||
rm -rf node_modules/
|
|
||||||
npm install
|
|
||||||
npm dedupe
|
|
||||||
npm test
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
BIN=`dirname $0`
|
|
||||||
|
|
||||||
$BIN/release-_pre.sh
|
|
||||||
npm version major
|
|
||||||
$BIN/release-_post.sh
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
BIN=`dirname $0`
|
|
||||||
|
|
||||||
$BIN/release-_pre.sh
|
|
||||||
npm version minor
|
|
||||||
$BIN/release-_post.sh
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
BIN=`dirname $0`
|
|
||||||
|
|
||||||
$BIN/release-_pre.sh
|
|
||||||
npm version patch
|
|
||||||
$BIN/release-_post.sh
|
|
||||||
37
package.json
@@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "webtorrent-desktop",
|
"name": "webtorrent-desktop",
|
||||||
"description": "WebTorrent, the streaming torrent client. For Mac, Windows, and Linux.",
|
"description": "WebTorrent, the streaming torrent client. For Mac, Windows, and Linux.",
|
||||||
"version": "0.17.1",
|
"version": "0.20.0",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "WebTorrent, LLC",
|
"name": "WebTorrent, LLC",
|
||||||
"email": "feross@webtorrent.io",
|
"email": "feross@webtorrent.io",
|
||||||
"url": "https://webtorrent.io"
|
"url": "https://webtorrent.io"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/feross/webtorrent-desktop/issues"
|
"url": "https://github.com/webtorrent/webtorrent-desktop/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"airplayer": "^2.0.0",
|
"airplayer": "^2.0.0",
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
"auto-launch": "^4.0.1",
|
"auto-launch": "^4.0.1",
|
||||||
"bitfield": "^1.0.2",
|
"bitfield": "^1.0.2",
|
||||||
"capture-frame": "^1.0.0",
|
"capture-frame": "^1.0.0",
|
||||||
|
"chokidar": "^1.6.1",
|
||||||
"chromecasts": "^1.8.0",
|
"chromecasts": "^1.8.0",
|
||||||
"cp-file": "^4.0.1",
|
"cp-file": "^4.0.1",
|
||||||
"create-torrent": "^3.24.5",
|
"create-torrent": "^3.24.5",
|
||||||
@@ -24,21 +25,20 @@
|
|||||||
"deep-equal": "^1.0.1",
|
"deep-equal": "^1.0.1",
|
||||||
"dlnacasts": "^0.1.0",
|
"dlnacasts": "^0.1.0",
|
||||||
"drag-drop": "^2.12.1",
|
"drag-drop": "^2.12.1",
|
||||||
"es6-error": "^3.0.1",
|
"es6-error": "^4.0.0",
|
||||||
"fn-getter": "^1.0.0",
|
"fn-getter": "^1.0.0",
|
||||||
"iso-639-1": "^1.2.1",
|
"iso-639-1": "^1.2.1",
|
||||||
"languagedetect": "^1.1.1",
|
"languagedetect": "^1.1.1",
|
||||||
"location-history": "^1.0.0",
|
"location-history": "^1.0.0",
|
||||||
"lodash.merge": "^4.6.0",
|
"material-ui": "^0.17.0",
|
||||||
"material-ui": "^0.15.4",
|
|
||||||
"mkdirp": "^0.5.1",
|
"mkdirp": "^0.5.1",
|
||||||
"musicmetadata": "^2.0.2",
|
"music-metadata": "^0.9.15",
|
||||||
"network-address": "^1.1.0",
|
"network-address": "^1.1.0",
|
||||||
"parse-torrent": "^5.7.3",
|
"parse-torrent": "^5.7.3",
|
||||||
"prettier-bytes": "^1.0.1",
|
"prettier-bytes": "^1.0.1",
|
||||||
"react": "^15.2.1",
|
"react": "^15.4.2",
|
||||||
"react-dom": "^15.2.1",
|
"react-dom": "^15.4.2",
|
||||||
"react-tap-event-plugin": "^1.0.0",
|
"react-tap-event-plugin": "^2.0.1",
|
||||||
"rimraf": "^2.5.2",
|
"rimraf": "^2.5.2",
|
||||||
"run-parallel": "^1.1.6",
|
"run-parallel": "^1.1.6",
|
||||||
"semver": "^5.1.0",
|
"semver": "^5.1.0",
|
||||||
@@ -51,16 +51,16 @@
|
|||||||
"zero-fill": "^2.2.3"
|
"zero-fill": "^2.2.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"buble": "^0.14.0",
|
"buble": "^0.19.3",
|
||||||
"cross-zip": "^2.0.1",
|
"cross-zip": "^2.0.1",
|
||||||
"depcheck": "^0.6.4",
|
"depcheck": "^0.6.4",
|
||||||
"electron": "1.4.2",
|
"electron": "1.6.16",
|
||||||
"electron-osx-sign": "^0.3.0",
|
"electron-osx-sign": "0.4.3",
|
||||||
"electron-packager": "^8.0.0",
|
"electron-packager": "~8.5.1",
|
||||||
"electron-winstaller": "^2.3.0",
|
"electron-winstaller": "~2.5.2",
|
||||||
"gh-release": "^2.0.3",
|
"gh-release": "^2.0.3",
|
||||||
"minimist": "^1.2.0",
|
"minimist": "^1.2.0",
|
||||||
"nobin-debian-installer": "^0.0.10",
|
"nobin-debian-installer": "0.0.10",
|
||||||
"nodemon": "^1.10.2",
|
"nodemon": "^1.10.2",
|
||||||
"open": "0.0.5",
|
"open": "0.0.5",
|
||||||
"plist": "^2.0.1",
|
"plist": "^2.0.1",
|
||||||
@@ -90,10 +90,11 @@
|
|||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"appdmg": "^0.4.3"
|
"appdmg": "^0.4.3"
|
||||||
},
|
},
|
||||||
|
"private": true,
|
||||||
"productName": "WebTorrent",
|
"productName": "WebTorrent",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git://github.com/feross/webtorrent-desktop.git"
|
"url": "git://github.com/webtorrent/webtorrent-desktop.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "buble src --output build",
|
"build": "buble src --output build",
|
||||||
@@ -103,9 +104,9 @@
|
|||||||
"package": "node ./bin/package.js",
|
"package": "node ./bin/package.js",
|
||||||
"prepublish": "npm run build",
|
"prepublish": "npm run build",
|
||||||
"start": "npm run build && electron .",
|
"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",
|
"test-integration": "npm run build && node ./test",
|
||||||
"update-authors": "./bin/update-authors.sh",
|
"update-authors": "./bin/update-authors.sh",
|
||||||
"watch": "nodemon --exec \"npm run start\" --ext js,pug,css --ignore build/ --ignore dist/"
|
"watch": "nodemon --exec \"npm run start\" --ext js,css --ignore build/ --ignore dist/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ module.exports = {
|
|||||||
CRASH_REPORT_URL: 'https://webtorrent.io/desktop/crash-report',
|
CRASH_REPORT_URL: 'https://webtorrent.io/desktop/crash-report',
|
||||||
TELEMETRY_URL: 'https://webtorrent.io/desktop/telemetry',
|
TELEMETRY_URL: 'https://webtorrent.io/desktop/telemetry',
|
||||||
|
|
||||||
APP_COPYRIGHT: 'Copyright © 2014-2016 ' + APP_TEAM,
|
APP_COPYRIGHT: 'Copyright © 2014-2018 ' + APP_TEAM,
|
||||||
APP_FILE_ICON: path.join(__dirname, '..', 'static', 'WebTorrentFile'),
|
APP_FILE_ICON: path.join(__dirname, '..', 'static', 'WebTorrentFile'),
|
||||||
APP_ICON: path.join(__dirname, '..', 'static', 'WebTorrent'),
|
APP_ICON: path.join(__dirname, '..', 'static', 'WebTorrent'),
|
||||||
APP_NAME: APP_NAME,
|
APP_NAME: APP_NAME,
|
||||||
@@ -60,7 +60,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
testID: 'wired',
|
testID: 'wired',
|
||||||
name: 'The WIRED CD - Rip. Sample. Mash. Share.',
|
name: 'The WIRED CD - Rip. Sample. Mash. Share',
|
||||||
posterFileName: 'wiredCd.jpg',
|
posterFileName: 'wiredCd.jpg',
|
||||||
torrentFileName: 'wiredCd.torrent'
|
torrentFileName: 'wiredCd.torrent'
|
||||||
}
|
}
|
||||||
@@ -70,9 +70,9 @@ module.exports = {
|
|||||||
|
|
||||||
DEFAULT_DOWNLOAD_PATH: getDefaultDownloadPath(),
|
DEFAULT_DOWNLOAD_PATH: getDefaultDownloadPath(),
|
||||||
|
|
||||||
GITHUB_URL: 'https://github.com/feross/webtorrent-desktop',
|
GITHUB_URL: 'https://github.com/webtorrent/webtorrent-desktop',
|
||||||
GITHUB_URL_ISSUES: 'https://github.com/feross/webtorrent-desktop/issues',
|
GITHUB_URL_ISSUES: 'https://github.com/webtorrent/webtorrent-desktop/issues',
|
||||||
GITHUB_URL_RAW: 'https://raw.githubusercontent.com/feross/webtorrent-desktop/master',
|
GITHUB_URL_RAW: 'https://raw.githubusercontent.com/webtorrent/webtorrent-desktop/master',
|
||||||
|
|
||||||
HOME_PAGE_URL: 'https://webtorrent.io',
|
HOME_PAGE_URL: 'https://webtorrent.io',
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ function downloadFinished (path) {
|
|||||||
*/
|
*/
|
||||||
function setBadge (count) {
|
function setBadge (count) {
|
||||||
if (process.platform === 'darwin' ||
|
if (process.platform === 'darwin' ||
|
||||||
process.platform === 'linux' && app.isUnityRunning()) {
|
(process.platform === 'linux' && app.isUnityRunning())) {
|
||||||
log(`setBadge: ${count}`)
|
log(`setBadge: ${count}`)
|
||||||
app.setBadgeCount(Number(count))
|
app.setBadgeCount(Number(count))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ let proc = null
|
|||||||
function checkInstall (playerPath, cb) {
|
function checkInstall (playerPath, cb) {
|
||||||
// check for VLC if external player has not been specified by the user
|
// check for VLC if external player has not been specified by the user
|
||||||
// otherwise assume the player is installed
|
// otherwise assume the player is installed
|
||||||
if (playerPath == null) return vlcCommand((err) => cb(!err))
|
if (playerPath == null) return vlcCommand(cb)
|
||||||
process.nextTick(() => cb(true))
|
process.nextTick(() => cb(null))
|
||||||
}
|
}
|
||||||
|
|
||||||
function spawn (playerPath, url, title) {
|
function spawn (playerPath, url, title) {
|
||||||
@@ -29,7 +29,6 @@ function spawn (playerPath, url, title) {
|
|||||||
if (err) return windows.main.dispatch('externalPlayerNotFound')
|
if (err) return windows.main.dispatch('externalPlayerNotFound')
|
||||||
const args = [
|
const args = [
|
||||||
'--play-and-exit',
|
'--play-and-exit',
|
||||||
'--video-on-top',
|
|
||||||
'--quiet',
|
'--quiet',
|
||||||
`--meta-title=${JSON.stringify(title)}`,
|
`--meta-title=${JSON.stringify(title)}`,
|
||||||
url
|
url
|
||||||
|
|||||||
50
src/main/folder-watcher.js
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
const chokidar = require('chokidar')
|
||||||
|
const log = require('./log')
|
||||||
|
|
||||||
|
class FolderWatcher {
|
||||||
|
constructor ({window, state}) {
|
||||||
|
this.window = window
|
||||||
|
this.state = state
|
||||||
|
this.torrentsFolderPath = null
|
||||||
|
this.watching = false
|
||||||
|
}
|
||||||
|
|
||||||
|
isEnabled () {
|
||||||
|
return this.state.saved.prefs.autoAddTorrents
|
||||||
|
}
|
||||||
|
|
||||||
|
start () {
|
||||||
|
// Stop watching previous folder before
|
||||||
|
// start watching a new one.
|
||||||
|
if (this.watching) this.stop()
|
||||||
|
|
||||||
|
const torrentsFolderPath = this.state.saved.prefs.torrentsFolderPath
|
||||||
|
this.torrentsFolderPath = torrentsFolderPath
|
||||||
|
if (!torrentsFolderPath) return
|
||||||
|
|
||||||
|
const glob = `${torrentsFolderPath}/**/*.torrent`
|
||||||
|
log('Folder Watcher: watching: ', glob)
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
ignoreInitial: true,
|
||||||
|
awaitWriteFinish: true
|
||||||
|
}
|
||||||
|
this.watcher = chokidar.watch(glob, options)
|
||||||
|
this.watcher
|
||||||
|
.on('add', (path) => {
|
||||||
|
log('Folder Watcher: added torrent: ', path)
|
||||||
|
this.window.dispatch('addTorrent', path)
|
||||||
|
})
|
||||||
|
|
||||||
|
this.watching = true
|
||||||
|
}
|
||||||
|
|
||||||
|
stop () {
|
||||||
|
log('Folder Watcher: stop.')
|
||||||
|
if (!this.watching) return
|
||||||
|
this.watcher.close()
|
||||||
|
this.watching = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = FolderWatcher
|
||||||
@@ -44,7 +44,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)
|
||||||
|
|||||||
@@ -72,13 +72,16 @@ function init () {
|
|||||||
if (err) throw err
|
if (err) throw err
|
||||||
|
|
||||||
isReady = true
|
isReady = true
|
||||||
|
const state = results.state
|
||||||
|
|
||||||
windows.main.init(results.state, {hidden: hidden})
|
windows.main.init(state, {hidden: hidden})
|
||||||
windows.webtorrent.init()
|
windows.webtorrent.init()
|
||||||
menu.init()
|
menu.init()
|
||||||
|
|
||||||
// To keep app startup fast, some code is delayed.
|
// To keep app startup fast, some code is delayed.
|
||||||
setTimeout(delayedInit, config.DELAYED_INIT)
|
setTimeout(() => {
|
||||||
|
delayedInit(state)
|
||||||
|
}, config.DELAYED_INIT)
|
||||||
|
|
||||||
// Report uncaught exceptions
|
// Report uncaught exceptions
|
||||||
process.on('uncaughtException', (err) => {
|
process.on('uncaughtException', (err) => {
|
||||||
@@ -121,17 +124,24 @@ function init () {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function delayedInit () {
|
function delayedInit (state) {
|
||||||
if (app.isQuitting) return
|
if (app.isQuitting) return
|
||||||
|
|
||||||
const announcement = require('./announcement')
|
const announcement = require('./announcement')
|
||||||
const dock = require('./dock')
|
const dock = require('./dock')
|
||||||
const updater = require('./updater')
|
const updater = require('./updater')
|
||||||
|
const FolderWatcher = require('./folder-watcher')
|
||||||
|
const folderWatcher = new FolderWatcher({window: windows.main, state})
|
||||||
|
|
||||||
announcement.init()
|
announcement.init()
|
||||||
dock.init()
|
dock.init()
|
||||||
updater.init()
|
updater.init()
|
||||||
|
|
||||||
|
ipc.setModule('folderWatcher', folderWatcher)
|
||||||
|
if (folderWatcher.isEnabled()) {
|
||||||
|
folderWatcher.start()
|
||||||
|
}
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
const userTasks = require('./user-tasks')
|
const userTasks = require('./user-tasks')
|
||||||
userTasks.init()
|
userTasks.init()
|
||||||
@@ -178,7 +188,7 @@ function onAppOpen (newArgv) {
|
|||||||
function sliceArgv (argv) {
|
function sliceArgv (argv) {
|
||||||
return argv.slice(config.IS_PRODUCTION ? 1
|
return argv.slice(config.IS_PRODUCTION ? 1
|
||||||
: config.IS_TEST ? 4
|
: config.IS_TEST ? 4
|
||||||
: 2)
|
: 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
function processArgv (argv) {
|
function processArgv (argv) {
|
||||||
@@ -198,7 +208,7 @@ function processArgv (argv) {
|
|||||||
// Ignore hidden argument, already being handled
|
// Ignore hidden argument, already being handled
|
||||||
} else if (arg.startsWith('-psn')) {
|
} else if (arg.startsWith('-psn')) {
|
||||||
// Ignore Mac launchd "process serial number" argument
|
// 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('--')) {
|
} else if (arg.startsWith('--')) {
|
||||||
// Ignore Spectron flags
|
// Ignore Spectron flags
|
||||||
} else if (arg === 'data:,') {
|
} else if (arg === 'data:,') {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
init
|
init,
|
||||||
|
setModule
|
||||||
}
|
}
|
||||||
|
|
||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
@@ -13,6 +14,14 @@ const windows = require('./windows')
|
|||||||
// Messages from the main process, to be sent once the WebTorrent process starts
|
// Messages from the main process, to be sent once the WebTorrent process starts
|
||||||
const messageQueueMainToWebTorrent = []
|
const messageQueueMainToWebTorrent = []
|
||||||
|
|
||||||
|
// Will hold modules injected from the app that will be used on fired
|
||||||
|
// IPC events.
|
||||||
|
const modules = {}
|
||||||
|
|
||||||
|
function setModule (name, module) {
|
||||||
|
modules[name] = module
|
||||||
|
}
|
||||||
|
|
||||||
function init () {
|
function init () {
|
||||||
const ipc = electron.ipcMain
|
const ipc = electron.ipcMain
|
||||||
|
|
||||||
@@ -58,7 +67,7 @@ function init () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Events
|
* Player Events
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ipc.on('onPlayerOpen', function () {
|
ipc.on('onPlayerOpen', function () {
|
||||||
@@ -106,6 +115,28 @@ function init () {
|
|||||||
thumbar.onPlayerPause()
|
thumbar.onPlayerPause()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Folder Watcher Events
|
||||||
|
*/
|
||||||
|
|
||||||
|
ipc.on('startFolderWatcher', function () {
|
||||||
|
if (!modules['folderWatcher']) {
|
||||||
|
log('IPC ERR: folderWatcher module is not defined.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
modules['folderWatcher'].start()
|
||||||
|
})
|
||||||
|
|
||||||
|
ipc.on('stopFolderWatcher', function () {
|
||||||
|
if (!modules['folderWatcher']) {
|
||||||
|
log('IPC ERR: folderWatcher module is not defined.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
modules['folderWatcher'].stop()
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shell
|
* Shell
|
||||||
*/
|
*/
|
||||||
@@ -166,8 +197,8 @@ function init () {
|
|||||||
ipc.on('checkForExternalPlayer', function (e, path) {
|
ipc.on('checkForExternalPlayer', function (e, path) {
|
||||||
const externalPlayer = require('./external-player')
|
const externalPlayer = require('./external-player')
|
||||||
|
|
||||||
externalPlayer.checkInstall(path, function (isInstalled) {
|
externalPlayer.checkInstall(path, function (err) {
|
||||||
windows.main.send('checkForExternalPlayer', isInstalled)
|
windows.main.send('checkForExternalPlayer', !err)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -278,6 +278,19 @@ function getMenuTemplate () {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Transfers',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'Pause All',
|
||||||
|
click: () => windows.main.dispatch('pauseAllTorrents')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Resume All',
|
||||||
|
click: () => windows.main.dispatch('resumeAllTorrents')
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'Help',
|
label: 'Help',
|
||||||
role: 'help',
|
role: 'help',
|
||||||
@@ -311,7 +324,7 @@ function getMenuTemplate () {
|
|||||||
]
|
]
|
||||||
|
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
// Add WebTorrent app menu (Mac)
|
// WebTorrent menu (Mac)
|
||||||
template.unshift({
|
template.unshift({
|
||||||
label: config.APP_NAME,
|
label: config.APP_NAME,
|
||||||
submenu: [
|
submenu: [
|
||||||
@@ -354,8 +367,26 @@ function getMenuTemplate () {
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
// Add Window menu (Mac)
|
// Edit menu (Mac)
|
||||||
template.splice(5, 0, {
|
template[2].submenu.push(
|
||||||
|
{
|
||||||
|
type: 'separator'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Speech',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
role: 'startspeaking'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'stopspeaking'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// Window menu (Mac)
|
||||||
|
template.splice(6, 0, {
|
||||||
role: 'window',
|
role: 'window',
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
@@ -395,7 +426,7 @@ function getMenuTemplate () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Help menu (Windows, Linux)
|
// Help menu (Windows, Linux)
|
||||||
template[4].submenu.push(
|
template[5].submenu.push(
|
||||||
{
|
{
|
||||||
type: 'separator'
|
type: 'separator'
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ function setWindowFocus (flag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initLinux () {
|
function initLinux () {
|
||||||
checkLinuxTraySupport(function (supportsTray) {
|
checkLinuxTraySupport(function (err) {
|
||||||
if (supportsTray) createTray()
|
if (!err) createTray()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,10 +55,14 @@ function checkLinuxTraySupport (cb) {
|
|||||||
// libappindicator1. If WebTorrent was installed from the deb file, we should
|
// 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.
|
// always have it. If it was installed from the zip file, we might not.
|
||||||
cp.exec('dpkg --get-selections libappindicator1', function (err, stdout) {
|
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
|
// Unfortunately there's no cleaner way, as far as I can tell, to check
|
||||||
// whether a debian package is installed:
|
// 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'))
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ const main = module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
|
const debounce = require('debounce')
|
||||||
|
|
||||||
const app = electron.app
|
const app = electron.app
|
||||||
|
|
||||||
@@ -31,16 +32,17 @@ function init (state, options) {
|
|||||||
|
|
||||||
const win = main.win = new electron.BrowserWindow({
|
const win = main.win = new electron.BrowserWindow({
|
||||||
backgroundColor: '#282828',
|
backgroundColor: '#282828',
|
||||||
|
backgroundThrottling: false, // do not throttle animations/timers when page is background
|
||||||
darkTheme: true, // Forces dark theme (GTK+3)
|
darkTheme: true, // Forces dark theme (GTK+3)
|
||||||
|
height: initialBounds.height,
|
||||||
icon: getIconPath(), // Window icon (Windows, Linux)
|
icon: getIconPath(), // Window icon (Windows, Linux)
|
||||||
minWidth: config.WINDOW_MIN_WIDTH,
|
|
||||||
minHeight: config.WINDOW_MIN_HEIGHT,
|
minHeight: config.WINDOW_MIN_HEIGHT,
|
||||||
|
minWidth: config.WINDOW_MIN_WIDTH,
|
||||||
|
show: false,
|
||||||
title: config.APP_WINDOW_TITLE,
|
title: config.APP_WINDOW_TITLE,
|
||||||
titleBarStyle: 'hidden-inset', // Hide title bar (Mac)
|
titleBarStyle: 'hidden-inset', // Hide title bar (Mac)
|
||||||
useContentSize: true, // Specify web page size without OS chrome
|
useContentSize: true, // Specify web page size without OS chrome
|
||||||
show: false,
|
|
||||||
width: initialBounds.width,
|
width: initialBounds.width,
|
||||||
height: initialBounds.height,
|
|
||||||
x: initialBounds.x,
|
x: initialBounds.x,
|
||||||
y: initialBounds.y
|
y: initialBounds.y
|
||||||
})
|
})
|
||||||
@@ -83,13 +85,13 @@ function init (state, options) {
|
|||||||
win.setMenuBarVisibility(true)
|
win.setMenuBarVisibility(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
win.on('move', function (e) {
|
win.on('move', debounce(function (e) {
|
||||||
send('windowBoundsChanged', e.sender.getBounds())
|
send('windowBoundsChanged', e.sender.getBounds())
|
||||||
})
|
}, 1000))
|
||||||
|
|
||||||
win.on('resize', function (e) {
|
win.on('resize', debounce(function (e) {
|
||||||
send('windowBoundsChanged', e.sender.getBounds())
|
send('windowBoundsChanged', e.sender.getBounds())
|
||||||
})
|
}, 1000))
|
||||||
|
|
||||||
win.on('close', function (e) {
|
win.on('close', function (e) {
|
||||||
if (process.platform !== 'darwin') {
|
if (process.platform !== 'darwin') {
|
||||||
@@ -164,8 +166,8 @@ function setBounds (bounds, maximize) {
|
|||||||
if (bounds.x === null && bounds.y === null) {
|
if (bounds.x === null && bounds.y === null) {
|
||||||
// X and Y not specified? By default, center on current screen
|
// X and Y not specified? By default, center on current screen
|
||||||
const scr = electron.screen.getDisplayMatching(main.win.getBounds())
|
const scr = electron.screen.getDisplayMatching(main.win.getBounds())
|
||||||
bounds.x = Math.round(scr.bounds.x + scr.bounds.width / 2 - bounds.width / 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)
|
bounds.y = Math.round(scr.bounds.y + (scr.bounds.height / 2) - (bounds.height / 2))
|
||||||
log('setBounds: centered to ' + JSON.stringify(bounds))
|
log('setBounds: centered to ' + JSON.stringify(bounds))
|
||||||
}
|
}
|
||||||
// Resize the window's content area (so window border doesn't need to be taken
|
// Resize the window's content area (so window border doesn't need to be taken
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ const config = require('../../config')
|
|||||||
function init () {
|
function init () {
|
||||||
const win = webtorrent.win = new electron.BrowserWindow({
|
const win = webtorrent.win = new electron.BrowserWindow({
|
||||||
backgroundColor: '#1E1E1E',
|
backgroundColor: '#1E1E1E',
|
||||||
|
backgroundThrottling: false, // do not throttle animations/timers when page is background
|
||||||
center: true,
|
center: true,
|
||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
fullscreenable: false,
|
fullscreenable: false,
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ module.exports = class ModalOKCancel extends React.Component {
|
|||||||
className='control ok'
|
className='control ok'
|
||||||
primary
|
primary
|
||||||
label={okText}
|
label={okText}
|
||||||
onClick={onOK} />
|
onClick={onOK}
|
||||||
|
autoFocus />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ module.exports = class UpdateAvailableModal extends React.Component {
|
|||||||
)
|
)
|
||||||
|
|
||||||
function handleShow () {
|
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')
|
dispatch('exitModal')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
13
src/renderer/controllers/folder-watcher-controller.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
const {ipcRenderer} = require('electron')
|
||||||
|
|
||||||
|
module.exports = class FolderWatcherController {
|
||||||
|
start () {
|
||||||
|
console.log('-- IPC: start folder watcher')
|
||||||
|
ipcRenderer.send('startFolderWatcher')
|
||||||
|
}
|
||||||
|
|
||||||
|
stop () {
|
||||||
|
console.log('-- IPC: stop folder watcher')
|
||||||
|
ipcRenderer.send('stopFolderWatcher')
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
const electron = require('electron')
|
const {ipcRenderer} = require('electron')
|
||||||
|
const telemetry = require('../lib/telemetry')
|
||||||
const ipcRenderer = electron.ipcRenderer
|
|
||||||
|
|
||||||
const Playlist = require('../lib/playlist')
|
const Playlist = require('../lib/playlist')
|
||||||
|
|
||||||
// Controls local play back: the <video>/<audio> tag and VLC
|
// Controls local play back: the <video>/<audio> tag and VLC
|
||||||
@@ -12,7 +10,7 @@ module.exports = class MediaController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mediaSuccess () {
|
mediaSuccess () {
|
||||||
this.state.playing.result = 'success'
|
telemetry.logPlayAttempt('success')
|
||||||
}
|
}
|
||||||
|
|
||||||
mediaStalled () {
|
mediaStalled () {
|
||||||
@@ -22,7 +20,7 @@ module.exports = class MediaController {
|
|||||||
mediaError (error) {
|
mediaError (error) {
|
||||||
const state = this.state
|
const state = this.state
|
||||||
if (state.location.url() === 'player') {
|
if (state.location.url() === 'player') {
|
||||||
state.playing.result = 'error'
|
telemetry.logPlayAttempt('error')
|
||||||
state.playing.location = 'error'
|
state.playing.location = 'error'
|
||||||
ipcRenderer.send('checkForExternalPlayer', state.saved.prefs.externalPlayerPath)
|
ipcRenderer.send('checkForExternalPlayer', state.saved.prefs.externalPlayerPath)
|
||||||
ipcRenderer.once('checkForExternalPlayer', function (e, isInstalled) {
|
ipcRenderer.once('checkForExternalPlayer', function (e, isInstalled) {
|
||||||
@@ -58,7 +56,10 @@ module.exports = class MediaController {
|
|||||||
const state = this.state
|
const state = this.state
|
||||||
state.playing.location = 'external'
|
state.playing.location = 'external'
|
||||||
|
|
||||||
let open = function () {
|
const onServerRunning = function () {
|
||||||
|
state.playing.isReady = true
|
||||||
|
telemetry.logPlayAttempt('external')
|
||||||
|
|
||||||
const mediaURL = Playlist.getCurrentLocalURL(state)
|
const mediaURL = Playlist.getCurrentLocalURL(state)
|
||||||
ipcRenderer.send('openExternalPlayer',
|
ipcRenderer.send('openExternalPlayer',
|
||||||
state.saved.prefs.externalPlayerPath,
|
state.saved.prefs.externalPlayerPath,
|
||||||
@@ -66,8 +67,8 @@ module.exports = class MediaController {
|
|||||||
state.window.title)
|
state.window.title)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.server != null) open()
|
if (state.server != null) onServerRunning()
|
||||||
else ipcRenderer.once('wt-server-running', open)
|
else ipcRenderer.once('wt-server-running', onServerRunning)
|
||||||
}
|
}
|
||||||
|
|
||||||
externalPlayerNotFound () {
|
externalPlayerNotFound () {
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ module.exports = class PlaybackController {
|
|||||||
// * Stream, if not already fully downloaded
|
// * Stream, if not already fully downloaded
|
||||||
// * If no file index is provided, restore the most recently viewed file or autoplay the first
|
// * If no file index is provided, restore the most recently viewed file or autoplay the first
|
||||||
playFile (infoHash, index /* optional */) {
|
playFile (infoHash, index /* optional */) {
|
||||||
|
this.pauseActiveTorrents(infoHash)
|
||||||
|
|
||||||
const state = this.state
|
const state = this.state
|
||||||
if (state.location.url() === 'player') {
|
if (state.location.url() === 'player') {
|
||||||
this.updatePlayer(infoHash, index, false, (err) => {
|
this.updatePlayer(infoHash, index, false, (err) => {
|
||||||
@@ -84,15 +86,26 @@ module.exports = class PlaybackController {
|
|||||||
else this.pause()
|
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)
|
// Play next file in list (if any)
|
||||||
nextTrack () {
|
nextTrack () {
|
||||||
const state = this.state
|
const state = this.state
|
||||||
if (Playlist.hasNext(state) && state.playing.location !== 'external') {
|
if (Playlist.hasNext(state) && state.playing.location !== 'external') {
|
||||||
this.updatePlayer(
|
this.updatePlayer(
|
||||||
state.playing.infoHash, Playlist.getNextIndex(state), false, (err) => {
|
state.playing.infoHash, Playlist.getNextIndex(state), false, (err) => {
|
||||||
if (err) dispatch('error', err)
|
if (err) dispatch('error', err)
|
||||||
else this.play()
|
else this.play()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,6 +224,7 @@ module.exports = class PlaybackController {
|
|||||||
const torrentSummary = TorrentSummary.getByKey(state, infoHash)
|
const torrentSummary = TorrentSummary.getByKey(state, infoHash)
|
||||||
|
|
||||||
state.playing.infoHash = torrentSummary.infoHash
|
state.playing.infoHash = torrentSummary.infoHash
|
||||||
|
state.playing.isReady = false
|
||||||
|
|
||||||
// update UI to show pending playback
|
// update UI to show pending playback
|
||||||
sound.play('PLAY')
|
sound.play('PLAY')
|
||||||
@@ -222,6 +236,8 @@ module.exports = class PlaybackController {
|
|||||||
|
|
||||||
// Starts WebTorrent server for media streaming
|
// Starts WebTorrent server for media streaming
|
||||||
startServer (torrentSummary) {
|
startServer (torrentSummary) {
|
||||||
|
const state = this.state
|
||||||
|
|
||||||
if (torrentSummary.status === 'paused') {
|
if (torrentSummary.status === 'paused') {
|
||||||
dispatch('startTorrentingSummary', torrentSummary.torrentKey)
|
dispatch('startTorrentingSummary', torrentSummary.torrentKey)
|
||||||
ipcRenderer.once('wt-ready-' + torrentSummary.infoHash,
|
ipcRenderer.once('wt-ready-' + torrentSummary.infoHash,
|
||||||
@@ -232,6 +248,7 @@ module.exports = class PlaybackController {
|
|||||||
|
|
||||||
function onTorrentReady () {
|
function onTorrentReady () {
|
||||||
ipcRenderer.send('wt-start-server', torrentSummary.infoHash)
|
ipcRenderer.send('wt-start-server', torrentSummary.infoHash)
|
||||||
|
ipcRenderer.once('wt-server-running', () => { state.playing.isReady = true })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,7 +271,7 @@ module.exports = class PlaybackController {
|
|||||||
state.playing.fileIndex = index
|
state.playing.fileIndex = index
|
||||||
state.playing.type = TorrentPlayer.isVideo(fileSummary) ? 'video'
|
state.playing.type = TorrentPlayer.isVideo(fileSummary) ? 'video'
|
||||||
: TorrentPlayer.isAudio(fileSummary) ? 'audio'
|
: TorrentPlayer.isAudio(fileSummary) ? 'audio'
|
||||||
: 'other'
|
: 'other'
|
||||||
|
|
||||||
// pick up where we left off
|
// pick up where we left off
|
||||||
let jumpToTime = 0
|
let jumpToTime = 0
|
||||||
@@ -268,8 +285,16 @@ module.exports = class PlaybackController {
|
|||||||
state.playing.jumpToTime = jumpToTime
|
state.playing.jumpToTime = jumpToTime
|
||||||
|
|
||||||
// if it's audio, parse out the metadata (artist, title, etc)
|
// if it's audio, parse out the metadata (artist, title, etc)
|
||||||
if (state.playing.type === 'audio' && !fileSummary.audioInfo) {
|
if (torrentSummary.status === 'paused') {
|
||||||
ipcRenderer.send('wt-get-audio-metadata', torrentSummary.infoHash, index)
|
ipcRenderer.once('wt-ready-' + torrentSummary.infoHash, getAudioMetadata)
|
||||||
|
} else {
|
||||||
|
getAudioMetadata()
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAudioMetadata () {
|
||||||
|
if (state.playing.type === 'audio' && !fileSummary.audioInfo) {
|
||||||
|
ipcRenderer.send('wt-get-audio-metadata', torrentSummary.infoHash, index)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it's video, check for subtitles files that are done downloading
|
// if it's video, check for subtitles files that are done downloading
|
||||||
@@ -312,12 +337,7 @@ module.exports = class PlaybackController {
|
|||||||
// Save volume (this session only, not in state.saved)
|
// Save volume (this session only, not in state.saved)
|
||||||
state.previousVolume = state.playing.volume
|
state.previousVolume = state.playing.volume
|
||||||
|
|
||||||
// Telemetry: track what happens after the user clicks play
|
if (!state.playing.isReady) telemetry.logPlayAttempt('abandoned') // user gave up waiting
|
||||||
const result = state.playing.result // 'success' or 'error'
|
|
||||||
if (result === 'success') telemetry.logPlayAttempt('success') // first frame displayed
|
|
||||||
else if (result === 'error') telemetry.logPlayAttempt('error') // codec missing, etc
|
|
||||||
else if (result === undefined) telemetry.logPlayAttempt('abandoned') // user gave up waiting
|
|
||||||
else console.error('Unknown state.playing.result', state.playing.result)
|
|
||||||
|
|
||||||
// Reset the window contents back to the home screen
|
// Reset the window contents back to the home screen
|
||||||
state.playing = State.getDefaultPlayState()
|
state.playing = State.getDefaultPlayState()
|
||||||
@@ -334,6 +354,11 @@ module.exports = class PlaybackController {
|
|||||||
|
|
||||||
ipcRenderer.send('onPlayerClose')
|
ipcRenderer.send('onPlayerClose')
|
||||||
|
|
||||||
|
// Playback Priority: resume previously paused downloads.
|
||||||
|
if (this.state.saved.prefs.highestPlaybackPriority) {
|
||||||
|
dispatch('resumePausedTorrents')
|
||||||
|
}
|
||||||
|
|
||||||
this.update()
|
this.update()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,11 +121,66 @@ module.exports = class TorrentListController {
|
|||||||
torrentSummary.status = 'new'
|
torrentSummary.status = 'new'
|
||||||
this.startTorrentingSummary(torrentSummary.torrentKey)
|
this.startTorrentingSummary(torrentSummary.torrentKey)
|
||||||
sound.play('ENABLE')
|
sound.play('ENABLE')
|
||||||
} else {
|
return
|
||||||
torrentSummary.status = 'paused'
|
|
||||||
ipcRenderer.send('wt-stop-torrenting', torrentSummary.infoHash)
|
|
||||||
sound.play('DISABLE')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.pauseTorrent(torrentSummary, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
pauseAllTorrents () {
|
||||||
|
this.state.saved.torrents.forEach((torrentSummary) => {
|
||||||
|
if (torrentSummary.status === 'downloading' ||
|
||||||
|
torrentSummary.status === 'seeding') {
|
||||||
|
torrentSummary.status = 'paused'
|
||||||
|
ipcRenderer.send('wt-stop-torrenting', torrentSummary.infoHash)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
sound.play('DISABLE')
|
||||||
|
}
|
||||||
|
|
||||||
|
resumeAllTorrents () {
|
||||||
|
this.state.saved.torrents.forEach((torrentSummary) => {
|
||||||
|
if (torrentSummary.status === 'paused') {
|
||||||
|
torrentSummary.status = 'downloading'
|
||||||
|
this.startTorrentingSummary(torrentSummary.torrentKey)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
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')
|
||||||
|
if (!this.state.saved.torrentsToResume || !this.state.saved.torrentsToResume.length) return
|
||||||
|
this.state.saved.torrentsToResume.map((infoHash) => {
|
||||||
|
this.toggleTorrent(infoHash)
|
||||||
|
})
|
||||||
|
|
||||||
|
// reset paused torrents
|
||||||
|
this.state.saved.torrentsToResume = []
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleTorrentFile (infoHash, index) {
|
toggleTorrentFile (infoHash, index) {
|
||||||
@@ -220,7 +275,8 @@ module.exports = class TorrentListController {
|
|||||||
|
|
||||||
menu.append(new electron.remote.MenuItem({
|
menu.append(new electron.remote.MenuItem({
|
||||||
label: 'Save Torrent File As...',
|
label: 'Save Torrent File As...',
|
||||||
click: () => dispatch('saveTorrentFileAs', torrentSummary.torrentKey)
|
click: () => dispatch('saveTorrentFileAs', torrentSummary.torrentKey),
|
||||||
|
enabled: torrentSummary.torrentFileName != null
|
||||||
}))
|
}))
|
||||||
|
|
||||||
menu.popup(electron.remote.getCurrentWindow())
|
menu.popup(electron.remote.getCurrentWindow())
|
||||||
@@ -259,7 +315,7 @@ module.exports = class TorrentListController {
|
|||||||
|
|
||||||
// Recursively finds {name, path, size} for all files in a folder
|
// Recursively finds {name, path, size} for all files in a folder
|
||||||
// Calls `cb` on success, calls `onError` on failure
|
// Calls `cb` on success, calls `onError` on failure
|
||||||
function findFilesRecursive (paths, cb) {
|
function findFilesRecursive (paths, cb_) {
|
||||||
if (paths.length > 1) {
|
if (paths.length > 1) {
|
||||||
let numComplete = 0
|
let numComplete = 0
|
||||||
let ret = []
|
let ret = []
|
||||||
@@ -268,7 +324,7 @@ function findFilesRecursive (paths, cb) {
|
|||||||
ret.push(...fileObjs)
|
ret.push(...fileObjs)
|
||||||
if (++numComplete === paths.length) {
|
if (++numComplete === paths.length) {
|
||||||
ret.sort((a, b) => a.path < b.path ? -1 : a.path > b.path)
|
ret.sort((a, b) => a.path < b.path ? -1 : a.path > b.path)
|
||||||
cb(ret)
|
cb_(ret)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -282,7 +338,7 @@ function findFilesRecursive (paths, cb) {
|
|||||||
// Files: return name, path, and size
|
// Files: return name, path, and size
|
||||||
if (!stat.isDirectory()) {
|
if (!stat.isDirectory()) {
|
||||||
const filePath = fileOrFolder
|
const filePath = fileOrFolder
|
||||||
return cb([{
|
return cb_([{
|
||||||
name: path.basename(filePath),
|
name: path.basename(filePath),
|
||||||
path: filePath,
|
path: filePath,
|
||||||
size: stat.size
|
size: stat.size
|
||||||
@@ -294,7 +350,7 @@ function findFilesRecursive (paths, cb) {
|
|||||||
fs.readdir(folderPath, function (err, fileNames) {
|
fs.readdir(folderPath, function (err, fileNames) {
|
||||||
if (err) return dispatch('error', err)
|
if (err) return dispatch('error', err)
|
||||||
const paths = fileNames.map((fileName) => path.join(folderPath, fileName))
|
const paths = fileNames.map((fileName) => path.join(folderPath, fileName))
|
||||||
findFilesRecursive(paths, cb)
|
findFilesRecursive(paths, cb_)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -388,7 +388,8 @@ function toggleMenu (location) {
|
|||||||
if (state.playing.location !== 'local') {
|
if (state.playing.location !== 'local') {
|
||||||
throw new CastingError(
|
throw new CastingError(
|
||||||
`You can't connect to ${location} when already connected to another device`
|
`You can't connect to ${location} when already connected to another device`
|
||||||
) }
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Find all cast devices of the given type
|
// Find all cast devices of the given type
|
||||||
const player = getPlayer(location)
|
const player = getPlayer(location)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
const semver = require('semver')
|
const semver = require('semver')
|
||||||
|
|
||||||
const config = require('../../config')
|
const config = require('../../config')
|
||||||
@@ -18,30 +19,15 @@ function run (state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const version = state.saved.version
|
const version = state.saved.version
|
||||||
|
const saved = state.saved
|
||||||
|
|
||||||
if (semver.lt(version, '0.7.0')) {
|
if (semver.lt(version, '0.7.0')) migrate_0_7_0(saved)
|
||||||
migrate_0_7_0(state.saved)
|
if (semver.lt(version, '0.7.2')) migrate_0_7_2(saved)
|
||||||
}
|
if (semver.lt(version, '0.11.0')) migrate_0_11_0(saved)
|
||||||
|
if (semver.lt(version, '0.12.0')) migrate_0_12_0(saved)
|
||||||
if (semver.lt(version, '0.7.2')) {
|
if (semver.lt(version, '0.14.0')) migrate_0_14_0(saved)
|
||||||
migrate_0_7_2(state.saved)
|
if (semver.lt(version, '0.17.0')) migrate_0_17_0(saved)
|
||||||
}
|
if (semver.lt(version, '0.17.2')) migrate_0_17_2(saved)
|
||||||
|
|
||||||
if (semver.lt(version, '0.11.0')) {
|
|
||||||
migrate_0_11_0(state.saved)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (semver.lt(version, '0.12.0')) {
|
|
||||||
migrate_0_12_0(state.saved)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (semver.lt(version, '0.14.0')) {
|
|
||||||
migrate_0_14_0(state.saved)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (semver.lt(version, '0.17.0')) {
|
|
||||||
migrate_0_17_0(state.saved)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Config is now on the new version
|
// Config is now on the new version
|
||||||
state.saved.version = config.APP_VERSION
|
state.saved.version = config.APP_VERSION
|
||||||
@@ -92,7 +78,7 @@ function migrate_0_7_0 (saved) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fix exception caused by incorrect file ordering.
|
// 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.defaultPlayFileIndex
|
||||||
delete ts.files
|
delete ts.files
|
||||||
delete ts.selections
|
delete ts.selections
|
||||||
@@ -125,7 +111,7 @@ function migrate_0_12_0 (saved) {
|
|||||||
|
|
||||||
// Undo a terrible bug where clicking Play on a default torrent on a fresh
|
// Undo a terrible bug where clicking Play on a default torrent on a fresh
|
||||||
// install results in a "path missing" error
|
// 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 = [
|
const defaultTorrentFiles = [
|
||||||
'6a9759bffd5c0af65319979fb7832189f4f3c35d.torrent',
|
'6a9759bffd5c0af65319979fb7832189f4f3c35d.torrent',
|
||||||
'88594aaacbde40ef3e2510c47374ec0aa396c08e.torrent',
|
'88594aaacbde40ef3e2510c47374ec0aa396c08e.torrent',
|
||||||
@@ -163,3 +149,60 @@ 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/webtorrent/webtorrent-desktop/issues/905
|
||||||
|
|
||||||
|
const cpFile = require('cp-file')
|
||||||
|
const rimraf = require('rimraf')
|
||||||
|
|
||||||
|
const OLD_NAME = 'The WIRED CD - Rip. Sample. Mash. Share.'
|
||||||
|
const NEW_NAME = 'The WIRED CD - Rip. Sample. Mash. Share'
|
||||||
|
|
||||||
|
const OLD_HASH = '3ba219a8634bf7bae3d848192b2da75ae995589d'
|
||||||
|
const NEW_HASH = 'a88fda5954e89178c372716a6a78b8180ed4dad3'
|
||||||
|
|
||||||
|
const ts = saved.torrents.find((ts) => {
|
||||||
|
return ts.infoHash === OLD_HASH
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!ts) return // Wired CD torrent does not exist
|
||||||
|
|
||||||
|
// New versions of WebTorrent ship with a fixed torrent file. Let's fix up the
|
||||||
|
// name in existing versions of WebTorrent.
|
||||||
|
ts.name = ts.displayName = NEW_NAME
|
||||||
|
ts.files.forEach((file) => {
|
||||||
|
file.path = file.path.replace(OLD_NAME, NEW_NAME)
|
||||||
|
})
|
||||||
|
|
||||||
|
// Changing the torrent name causes the info hash to change
|
||||||
|
ts.infoHash = NEW_HASH
|
||||||
|
ts.magnetURI = ts.magnetURI.replace(OLD_HASH, NEW_HASH)
|
||||||
|
|
||||||
|
try {
|
||||||
|
fs.renameSync(
|
||||||
|
path.join(config.POSTER_PATH, ts.posterFileName),
|
||||||
|
path.join(config.POSTER_PATH, NEW_HASH + '.jpg')
|
||||||
|
)
|
||||||
|
} catch (err) {}
|
||||||
|
ts.posterFileName = NEW_HASH + '.jpg'
|
||||||
|
|
||||||
|
rimraf.sync(path.join(config.TORRENT_PATH, ts.torrentFileName))
|
||||||
|
cpFile.sync(
|
||||||
|
path.join(config.STATIC_PATH, 'wiredCd.torrent'),
|
||||||
|
path.join(config.TORRENT_PATH, NEW_HASH + '.torrent')
|
||||||
|
)
|
||||||
|
ts.torrentFileName = NEW_HASH + '.torrent'
|
||||||
|
|
||||||
|
if (ts.path) {
|
||||||
|
// If torrent folder already exists on disk, try to rename it
|
||||||
|
try {
|
||||||
|
fs.renameSync(
|
||||||
|
path.join(ts.path, OLD_NAME),
|
||||||
|
path.join(ts.path, NEW_NAME)
|
||||||
|
)
|
||||||
|
} catch (err) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ function getDefaultPlayState () {
|
|||||||
type: null, /* 'audio' or 'video', could be 'other' if ever support eg streaming to VLC */
|
type: null, /* 'audio' or 'video', could be 'other' if ever support eg streaming to VLC */
|
||||||
currentTime: 0, /* seconds */
|
currentTime: 0, /* seconds */
|
||||||
duration: 1, /* seconds */
|
duration: 1, /* seconds */
|
||||||
|
isReady: false,
|
||||||
isPaused: true,
|
isPaused: true,
|
||||||
isStalled: false,
|
isStalled: false,
|
||||||
lastTimeUpdate: 0, /* Unix time in ms */
|
lastTimeUpdate: 0, /* Unix time in ms */
|
||||||
@@ -120,9 +121,13 @@ function setupStateSaved (cb) {
|
|||||||
isFileHandler: false,
|
isFileHandler: false,
|
||||||
openExternalPlayer: false,
|
openExternalPlayer: false,
|
||||||
externalPlayerPath: null,
|
externalPlayerPath: null,
|
||||||
startup: false
|
startup: false,
|
||||||
|
autoAddTorrents: false,
|
||||||
|
torrentsFolderPath: '',
|
||||||
|
highestPlaybackPriority: true
|
||||||
},
|
},
|
||||||
torrents: config.DEFAULT_TORRENTS.map(createTorrentObject),
|
torrents: config.DEFAULT_TORRENTS.map(createTorrentObject),
|
||||||
|
torrentsToResume: [],
|
||||||
version: config.APP_VERSION /* make sure we can upgrade gracefully later */
|
version: config.APP_VERSION /* make sure we can upgrade gracefully later */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ function reset () {
|
|||||||
minVersion: config.APP_VERSION,
|
minVersion: config.APP_VERSION,
|
||||||
total: 0,
|
total: 0,
|
||||||
success: 0,
|
success: 0,
|
||||||
timeout: 0,
|
|
||||||
error: 0,
|
error: 0,
|
||||||
|
external: 0,
|
||||||
abandoned: 0
|
abandoned: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -210,10 +210,10 @@ function getElemString (elem) {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
// The user pressed play. It either worked, timed out, or showed the
|
// The user pressed play. Did it work, display an error,
|
||||||
// 'Play in VLC' codec error
|
// open an external player or did user abandon the attempt?
|
||||||
function logPlayAttempt (result) {
|
function logPlayAttempt (result) {
|
||||||
if (!['success', 'timeout', 'error', 'abandoned'].includes(result)) {
|
if (!['success', 'error', 'external', 'abandoned'].includes(result)) {
|
||||||
return console.error('Unknown play attempt result', result)
|
return console.error('Unknown play attempt result', result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,11 +33,18 @@ function isVideo (file) {
|
|||||||
function isAudio (file) {
|
function isAudio (file) {
|
||||||
return [
|
return [
|
||||||
'.aac',
|
'.aac',
|
||||||
|
'.aiff',
|
||||||
|
'.ape',
|
||||||
'.ac3',
|
'.ac3',
|
||||||
|
'.flac',
|
||||||
|
'.m4a',
|
||||||
|
'.mp2',
|
||||||
'.mp3',
|
'.mp3',
|
||||||
|
'.oga',
|
||||||
'.ogg',
|
'.ogg',
|
||||||
|
'.opus',
|
||||||
'.wav',
|
'.wav',
|
||||||
'.m4a'
|
'.wma'
|
||||||
].includes(getFileExtension(file))
|
].includes(getFileExtension(file))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,39 +3,145 @@ module.exports = torrentPoster
|
|||||||
const captureFrame = require('capture-frame')
|
const captureFrame = require('capture-frame')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
|
const mediaExtensions = {
|
||||||
|
audio: ['.aac', '.asf', '.flac', '.m2a', '.m4a', '.mp2', '.mp4', '.mp3', '.oga', '.ogg', '.opus',
|
||||||
|
'.wma', '.wav', '.wv', '.wvp'],
|
||||||
|
video: ['.mp4', '.m4v', '.webm', '.mov', '.mkv'],
|
||||||
|
image: ['.gif', '.jpg', '.jpeg', '.png']
|
||||||
|
}
|
||||||
|
|
||||||
function torrentPoster (torrent, cb) {
|
function torrentPoster (torrent, cb) {
|
||||||
// First, try to use a poster image if available
|
// First, try to use a poster image if available
|
||||||
const posterFile = torrent.files.filter(function (file) {
|
const posterFile = torrent.files.filter(function (file) {
|
||||||
return /^poster\.(jpg|png|gif)$/.test(file.name)
|
return /^poster\.(jpg|png|gif)$/.test(file.name)
|
||||||
})[0]
|
})[0]
|
||||||
if (posterFile) return torrentPosterFromImage(posterFile, torrent, cb)
|
if (posterFile) return extractPoster(posterFile, cb)
|
||||||
|
|
||||||
// Second, try to use the largest video file
|
// 'score' each media type based on total size present in torrent
|
||||||
// Filter out file formats that the <video> tag definitely can't play
|
const bestScore = ['audio', 'video', 'image'].map(mediaType => {
|
||||||
const videoFile = getLargestFileByExtension(torrent, ['.mp4', '.m4v', '.webm', '.mov', '.mkv'])
|
return {
|
||||||
if (videoFile) return torrentPosterFromVideo(videoFile, torrent, cb)
|
type: mediaType,
|
||||||
|
size: calculateDataLengthByExtension(torrent, mediaExtensions[mediaType])}
|
||||||
|
}).sort((a, b) => { // sort descending on size
|
||||||
|
return b.size - a.size
|
||||||
|
})[0]
|
||||||
|
|
||||||
// Third, try to use the largest image file
|
if (bestScore.size === 0) {
|
||||||
const imgFile = getLargestFileByExtension(torrent, ['.gif', '.jpg', '.jpeg', '.png'])
|
// Admit defeat, no video, audio or image had a significant presence
|
||||||
if (imgFile) return torrentPosterFromImage(imgFile, torrent, cb)
|
return cb(new Error('Cannot generate a poster from any files in the torrent'))
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: generate a waveform from the largest sound file
|
// Based on which media type is dominant we select the corresponding poster function
|
||||||
// Finally, admit defeat
|
switch (bestScore.type) {
|
||||||
return cb(new Error('Cannot generate a poster from any files in the torrent'))
|
case 'audio':
|
||||||
|
return torrentPosterFromAudio(torrent, cb)
|
||||||
|
case 'image':
|
||||||
|
return torrentPosterFromImage(torrent, cb)
|
||||||
|
case 'video':
|
||||||
|
return torrentPosterFromVideo(torrent, cb)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate the total data size of file matching one of the provided extensions
|
||||||
|
* @param torrent
|
||||||
|
* @param extensions List of extension to match
|
||||||
|
* @returns {number} total size, of matches found (>= 0)
|
||||||
|
*/
|
||||||
|
function calculateDataLengthByExtension (torrent, extensions) {
|
||||||
|
const files = filterOnExtension(torrent, extensions)
|
||||||
|
if (files.length === 0) return 0
|
||||||
|
return files
|
||||||
|
.map(file => file.length)
|
||||||
|
.reduce((a, b) => {
|
||||||
|
return a + b
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the largest file of a given torrent, filtered by provided extension
|
||||||
|
* @param torrent Torrent to search in
|
||||||
|
* @param extensions Extension whitelist filter
|
||||||
|
* @returns Torrent file object
|
||||||
|
*/
|
||||||
function getLargestFileByExtension (torrent, extensions) {
|
function getLargestFileByExtension (torrent, extensions) {
|
||||||
const files = torrent.files.filter(function (file) {
|
const files = filterOnExtension(torrent, extensions)
|
||||||
const extname = path.extname(file.name).toLowerCase()
|
|
||||||
return extensions.indexOf(extname) !== -1
|
|
||||||
})
|
|
||||||
if (files.length === 0) return undefined
|
if (files.length === 0) return undefined
|
||||||
return files.reduce(function (a, b) {
|
return files.reduce((a, b) => {
|
||||||
return a.length > b.length ? a : b
|
return a.length > b.length ? a : b
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function torrentPosterFromVideo (file, torrent, cb) {
|
/**
|
||||||
|
* Filter file on a list extension, can be used to find al image files
|
||||||
|
* @param torrent Torrent to filter files from
|
||||||
|
* @param extensions File extensions to filter on
|
||||||
|
* @returns {number} Array of torrent file objects matching one of the given extensions
|
||||||
|
*/
|
||||||
|
function filterOnExtension (torrent, extensions) {
|
||||||
|
return torrent.files.filter(file => {
|
||||||
|
const extname = path.extname(file.name).toLowerCase()
|
||||||
|
return extensions.indexOf(extname) !== -1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a score how likely the file is suitable as a poster
|
||||||
|
* @param imgFile File object of an image
|
||||||
|
* @returns {number} Score, higher score is a better match
|
||||||
|
*/
|
||||||
|
function scoreAudioCoverFile (imgFile) {
|
||||||
|
const fileName = path.basename(imgFile.name, path.extname(imgFile.name)).toLowerCase()
|
||||||
|
const relevanceScore = {
|
||||||
|
cover: 80,
|
||||||
|
folder: 80,
|
||||||
|
album: 80,
|
||||||
|
front: 80,
|
||||||
|
back: 20
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let keyword in relevanceScore) {
|
||||||
|
if (fileName === keyword) {
|
||||||
|
return relevanceScore[keyword]
|
||||||
|
}
|
||||||
|
if (fileName.indexOf(keyword) !== -1) {
|
||||||
|
return 0.8 * relevanceScore[keyword]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function torrentPosterFromAudio (torrent, cb) {
|
||||||
|
const imageFiles = filterOnExtension(torrent, mediaExtensions.image)
|
||||||
|
|
||||||
|
const bestCover = imageFiles.map(file => {
|
||||||
|
return {
|
||||||
|
file: file,
|
||||||
|
score: scoreAudioCoverFile(file)
|
||||||
|
}
|
||||||
|
}).reduce((a, b) => {
|
||||||
|
if (a.score > b.score) {
|
||||||
|
return a
|
||||||
|
}
|
||||||
|
if (b.score > a.score) {
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
// If score is equal, pick the largest file, aiming for highest resolution
|
||||||
|
if (a.file.length > b.file.length) {
|
||||||
|
return a
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!bestCover) return cb(new Error('Generated poster contains no data'))
|
||||||
|
|
||||||
|
const extname = path.extname(bestCover.file.name)
|
||||||
|
bestCover.file.getBuffer((err, buf) => cb(err, buf, extname))
|
||||||
|
}
|
||||||
|
|
||||||
|
function torrentPosterFromVideo (torrent, cb) {
|
||||||
|
const file = getLargestFileByExtension(torrent, mediaExtensions.video)
|
||||||
|
|
||||||
const index = torrent.files.indexOf(file)
|
const index = torrent.files.indexOf(file)
|
||||||
|
|
||||||
const server = torrent.createServer(0)
|
const server = torrent.createServer(0)
|
||||||
@@ -77,7 +183,12 @@ function torrentPosterFromVideo (file, torrent, cb) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function torrentPosterFromImage (file, torrent, cb) {
|
function torrentPosterFromImage (torrent, cb) {
|
||||||
const extname = path.extname(file.name)
|
const file = getLargestFileByExtension(torrent, mediaExtensions.image)
|
||||||
file.getBuffer((err, buf) => cb(err, buf, extname))
|
extractPoster(file, cb)
|
||||||
|
}
|
||||||
|
|
||||||
|
function extractPoster (file, cb) {
|
||||||
|
const extname = path.extname(file.name)
|
||||||
|
file.getBuffer((err, buf) => { return cb(err, buf, extname) })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Perf optimization: Hook into require() to modify how certain modules load:
|
* Perf optimization: Hook into require() to modify how certain modules load:
|
||||||
*
|
*
|
||||||
* - `lodash/merge` (used by `material-ui`) causes 119 require() calls at startup,
|
|
||||||
* which take ~100ms. Replace it with `lodash.merge` which is equivalent.
|
|
||||||
* See: https://github.com/callemall/material-ui/pull/4380#issuecomment-250894552
|
|
||||||
*
|
|
||||||
* - `inline-style-prefixer` (used by `material-ui`) takes ~40ms. It is not
|
* - `inline-style-prefixer` (used by `material-ui`) takes ~40ms. It is not
|
||||||
* actually used because auto-prefixing is disabled with
|
* actually used because auto-prefixing is disabled with
|
||||||
* `darkBaseTheme.userAgent = false`. Return a fake object.
|
* `darkBaseTheme.userAgent = false`. Return a fake object.
|
||||||
@@ -12,7 +8,6 @@
|
|||||||
let Module = require('module')
|
let Module = require('module')
|
||||||
const _require = Module.prototype.require
|
const _require = Module.prototype.require
|
||||||
Module.prototype.require = function (id) {
|
Module.prototype.require = function (id) {
|
||||||
if (id === 'lodash/merge') id = 'lodash.merge'
|
|
||||||
if (id === 'inline-style-prefixer') return {}
|
if (id === 'inline-style-prefixer') return {}
|
||||||
return _require.apply(this, arguments)
|
return _require.apply(this, arguments)
|
||||||
}
|
}
|
||||||
@@ -29,6 +24,7 @@ const State = require('./lib/state')
|
|||||||
State.load(onState)
|
State.load(onState)
|
||||||
|
|
||||||
const createGetter = require('fn-getter')
|
const createGetter = require('fn-getter')
|
||||||
|
const debounce = require('debounce')
|
||||||
const dragDrop = require('drag-drop')
|
const dragDrop = require('drag-drop')
|
||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
@@ -115,6 +111,10 @@ function onState (err, _state) {
|
|||||||
update: createGetter(() => {
|
update: createGetter(() => {
|
||||||
const UpdateController = require('./controllers/update-controller')
|
const UpdateController = require('./controllers/update-controller')
|
||||||
return new UpdateController(state)
|
return new UpdateController(state)
|
||||||
|
}),
|
||||||
|
folderWatcher: createGetter(() => {
|
||||||
|
const FolderWatcherController = require('./controllers/folder-watcher-controller')
|
||||||
|
return new FolderWatcherController()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,6 +150,18 @@ function onState (err, _state) {
|
|||||||
// ...same thing if you paste a torrent
|
// ...same thing if you paste a torrent
|
||||||
document.addEventListener('paste', onPaste)
|
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
|
// ...focus and blur. Needed to show correct dock icon text ('badge') in OSX
|
||||||
window.addEventListener('focus', onFocus)
|
window.addEventListener('focus', onFocus)
|
||||||
window.addEventListener('blur', onBlur)
|
window.addEventListener('blur', onBlur)
|
||||||
@@ -230,6 +242,8 @@ const dispatchHandlers = {
|
|||||||
'showCreateTorrent': (paths) => controllers.torrentList().showCreateTorrent(paths),
|
'showCreateTorrent': (paths) => controllers.torrentList().showCreateTorrent(paths),
|
||||||
'createTorrent': (options) => controllers.torrentList().createTorrent(options),
|
'createTorrent': (options) => controllers.torrentList().createTorrent(options),
|
||||||
'toggleTorrent': (infoHash) => controllers.torrentList().toggleTorrent(infoHash),
|
'toggleTorrent': (infoHash) => controllers.torrentList().toggleTorrent(infoHash),
|
||||||
|
'pauseAllTorrents': () => controllers.torrentList().pauseAllTorrents(),
|
||||||
|
'resumeAllTorrents': () => controllers.torrentList().resumeAllTorrents(),
|
||||||
'toggleTorrentFile': (infoHash, index) =>
|
'toggleTorrentFile': (infoHash, index) =>
|
||||||
controllers.torrentList().toggleTorrentFile(infoHash, index),
|
controllers.torrentList().toggleTorrentFile(infoHash, index),
|
||||||
'confirmDeleteTorrent': (infoHash, deleteData) =>
|
'confirmDeleteTorrent': (infoHash, deleteData) =>
|
||||||
@@ -244,6 +258,8 @@ const dispatchHandlers = {
|
|||||||
controllers.torrentList().startTorrentingSummary(torrentKey),
|
controllers.torrentList().startTorrentingSummary(torrentKey),
|
||||||
'saveTorrentFileAs': (torrentKey) =>
|
'saveTorrentFileAs': (torrentKey) =>
|
||||||
controllers.torrentList().saveTorrentFileAs(torrentKey),
|
controllers.torrentList().saveTorrentFileAs(torrentKey),
|
||||||
|
'prioritizeTorrent': (infoHash) => controllers.torrentList().prioritizeTorrent(infoHash),
|
||||||
|
'resumePausedTorrents': () => controllers.torrentList().resumePausedTorrents(),
|
||||||
|
|
||||||
// Playback
|
// Playback
|
||||||
'playFile': (infoHash, index) => controllers.playback().playFile(infoHash, index),
|
'playFile': (infoHash, index) => controllers.playback().playFile(infoHash, index),
|
||||||
@@ -284,6 +300,8 @@ const dispatchHandlers = {
|
|||||||
'preferences': () => controllers.prefs().show(),
|
'preferences': () => controllers.prefs().show(),
|
||||||
'updatePreferences': (key, value) => controllers.prefs().update(key, value),
|
'updatePreferences': (key, value) => controllers.prefs().update(key, value),
|
||||||
'checkDownloadPath': checkDownloadPath,
|
'checkDownloadPath': checkDownloadPath,
|
||||||
|
'startFolderWatcher': () => controllers.folderWatcher().start(),
|
||||||
|
'stopFolderWatcher': () => controllers.folderWatcher().stop(),
|
||||||
|
|
||||||
// Update (check for new versions on Linux, where there's no auto updater)
|
// Update (check for new versions on Linux, where there's no auto updater)
|
||||||
'updateAvailable': (version) => controllers.update().updateAvailable(version),
|
'updateAvailable': (version) => controllers.update().updateAvailable(version),
|
||||||
@@ -344,6 +362,7 @@ function setupIpc () {
|
|||||||
ipcRenderer.on('wt-infohash', (e, ...args) => tc.torrentInfoHash(...args))
|
ipcRenderer.on('wt-infohash', (e, ...args) => tc.torrentInfoHash(...args))
|
||||||
ipcRenderer.on('wt-metadata', (e, ...args) => tc.torrentMetadata(...args))
|
ipcRenderer.on('wt-metadata', (e, ...args) => tc.torrentMetadata(...args))
|
||||||
ipcRenderer.on('wt-done', (e, ...args) => tc.torrentDone(...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-warning', (e, ...args) => tc.torrentWarning(...args))
|
||||||
ipcRenderer.on('wt-error', (e, ...args) => tc.torrentError(...args))
|
ipcRenderer.on('wt-error', (e, ...args) => tc.torrentError(...args))
|
||||||
|
|
||||||
@@ -440,6 +459,13 @@ function setDimensions (dimensions) {
|
|||||||
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"
|
||||||
|
// this is a sanitization
|
||||||
|
files = files.map(file => {
|
||||||
|
if (typeof file !== 'string') return file
|
||||||
|
return file.replace(/^magnet:\/+\?/i, 'magnet:?')
|
||||||
|
})
|
||||||
|
|
||||||
const url = state.location.url()
|
const url = state.location.url()
|
||||||
const allTorrents = files.every(TorrentPlayer.isTorrent)
|
const allTorrents = files.every(TorrentPlayer.isTorrent)
|
||||||
const allSubtitles = files.every(controllers.subtitles().isSubtitle)
|
const allSubtitles = files.every(controllers.subtitles().isSubtitle)
|
||||||
@@ -475,8 +501,10 @@ function onError (err) {
|
|||||||
update()
|
update()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const editableHtmlTags = new Set(['input', 'textarea'])
|
||||||
|
|
||||||
function onPaste (e) {
|
function onPaste (e) {
|
||||||
if (e.target.tagName.toLowerCase() === 'input') return
|
if (editableHtmlTags.has(e.target.tagName.toLowerCase())) return
|
||||||
controllers.torrentList().addTorrent(electron.clipboard.readText())
|
controllers.torrentList().addTorrent(electron.clipboard.readText())
|
||||||
|
|
||||||
update()
|
update()
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ function renderMedia (state) {
|
|||||||
} else {
|
} else {
|
||||||
// When the last video completes, pause the video instead of looping
|
// When the last video completes, pause the video instead of looping
|
||||||
state.playing.isPaused = true
|
state.playing.isPaused = true
|
||||||
|
if (state.window.isFullScreen) dispatch('toggleFullScreen')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,25 +207,18 @@ function renderOverlay (state) {
|
|||||||
function renderAudioMetadata (state) {
|
function renderAudioMetadata (state) {
|
||||||
const fileSummary = state.getPlayingFileSummary()
|
const fileSummary = state.getPlayingFileSummary()
|
||||||
if (!fileSummary.audioInfo) return
|
if (!fileSummary.audioInfo) return
|
||||||
const info = fileSummary.audioInfo
|
const common = fileSummary.audioInfo.common || {}
|
||||||
|
|
||||||
// Get audio track info
|
// Get audio track info
|
||||||
let title = info.title
|
const title = common.title ? common.title : fileSummary.name
|
||||||
if (!title) {
|
|
||||||
title = fileSummary.name
|
|
||||||
}
|
|
||||||
let artist = info.artist && info.artist[0]
|
|
||||||
let album = info.album
|
|
||||||
if (album && info.year && !album.includes(info.year)) {
|
|
||||||
album += ' (' + info.year + ')'
|
|
||||||
}
|
|
||||||
let track
|
|
||||||
if (info.track && info.track.no && info.track.of) {
|
|
||||||
track = info.track.no + ' of ' + info.track.of
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show a small info box in the middle of the screen with title/album/etc
|
// Show a small info box in the middle of the screen with title/album/etc
|
||||||
const elems = []
|
const elems = []
|
||||||
|
|
||||||
|
// Audio metadata: artist(s)
|
||||||
|
const artist = common.albumartist || common.artist ||
|
||||||
|
(common.artists && common.artists.filter(function (a) { return a }).join(', ')) ||
|
||||||
|
'(Unknown Artist)'
|
||||||
if (artist) {
|
if (artist) {
|
||||||
elems.push((
|
elems.push((
|
||||||
<div key='artist' className='audio-artist'>
|
<div key='artist' className='audio-artist'>
|
||||||
@@ -232,14 +226,44 @@ function renderAudioMetadata (state) {
|
|||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
if (album) {
|
|
||||||
|
// Audio metadata: album
|
||||||
|
if (common.album) {
|
||||||
elems.push((
|
elems.push((
|
||||||
<div key='album' className='audio-album'>
|
<div key='album' className='audio-album'>
|
||||||
<label>Album</label>{album}
|
<label>Album</label>{common.album}
|
||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
if (track) {
|
|
||||||
|
// Audio metadata: year
|
||||||
|
if (common.year) {
|
||||||
|
elems.push((
|
||||||
|
<div key='year' className='audio-year'>
|
||||||
|
<label>Year</label>{common.year}
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Audio metadata: release information (label & catalog-number)
|
||||||
|
if (common.label || common.catalognumber) {
|
||||||
|
const releaseInfo = []
|
||||||
|
if (common.label) {
|
||||||
|
releaseInfo.push(common.label)
|
||||||
|
}
|
||||||
|
if (common.catalognumber) {
|
||||||
|
releaseInfo.push(common.catalognumber)
|
||||||
|
}
|
||||||
|
elems.push((
|
||||||
|
<div key='release' className='audio-release'>
|
||||||
|
<label>Release</label>{ releaseInfo.join(' / ') }
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Audio metadata: track-number
|
||||||
|
if (common.track && common.track.no && common.track.of) {
|
||||||
|
const track = common.track.no + ' of ' + common.track.of
|
||||||
elems.push((
|
elems.push((
|
||||||
<div key='track' className='audio-track'>
|
<div key='track' className='audio-track'>
|
||||||
<label>Track</label>{track}
|
<label>Track</label>{track}
|
||||||
@@ -247,6 +271,38 @@ function renderAudioMetadata (state) {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Audio metadata: format
|
||||||
|
const format = []
|
||||||
|
fileSummary.audioInfo.format = fileSummary.audioInfo.format || ''
|
||||||
|
if (fileSummary.audioInfo.format.dataformat) {
|
||||||
|
format.push(fileSummary.audioInfo.format.dataformat)
|
||||||
|
}
|
||||||
|
if (fileSummary.audioInfo.format.bitrate) {
|
||||||
|
format.push(fileSummary.audioInfo.format.bitrate / 1000 + ' kbps')
|
||||||
|
}
|
||||||
|
if (fileSummary.audioInfo.format.sampleRate) {
|
||||||
|
format.push(fileSummary.audioInfo.format.sampleRate / 1000 + ' kHz')
|
||||||
|
}
|
||||||
|
if (fileSummary.audioInfo.format.bitsPerSample) {
|
||||||
|
format.push(fileSummary.audioInfo.format.bitsPerSample + ' bit')
|
||||||
|
}
|
||||||
|
if (format.length > 0) {
|
||||||
|
elems.push((
|
||||||
|
<div key='format' className='audio-format'>
|
||||||
|
<label>Format</label>{ format.join(', ') }
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Audio metadata: comments
|
||||||
|
if (common.comment) {
|
||||||
|
elems.push((
|
||||||
|
<div key='comments' className='audio-comments'>
|
||||||
|
<label>Comments</label>{common.comment.join(' / ')}
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
// Align the title with the other info, if available. Otherwise, center title
|
// Align the title with the other info, if available. Otherwise, center title
|
||||||
const emptyLabel = (<label />)
|
const emptyLabel = (<label />)
|
||||||
elems.unshift((
|
elems.unshift((
|
||||||
@@ -275,9 +331,9 @@ function renderLoadingSpinner (state) {
|
|||||||
<div key='loading' className='media-stalled'>
|
<div key='loading' className='media-stalled'>
|
||||||
<div key='loading-spinner' className='loading-spinner'> </div>
|
<div key='loading-spinner' className='loading-spinner'> </div>
|
||||||
<div key='loading-progress' className='loading-status ellipsis'>
|
<div key='loading-progress' className='loading-status ellipsis'>
|
||||||
<span className='progress'>{fileProgress}%</span> downloaded,
|
<span className='progress'>{fileProgress}%</span> downloaded
|
||||||
<span>↓ {prettyBytes(prog.downloadSpeed || 0)}/s</span>
|
<span> ↓ {prettyBytes(prog.downloadSpeed || 0)}/s</span>
|
||||||
<span>↑ {prettyBytes(prog.uploadSpeed || 0)}/s</span>
|
<span> ↑ {prettyBytes(prog.uploadSpeed || 0)}/s</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -303,7 +359,7 @@ function renderCastScreen (state) {
|
|||||||
isCast = false
|
isCast = false
|
||||||
} else if (state.playing.location === 'error') {
|
} else if (state.playing.location === 'error') {
|
||||||
castIcon = 'error_outline'
|
castIcon = 'error_outline'
|
||||||
castType = 'Error'
|
castType = 'Unable to Play'
|
||||||
isCast = false
|
isCast = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,9 +553,9 @@ function renderPlayerControls (state) {
|
|||||||
const volume = state.playing.volume
|
const volume = state.playing.volume
|
||||||
const volumeIcon = 'volume_' + (
|
const volumeIcon = 'volume_' + (
|
||||||
volume === 0 ? 'off'
|
volume === 0 ? 'off'
|
||||||
: volume < 0.3 ? 'mute'
|
: volume < 0.3 ? 'mute'
|
||||||
: volume < 0.6 ? 'down'
|
: volume < 0.6 ? 'down'
|
||||||
: 'up')
|
: 'up')
|
||||||
const volumeStyle = {
|
const volumeStyle = {
|
||||||
background: '-webkit-gradient(linear, left top, right top, ' +
|
background: '-webkit-gradient(linear, left top, right top, ' +
|
||||||
'color-stop(' + (volume * 100) + '%, #eee), ' +
|
'color-stop(' + (volume * 100) + '%, #eee), ' +
|
||||||
@@ -523,8 +579,8 @@ function renderPlayerControls (state) {
|
|||||||
))
|
))
|
||||||
|
|
||||||
// Show video playback progress
|
// Show video playback progress
|
||||||
const currentTimeStr = formatTime(state.playing.currentTime)
|
const currentTimeStr = formatTime(state.playing.currentTime, state.playing.duration)
|
||||||
const durationStr = formatTime(state.playing.duration)
|
const durationStr = formatTime(state.playing.duration, state.playing.duration)
|
||||||
elements.push((
|
elements.push((
|
||||||
<span key='time' className='time float-left'>
|
<span key='time' className='time float-left'>
|
||||||
{currentTimeStr} / {durationStr}
|
{currentTimeStr} / {durationStr}
|
||||||
@@ -599,12 +655,15 @@ function renderLoadingBar (state) {
|
|||||||
|
|
||||||
const torrentSummary = state.getPlayingTorrentSummary()
|
const torrentSummary = state.getPlayingTorrentSummary()
|
||||||
if (!torrentSummary.progress) {
|
if (!torrentSummary.progress) {
|
||||||
return []
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find all contiguous parts of the torrent which are loaded
|
// Find all contiguous parts of the torrent which are loaded
|
||||||
const prog = torrentSummary.progress
|
const prog = torrentSummary.progress
|
||||||
const fileProg = prog.files[state.playing.fileIndex]
|
const fileProg = prog.files[state.playing.fileIndex]
|
||||||
|
|
||||||
|
if (!fileProg) return null
|
||||||
|
|
||||||
const parts = []
|
const parts = []
|
||||||
let lastPiecePresent = false
|
let lastPiecePresent = false
|
||||||
for (let i = fileProg.startPiece; i <= fileProg.endPiece; i++) {
|
for (let i = fileProg.startPiece; i <= fileProg.endPiece; i++) {
|
||||||
@@ -626,6 +685,7 @@ function renderLoadingBar (state) {
|
|||||||
|
|
||||||
return (<div key={i} className='loading-bar-part' style={style} />)
|
return (<div key={i} className='loading-bar-part' style={style} />)
|
||||||
})
|
})
|
||||||
|
|
||||||
return (<div key='loading-bar' className='loading-bar'>{loadingBarElems}</div>)
|
return (<div key='loading-bar' className='loading-bar'>{loadingBarElems}</div>)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -642,17 +702,19 @@ function cssBackgroundImageDarkGradient () {
|
|||||||
'rgba(0,0,0,0.4) 0%, rgba(0,0,0,1) 100%)'
|
'rgba(0,0,0,0.4) 0%, rgba(0,0,0,1) 100%)'
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatTime (time) {
|
function formatTime (time, total) {
|
||||||
if (typeof time !== 'number' || Number.isNaN(time)) {
|
if (typeof time !== 'number' || Number.isNaN(time)) {
|
||||||
return '0:00'
|
return '0:00'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let totalHours = Math.floor(total / 3600)
|
||||||
|
let totalMinutes = Math.floor(total % 3600 / 60)
|
||||||
let hours = Math.floor(time / 3600)
|
let hours = Math.floor(time / 3600)
|
||||||
let minutes = Math.floor(time % 3600 / 60)
|
let minutes = Math.floor(time % 3600 / 60)
|
||||||
if (hours > 0) {
|
if (totalMinutes > 9) {
|
||||||
minutes = zeroFill(2, minutes)
|
minutes = zeroFill(2, minutes)
|
||||||
}
|
}
|
||||||
let seconds = zeroFill(2, Math.floor(time % 60))
|
let seconds = zeroFill(2, Math.floor(time % 60))
|
||||||
|
|
||||||
return (hours > 0 ? hours + ':' : '') + minutes + ':' + seconds
|
return (totalHours > 0 ? hours + ':' : '') + minutes + ':' + seconds
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,24 @@ class PreferencesPage extends React.Component {
|
|||||||
dispatch('updatePreferences', 'openExternalPlayer', !isChecked)
|
dispatch('updatePreferences', 'openExternalPlayer', !isChecked)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
highestPlaybackPriorityCheckbox () {
|
||||||
|
return (
|
||||||
|
<Preference>
|
||||||
|
<Checkbox
|
||||||
|
className='control'
|
||||||
|
checked={this.props.state.unsaved.prefs.highestPlaybackPriority}
|
||||||
|
label={'Highest Playback Priority'}
|
||||||
|
onCheck={this.handleHighestPlaybackPriorityChange}
|
||||||
|
/>
|
||||||
|
<p>Pauses all active torrents to allow playback to use all of the available bandwidth.</p>
|
||||||
|
</Preference>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
handleHighestPlaybackPriorityChange (e, isChecked) {
|
||||||
|
dispatch('updatePreferences', 'highestPlaybackPriority', isChecked)
|
||||||
|
}
|
||||||
|
|
||||||
externalPlayerPathSelector () {
|
externalPlayerPathSelector () {
|
||||||
const playerPath = this.props.state.unsaved.prefs.externalPlayerPath
|
const playerPath = this.props.state.unsaved.prefs.externalPlayerPath
|
||||||
const playerName = this.props.state.getExternalPlayerName()
|
const playerName = this.props.state.getExternalPlayerName()
|
||||||
@@ -90,6 +108,59 @@ class PreferencesPage extends React.Component {
|
|||||||
dispatch('updatePreferences', 'externalPlayerPath', filePath)
|
dispatch('updatePreferences', 'externalPlayerPath', filePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
autoAddTorrentsCheckbox () {
|
||||||
|
return (
|
||||||
|
<Preference>
|
||||||
|
<Checkbox
|
||||||
|
className='control'
|
||||||
|
checked={this.props.state.unsaved.prefs.autoAddTorrents}
|
||||||
|
label={'Watch for new .torrent files and add them immediately'}
|
||||||
|
onCheck={(e, value) => { this.handleAutoAddTorrentsChange(e, value) }}
|
||||||
|
/>
|
||||||
|
</Preference>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
handleAutoAddTorrentsChange (e, isChecked) {
|
||||||
|
const torrentsFolderPath = this.props.state.unsaved.prefs.torrentsFolderPath
|
||||||
|
if (isChecked && !torrentsFolderPath) {
|
||||||
|
alert('Select a torrents folder first.') // eslint-disable-line
|
||||||
|
e.preventDefault()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dispatch('updatePreferences', 'autoAddTorrents', isChecked)
|
||||||
|
|
||||||
|
if (isChecked) {
|
||||||
|
dispatch('startFolderWatcher', null)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dispatch('stopFolderWatcher', null)
|
||||||
|
}
|
||||||
|
|
||||||
|
torrentsFolderPathSelector () {
|
||||||
|
const torrentsFolderPath = this.props.state.unsaved.prefs.torrentsFolderPath
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Preference>
|
||||||
|
<PathSelector
|
||||||
|
dialog={{
|
||||||
|
title: 'Select folder to watch for new torrents',
|
||||||
|
properties: [ 'openDirectory' ]
|
||||||
|
}}
|
||||||
|
displayValue={torrentsFolderPath || ''}
|
||||||
|
onChange={this.handletorrentsFolderPathChange}
|
||||||
|
title='Folder to watch'
|
||||||
|
value={torrentsFolderPath ? path.dirname(torrentsFolderPath) : null} />
|
||||||
|
</Preference>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
handletorrentsFolderPathChange (filePath) {
|
||||||
|
dispatch('updatePreferences', 'torrentsFolderPath', filePath)
|
||||||
|
}
|
||||||
|
|
||||||
setDefaultAppButton () {
|
setDefaultAppButton () {
|
||||||
const isFileHandler = this.props.state.unsaved.prefs.isFileHandler
|
const isFileHandler = this.props.state.unsaved.prefs.isFileHandler
|
||||||
if (isFileHandler) {
|
if (isFileHandler) {
|
||||||
@@ -145,12 +216,15 @@ class PreferencesPage extends React.Component {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div style={style}>
|
<div style={style}>
|
||||||
<PreferencesSection title='Downloads'>
|
<PreferencesSection title='Folders'>
|
||||||
{this.downloadPathSelector()}
|
{this.downloadPathSelector()}
|
||||||
|
{this.autoAddTorrentsCheckbox()}
|
||||||
|
{this.torrentsFolderPathSelector()}
|
||||||
</PreferencesSection>
|
</PreferencesSection>
|
||||||
<PreferencesSection title='Playback'>
|
<PreferencesSection title='Playback'>
|
||||||
{this.openExternalPlayerCheckbox()}
|
{this.openExternalPlayerCheckbox()}
|
||||||
{this.externalPlayerPathSelector()}
|
{this.externalPlayerPathSelector()}
|
||||||
|
{this.highestPlaybackPriorityCheckbox()}
|
||||||
</PreferencesSection>
|
</PreferencesSection>
|
||||||
<PreferencesSection title='Default torrent app'>
|
<PreferencesSection title='Default torrent app'>
|
||||||
{this.setDefaultAppButton()}
|
{this.setDefaultAppButton()}
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ module.exports = class TorrentList extends React.Component {
|
|||||||
} else { // torrentSummary.status is 'new' or something unexpected
|
} else { // torrentSummary.status is 'new' or something unexpected
|
||||||
status = ''
|
status = ''
|
||||||
}
|
}
|
||||||
return (<span>{status}</span>)
|
return (<span key='torrent-status'>{status}</span>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const defaultAnnounceList = require('create-torrent').announceList
|
|||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const mkdirp = require('mkdirp')
|
const mkdirp = require('mkdirp')
|
||||||
const musicmetadata = require('musicmetadata')
|
const mm = require('music-metadata')
|
||||||
const networkAddress = require('network-address')
|
const networkAddress = require('network-address')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const WebTorrent = require('webtorrent')
|
const WebTorrent = require('webtorrent')
|
||||||
@@ -98,7 +98,7 @@ function init () {
|
|||||||
|
|
||||||
window.addEventListener('error', (e) =>
|
window.addEventListener('error', (e) =>
|
||||||
ipc.send('wt-uncaught-error', {message: e.error.message, stack: e.error.stack}),
|
ipc.send('wt-uncaught-error', {message: e.error.message, stack: e.error.stack}),
|
||||||
true)
|
true)
|
||||||
|
|
||||||
setInterval(updateTorrentProgress, 1000)
|
setInterval(updateTorrentProgress, 1000)
|
||||||
console.timeEnd('init')
|
console.timeEnd('init')
|
||||||
@@ -125,11 +125,10 @@ function startTorrenting (torrentKey, torrentID, path, fileModtimes, selections)
|
|||||||
|
|
||||||
// Only download the files the user wants, not necessarily all files
|
// Only download the files the user wants, not necessarily all files
|
||||||
torrent.once('ready', () => selectFiles(torrent, selections))
|
torrent.once('ready', () => selectFiles(torrent, selections))
|
||||||
|
|
||||||
return torrent
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopTorrenting (infoHash) {
|
function stopTorrenting (infoHash) {
|
||||||
|
console.log('--- STOP TORRENTING: ', infoHash)
|
||||||
const torrent = client.get(infoHash)
|
const torrent = client.get(infoHash)
|
||||||
if (torrent) torrent.destroy()
|
if (torrent) torrent.destroy()
|
||||||
}
|
}
|
||||||
@@ -335,16 +334,30 @@ function stopServer () {
|
|||||||
server = null
|
server = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('Initializing...')
|
||||||
|
|
||||||
function getAudioMetadata (infoHash, index) {
|
function getAudioMetadata (infoHash, index) {
|
||||||
const torrent = client.get(infoHash)
|
const torrent = client.get(infoHash)
|
||||||
const file = torrent.files[index]
|
const file = torrent.files[index]
|
||||||
musicmetadata(file.createReadStream(), function (err, info) {
|
|
||||||
if (err) return console.log('error getting audio metadata for ' + infoHash + ':' + index, err)
|
// Set initial matadata to display the filename first.
|
||||||
const { artist, album, albumartist, title, year, track, disk, genre } = info
|
const metadata = { title: file.name }
|
||||||
const importantInfo = { artist, album, albumartist, title, year, track, disk, genre }
|
ipc.send('wt-audio-metadata', infoHash, index, metadata)
|
||||||
console.log('got audio metadata for %s: %o', file.name, importantInfo)
|
|
||||||
ipc.send('wt-audio-metadata', infoHash, index, importantInfo)
|
const options = {native: false, skipCovers: true, fileSize: file.length}
|
||||||
})
|
const onMetaData = file.done
|
||||||
|
// If completed; use direct file access
|
||||||
|
? mm.parseFile(path.join(torrent.path, file.path), options)
|
||||||
|
// otherwise stream
|
||||||
|
: mm.parseStream(file.createReadStream(), file.name, options)
|
||||||
|
|
||||||
|
onMetaData
|
||||||
|
.then(function (metadata) {
|
||||||
|
console.log('got audio metadata for %s (length=%s): %o', file.name, file.length, metadata)
|
||||||
|
ipc.send('wt-audio-metadata', infoHash, index, metadata)
|
||||||
|
}).catch(function (err) {
|
||||||
|
return console.log('error getting audio metadata for ' + infoHash + ':' + index, err)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectFiles (torrentOrInfoHash, selections) {
|
function selectFiles (torrentOrInfoHash, selections) {
|
||||||
|
|||||||
@@ -615,6 +615,7 @@ body.drag .app::after {
|
|||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
margin: 9px 8px 8px 8px;
|
margin: 9px 8px 8px 8px;
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
}
|
}
|
||||||
|
|
||||||
.player .controls .icon.closed-caption {
|
.player .controls .icon.closed-caption {
|
||||||
@@ -819,12 +820,17 @@ video::-webkit-media-text-track-container {
|
|||||||
|
|
||||||
.audio-metadata label {
|
.audio-metadata label {
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
width: 100px;
|
width: 120px;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
margin-right: 25px;
|
margin-right: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.audio-metadata .audio-format,
|
||||||
|
.audio-metadata .audio-comments {
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ERRORS
|
* ERRORS
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ test('app runs', function (t) {
|
|||||||
setup.waitForLoad(app, t)
|
setup.waitForLoad(app, t)
|
||||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'app-basic'))
|
.then(() => setup.screenshotCreateOrCompare(app, t, 'app-basic'))
|
||||||
.then(() => setup.endTest(app, t),
|
.then(() => setup.endTest(app, t),
|
||||||
(err) => setup.endTest(app, t, err || 'error'))
|
(err) => setup.endTest(app, t, err || 'error'))
|
||||||
})
|
})
|
||||||
|
|
||||||
require('./test-torrent-list')
|
require('./test-torrent-list')
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 1010 KiB After Width: | Height: | Size: 1011 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 139 KiB After Width: | Height: | Size: 143 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 302 KiB After Width: | Height: | Size: 302 KiB |
|
Before Width: | Height: | Size: 698 KiB After Width: | Height: | Size: 698 KiB |
|
Before Width: | Height: | Size: 478 KiB After Width: | Height: | Size: 479 KiB |
|
Before Width: | Height: | Size: 480 KiB After Width: | Height: | Size: 480 KiB |
|
Before Width: | Height: | Size: 480 KiB After Width: | Height: | Size: 480 KiB |
|
Before Width: | Height: | Size: 480 KiB After Width: | Height: | Size: 480 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 481 KiB After Width: | Height: | Size: 481 KiB |
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 627 KiB After Width: | Height: | Size: 627 KiB |
|
Before Width: | Height: | Size: 843 KiB After Width: | Height: | Size: 844 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1014 KiB After Width: | Height: | Size: 1014 KiB |
|
Before Width: | Height: | Size: 549 KiB After Width: | Height: | Size: 549 KiB |
|
Before Width: | Height: | Size: 698 KiB After Width: | Height: | Size: 698 KiB |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1024 KiB |
|
Before Width: | Height: | Size: 1014 KiB After Width: | Height: | Size: 1014 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1015 KiB After Width: | Height: | Size: 1016 KiB |
|
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 237 KiB |
|
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 239 KiB |
|
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 238 KiB |
|
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 237 KiB |
|
Before Width: | Height: | Size: 406 KiB After Width: | Height: | Size: 725 KiB |
|
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 239 KiB |
@@ -122,7 +122,7 @@ function compareIgnoringTransparency (bufActual, bufExpected) {
|
|||||||
const de = pngE.data
|
const de = pngE.data
|
||||||
for (let y = 0; y < h; y++) {
|
for (let y = 0; y < h; y++) {
|
||||||
for (let x = 0; x < w; x++) {
|
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
|
if (de[i + 3] === 0) continue // Skip transparent pixels
|
||||||
const ca = (da[i] << 16) | (da[i + 1] << 8) | da[i + 2]
|
const ca = (da[i] << 16) | (da[i + 1] << 8) | da[i + 2]
|
||||||
const ce = (de[i] << 16) | (de[i + 1] << 8) | de[i + 2]
|
const ce = (de[i] << 16) | (de[i + 1] << 8) | de[i + 2]
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ test('add-torrent', function (t) {
|
|||||||
.then(() => app.client.moveToObject('.torrent'))
|
.then(() => app.client.moveToObject('.torrent'))
|
||||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'add-torrent-100-percent'))
|
.then(() => setup.screenshotCreateOrCompare(app, t, 'add-torrent-100-percent'))
|
||||||
.then(() => setup.endTest(app, t),
|
.then(() => setup.endTest(app, t),
|
||||||
(err) => setup.endTest(app, t, err || 'error'))
|
(err) => setup.endTest(app, t, err || 'error'))
|
||||||
})
|
})
|
||||||
|
|
||||||
test('create-torrent', function (t) {
|
test('create-torrent', function (t) {
|
||||||
@@ -38,11 +38,12 @@ test('create-torrent', function (t) {
|
|||||||
|
|
||||||
const expectedTorrent = {
|
const expectedTorrent = {
|
||||||
announce: [
|
announce: [
|
||||||
'udp://exodus.desync.com:6969',
|
'udp://explodie.org:6969',
|
||||||
'udp://tracker.coppersurfer.tk:6969',
|
'udp://tracker.coppersurfer.tk:6969',
|
||||||
'udp://tracker.internetwarriors.net:1337',
|
|
||||||
'udp://tracker.leechers-paradise.org:6969',
|
'udp://tracker.leechers-paradise.org:6969',
|
||||||
'udp://tracker.openbittorrent.com:80',
|
'udp://tracker.openbittorrent.com:80',
|
||||||
|
'udp://tracker.opentrackr.org:1337',
|
||||||
|
'udp://zer0day.ch:1337',
|
||||||
'wss://tracker.btorrent.xyz',
|
'wss://tracker.btorrent.xyz',
|
||||||
'wss://tracker.fastcast.nz',
|
'wss://tracker.fastcast.nz',
|
||||||
'wss://tracker.openwebtorrent.com'
|
'wss://tracker.openwebtorrent.com'
|
||||||
@@ -83,5 +84,5 @@ test('create-torrent', function (t) {
|
|||||||
config.SAVED_TORRENT_FILE,
|
config.SAVED_TORRENT_FILE,
|
||||||
expectedTorrent))
|
expectedTorrent))
|
||||||
.then(() => setup.endTest(app, t),
|
.then(() => setup.endTest(app, t),
|
||||||
(err) => setup.endTest(app, t, err || 'error'))
|
(err) => setup.endTest(app, t, err || 'error'))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -53,5 +53,5 @@ test('audio-streaming', function (t) {
|
|||||||
.then(() => app.webContents.executeJavaScript('dispatch("skipTo", 2)'))
|
.then(() => app.webContents.executeJavaScript('dispatch("skipTo", 2)'))
|
||||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired-5'))
|
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired-5'))
|
||||||
.then(() => setup.endTest(app, t),
|
.then(() => setup.endTest(app, t),
|
||||||
(err) => setup.endTest(app, t, err || 'error'))
|
(err) => setup.endTest(app, t, err || 'error'))
|
||||||
})
|
})
|
||||||
|
|||||||
25
test/test-select-poster.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
const test = require('tape')
|
||||||
|
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
const WebTorrent = require('webtorrent')
|
||||||
|
const torrentPoster = require('../build/renderer/lib/torrent-poster')
|
||||||
|
|
||||||
|
const client = new WebTorrent()
|
||||||
|
|
||||||
|
test("get cover from: 'wiredCd.torrent'", (t) => {
|
||||||
|
const torrentPath = path.join(__dirname, '..', 'static', 'wiredCd.torrent')
|
||||||
|
const torrentData = fs.readFileSync(torrentPath)
|
||||||
|
|
||||||
|
client.add(torrentData, (torrent) => {
|
||||||
|
torrentPoster(torrent, (err, buf, extension) => {
|
||||||
|
if (err) {
|
||||||
|
t.fail(err)
|
||||||
|
} else {
|
||||||
|
t.equals(extension, '.jpg')
|
||||||
|
t.end()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -22,7 +22,7 @@ test('torrent-list: show download path missing', function (t) {
|
|||||||
.then((windowTitle) => t.equal(windowTitle, 'Preferences', 'window title'))
|
.then((windowTitle) => t.equal(windowTitle, 'Preferences', 'window title'))
|
||||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'prefs-basic'))
|
.then(() => setup.screenshotCreateOrCompare(app, t, 'prefs-basic'))
|
||||||
.then(() => setup.endTest(app, t),
|
.then(() => setup.endTest(app, t),
|
||||||
(err) => setup.endTest(app, t, err || 'error'))
|
(err) => setup.endTest(app, t, err || 'error'))
|
||||||
})
|
})
|
||||||
|
|
||||||
test('torrent-list: start, stop, and delete torrents', function (t) {
|
test('torrent-list: start, stop, and delete torrents', function (t) {
|
||||||
@@ -54,7 +54,7 @@ test('torrent-list: start, stop, and delete torrents', function (t) {
|
|||||||
.then(() => app.client.click('.control.ok'))
|
.then(() => app.client.click('.control.ok'))
|
||||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'torrent-list-deleted'))
|
.then(() => setup.screenshotCreateOrCompare(app, t, 'torrent-list-deleted'))
|
||||||
.then(() => setup.endTest(app, t),
|
.then(() => setup.endTest(app, t),
|
||||||
(err) => setup.endTest(app, t, err || 'error'))
|
(err) => setup.endTest(app, t, err || 'error'))
|
||||||
})
|
})
|
||||||
|
|
||||||
test('torrent-list: expand torrent, unselect file', function (t) {
|
test('torrent-list: expand torrent, unselect file', function (t) {
|
||||||
@@ -79,7 +79,7 @@ test('torrent-list: expand torrent, unselect file', function (t) {
|
|||||||
// Make sure that it creates all files EXCEPT the deslected one
|
// Make sure that it creates all files EXCEPT the deslected one
|
||||||
.then(() => setup.compareDownloadFolder(t, 'CosmosLaundromatFirstCycle', [
|
.then(() => setup.compareDownloadFolder(t, 'CosmosLaundromatFirstCycle', [
|
||||||
// TODO: the .gif should NOT be here, since we just deselected it.
|
// 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).gif',
|
||||||
'Cosmos Laundromat - First Cycle (1080p).mp4',
|
'Cosmos Laundromat - First Cycle (1080p).mp4',
|
||||||
'Cosmos Laundromat - First Cycle (1080p).ogv',
|
'Cosmos Laundromat - First Cycle (1080p).ogv',
|
||||||
@@ -101,5 +101,5 @@ test('torrent-list: expand torrent, unselect file', function (t) {
|
|||||||
// Make sure that all the files are gone
|
// Make sure that all the files are gone
|
||||||
.then(() => setup.compareDownloadFolder(t, 'CosmosLaundromatFirstCycle', null))
|
.then(() => setup.compareDownloadFolder(t, 'CosmosLaundromatFirstCycle', null))
|
||||||
.then(() => setup.endTest(app, t),
|
.then(() => setup.endTest(app, t),
|
||||||
(err) => setup.endTest(app, t, err || 'error'))
|
(err) => setup.endTest(app, t, err || 'error'))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -31,5 +31,5 @@ test('video-streaming', function (t) {
|
|||||||
// Take another screenshot to verify that the window resized correctly
|
// Take another screenshot to verify that the window resized correctly
|
||||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-return'))
|
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-return'))
|
||||||
.then(() => setup.endTest(app, t),
|
.then(() => setup.endTest(app, t),
|
||||||
(err) => setup.endTest(app, t, err || 'error'))
|
(err) => setup.endTest(app, t, err || 'error'))
|
||||||
})
|
})
|
||||||
|
|||||||