Compare commits
1 Commits
v0.23.0
...
issue-1711
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a445c18979 |
1
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
github: feross
|
||||
11
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<!-- DO NOT POST LINKS OR REFERENCES TO COPYRIGHTED CONTENT IN YOUR ISSUE. -->
|
||||
|
||||
**What version of WebTorrent Desktop?** (See the 'About WebTorrent' menu)
|
||||
|
||||
**What operating system and version?**
|
||||
|
||||
**What did you do?**
|
||||
|
||||
**What did you expect to happen?**
|
||||
|
||||
**What actually happened?**
|
||||
20
.github/ISSUE_TEMPLATE/BUG_REPORT.md
vendored
@@ -1,20 +0,0 @@
|
||||
---
|
||||
name: "🐞 Bug report"
|
||||
about: Report an issue with this software
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- DO NOT POST LINKS OR REFERENCES TO COPYRIGHTED CONTENT IN YOUR ISSUE. -->
|
||||
|
||||
**What version of WebTorrent Desktop are you using?**
|
||||
|
||||
**What operating system and version?**
|
||||
|
||||
**What happened?**
|
||||
|
||||
**What did you expect to happen?**
|
||||
|
||||
**Are you willing to submit a pull request to fix this bug?**
|
||||
20
.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
vendored
@@ -1,20 +0,0 @@
|
||||
---
|
||||
name: "⭐️ Feature request"
|
||||
about: Request a new feature to be added
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- DO NOT POST LINKS OR REFERENCES TO COPYRIGHTED CONTENT IN YOUR ISSUE. -->
|
||||
|
||||
**What version of WebTorrent Desktop are you using?**
|
||||
|
||||
**What operating system and version?**
|
||||
|
||||
**What problem do you want to solve?**
|
||||
|
||||
**What do you think is the correct solution to this problem?**
|
||||
|
||||
**Are you willing to submit a pull request to implement this change?**
|
||||
15
.github/config.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# ProBot Request Info (https://probot.github.io/apps/request-info/)
|
||||
|
||||
requestInfoReplyComment: >
|
||||
👋 We would appreciate it if you could provide us with more information about this
|
||||
issue. <br><br> 
|
||||
requestInfoLabelToAdd: 'need more info'
|
||||
|
||||
# ProBot Welcome (https://probot.github.io/apps/welcome/)
|
||||
|
||||
newPRWelcomeComment: >
|
||||
🙌 Thanks for opening this pull request! You're awesome.
|
||||
<br><br> 
|
||||
firstPRMergeComment: >
|
||||
🎉 Congrats on getting your first pull request landed! <br><br>
|
||||

|
||||
4
.github/lock.yml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
# ProBot Lock (https://probot.github.io/apps/lock/)
|
||||
|
||||
daysUntilLock: 365
|
||||
lockComment: false
|
||||
9
.github/no-response.yml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# ProBot No Response (https://probot.github.io/apps/no-response/)
|
||||
|
||||
daysUntilClose: 14
|
||||
responseRequiredLabel: 'need more info'
|
||||
closeComment: >
|
||||
This issue has been automatically closed because there was no response to a
|
||||
request for more information from the issue opener. Please leave a comment or
|
||||
open a new issue if you have additional information related to this issue.
|
||||
<br><br> 
|
||||
17
.github/stale.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
# ProBot Stale (https://probot.github.io/apps/stale/)
|
||||
|
||||
daysUntilStale: 90
|
||||
daysUntilClose: 14
|
||||
exemptLabels:
|
||||
- accepted
|
||||
- blocked
|
||||
- bug
|
||||
- enhancement
|
||||
- greenkeeper
|
||||
- 'help wanted'
|
||||
- meta
|
||||
staleLabel: stale
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs.
|
||||
closeComment: false
|
||||
@@ -39,7 +39,6 @@
|
||||
- Nuno Campos (nuno.campos@me.com)
|
||||
- Ebrahim Byagowi (ebrahim@gnu.org)
|
||||
- Josip Janzic (josip@jjanzic.com)
|
||||
- Egor Yurtaev (yurtaev.egor@gmail.com)
|
||||
- Emil Bay (github@tixz.dk)
|
||||
- Borewit (borewit@users.noreply.github.com)
|
||||
- greenkeeper[bot] (greenkeeper[bot]@users.noreply.github.com)
|
||||
@@ -56,7 +55,6 @@
|
||||
- Dan Flettre (flettre@gmail.com)
|
||||
- Sibiraj (dev.sibiraj@outlook.com)
|
||||
- clujin (clujin@gmail.com)
|
||||
- Sharon Grossman (sharong1337@gmail.com)
|
||||
- Linus Unnebäck (linus@folkdatorn.se)
|
||||
- Adrian Tombu (adrian@otso.fr)
|
||||
- Lucas (5874806+RecoX@users.noreply.github.com)
|
||||
@@ -66,16 +64,10 @@
|
||||
- Recox (5874806+RecoX@users.noreply.github.com)
|
||||
- greenkeeper[bot] (23040076+greenkeeper[bot]@users.noreply.github.com)
|
||||
- hicom150 (hicom150@gmail.com)
|
||||
- Дамјан Георгиевски (gdamjan@gmail.com)
|
||||
- Jimmy Wärting (jimmy@warting.se)
|
||||
- Julen Garcia Leunda (hicom150@gmail.com)
|
||||
- Feross (feross@feross.org)
|
||||
- Daniele Debernardi (drebrez@gmail.com)
|
||||
- Chandan Chowdary Bhagam (chandandharana@gmail.com)
|
||||
- Pieter Goetschalckx (3.14.e.ter@gmail.com)
|
||||
- Carey Metcalfe (carey@cmetcalfe.ca)
|
||||
- Ameet Kaustav (akaustav@users.noreply.github.com)
|
||||
- gpatarin (gael.patarin@outlook.com)
|
||||
- Gael Patarin (gael.patarin@outlook.com)
|
||||
|
||||
#### Generated by bin/update-authors.sh.
|
||||
|
||||
37
CHANGELOG.md
@@ -1,41 +1,6 @@
|
||||
# WebTorrent Desktop Version History
|
||||
|
||||
## v0.23.0 - 2020-07-15
|
||||
|
||||
This release contains a critical security fix.
|
||||
|
||||
### Changed
|
||||
|
||||
- Update to Electron 10 beta [\#1834](https://github.com/webtorrent/webtorrent-desktop/pull/1834)
|
||||
|
||||
## v0.22.0 - 2020-07-15
|
||||
|
||||
### Added
|
||||
|
||||
- Linux `.rpm` packages and `arm64` builds are now available! [\#1694](https://github.com/webtorrent/webtorrent-desktop/pull/1694) ([hicom150](https://github.com/hicom150))
|
||||
- Add support for multiple audio tracks [\#1712](https://github.com/webtorrent/webtorrent-desktop/pull/1712) ([hicom150](https://github.com/hicom150))
|
||||
- Improve codec unsupported detection [\#1711](https://github.com/webtorrent/webtorrent-desktop/pull/1711) ([hicom150](https://github.com/hicom150))
|
||||
- Report when files are being verified [\#1717](https://github.com/webtorrent/webtorrent-desktop/pull/1717) ([pR0Ps](https://github.com/pR0Ps))
|
||||
- Support additional audio files: MPEG-Layer-2, Musepack, Matroska audio, WavePack [\#1772](https://github.com/webtorrent/webtorrent-desktop/pull/1772)
|
||||
|
||||
### Changed
|
||||
|
||||
- Update to Electron 9 [\#1729](https://github.com/webtorrent/webtorrent-desktop/pull/1729) [\#1832](https://github.com/webtorrent/webtorrent-desktop/issues/1832)
|
||||
- Update to music-metadata 4.8.0 [\#1719](https://github.com/webtorrent/webtorrent-desktop/pull/1719) ([Borewit](https://github.com/Borewit))
|
||||
- Update Windows build documentation [\#1715](https://github.com/webtorrent/webtorrent-desktop/pull/1715) ([RecoX](https://github.com/RecoX))
|
||||
- Remove unneeded dependencies
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix a few type errors [\#1720](https://github.com/webtorrent/webtorrent-desktop/pull/1720) ([mathiasvr](https://github.com/mathiasvr))
|
||||
- Fix electron SUID sandbox error [\#1707](https://github.com/webtorrent/webtorrent-desktop/pull/1707) ([hicom150](https://github.com/hicom150))
|
||||
- Fix percentage rounding error [\#1716](https://github.com/webtorrent/webtorrent-desktop/pull/1716) ([pR0Ps](https://github.com/pR0Ps))
|
||||
- Fix path-selector in preferences page [\#1702](https://github.com/webtorrent/webtorrent-desktop/pull/1702) ([314eter](https://github.com/314eter))
|
||||
- Fix path-selector in preferences page [\#1704](https://github.com/webtorrent/webtorrent-desktop/pull/1702) ([mathiasvr](https://github.com/mathiasvr))
|
||||
- Fix: Increase height of 'About' window [\#1737](https://github.com/webtorrent/webtorrent-desktop/pull/1737)
|
||||
- Fix "Save Torrent File As..." [\#1743](https://github.com/webtorrent/webtorrent-desktop/pull/1743)
|
||||
|
||||
## v0.21.0 - 2019-09-14
|
||||
## v0.21.0 - 2019-08
|
||||
|
||||
### Added
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ React.js (Framework to work with Frontend UI):
|
||||
https://reactjs.org/docs/getting-started.html
|
||||
|
||||
Material UI (React components that implement Google's Material Design.):
|
||||
https://material-ui.com/getting-started/installation
|
||||
https://material-ui.com/getting-started
|
||||
|
||||
### Privacy
|
||||
|
||||
|
||||
@@ -46,11 +46,6 @@
|
||||
|
||||
```
|
||||
npm run package -- darwin --sign
|
||||
```
|
||||
|
||||
Move the `.zip` and `.dmg` file somewhere because the next step wipes the `dist/` folder away.
|
||||
|
||||
```
|
||||
npm run package -- linux --sign
|
||||
```
|
||||
|
||||
@@ -105,10 +100,10 @@ Before a release, check that the following basic use cases work correctly:
|
||||
- Ensure that sintel.mp4 gets downloaded to `~/Downloads`.
|
||||
|
||||
2. Check that the auto-updater works
|
||||
- Open the console and check for the line "No update available" to indicate that the auto-updater is working.
|
||||
- Open the console and check for the line "No update available" to indicate
|
||||
|
||||
3. Add a new .torrent file via drag-and-drop.
|
||||
- Ensure that it gets added to the list and starts downloading.
|
||||
- Ensure that it gets added to the list and starts downloading
|
||||
|
||||
4. Remove a torrent from the client
|
||||
- Ensure that the file is removed from `~/Downloads`
|
||||
|
||||
@@ -8,6 +8,7 @@ const cp = require('child_process')
|
||||
const electronPackager = require('electron-packager')
|
||||
const fs = require('fs')
|
||||
const minimist = require('minimist')
|
||||
const mkdirp = require('mkdirp')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
const rimraf = require('rimraf')
|
||||
@@ -36,7 +37,7 @@ const argv = minimist(process.argv.slice(2), {
|
||||
})
|
||||
|
||||
function build () {
|
||||
console.log('Installing node_modules...')
|
||||
console.log('Reinstalling node_modules...')
|
||||
rimraf.sync(NODE_MODULES_PATH)
|
||||
cp.execSync('npm ci', { stdio: 'inherit' })
|
||||
|
||||
@@ -429,7 +430,7 @@ function buildWin32 (cb) {
|
||||
// remoteToken: process.env.WEBTORRENT_GITHUB_API_TOKEN,
|
||||
setupExe: config.APP_NAME + 'Setup-v' + config.APP_VERSION + '.exe',
|
||||
setupIcon: config.APP_ICON + '.ico',
|
||||
signWithParams,
|
||||
signWithParams: signWithParams,
|
||||
title: config.APP_NAME,
|
||||
usePackageJson: false,
|
||||
version: pkg.version
|
||||
@@ -456,13 +457,13 @@ function buildWin32 (cb) {
|
||||
console.log('Windows: Creating portable app...')
|
||||
|
||||
const portablePath = path.join(filesPath, 'Portable Settings')
|
||||
fs.mkdirSync(portablePath, { recursive: true })
|
||||
mkdirp.sync(portablePath)
|
||||
|
||||
const downloadsPath = path.join(portablePath, 'Downloads')
|
||||
fs.mkdirSync(downloadsPath, { recursive: true })
|
||||
mkdirp.sync(downloadsPath)
|
||||
|
||||
const tempPath = path.join(portablePath, 'Temp')
|
||||
fs.mkdirSync(tempPath, { recursive: true })
|
||||
mkdirp.sync(tempPath)
|
||||
|
||||
const inPath = path.join(DIST_PATH, path.basename(filesPath))
|
||||
const outPath = path.join(DIST_PATH, BUILD_NAME + '-win.zip')
|
||||
|
||||
@@ -13,7 +13,6 @@ while (<>) {
|
||||
next if /(dc\@DCs-MacBook.local)/;
|
||||
next if /(rolandoguedes\@gmail.com)/;
|
||||
next if /(grunjol\@users.noreply.github.com)/;
|
||||
next if /(dependabot)/;
|
||||
$seen{$_} = push @authors, "- ", $_;
|
||||
}
|
||||
END {
|
||||
|
||||
5738
package-lock.json
generated
74
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "webtorrent-desktop",
|
||||
"description": "WebTorrent, the streaming torrent client. For Mac, Windows, and Linux.",
|
||||
"version": "0.23.0",
|
||||
"version": "0.21.0",
|
||||
"author": {
|
||||
"name": "WebTorrent, LLC",
|
||||
"email": "feross@webtorrent.io",
|
||||
@@ -12,60 +12,62 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"airplayer": "github:webtorrent/airplayer#fix-security",
|
||||
"application-config": "^2.0.0",
|
||||
"arch": "^2.1.2",
|
||||
"application-config": "^1.0.1",
|
||||
"arch": "^2.1.1",
|
||||
"auto-launch": "^5.0.5",
|
||||
"bitfield": "^3.0.0",
|
||||
"capture-frame": "^3.0.2",
|
||||
"chokidar": "^3.4.1",
|
||||
"capture-frame": "^3.0.0",
|
||||
"chokidar": "^3.0.2",
|
||||
"chromecasts": "^1.9.1",
|
||||
"create-torrent": "^4.4.2",
|
||||
"create-torrent": "^4.4.1",
|
||||
"debounce": "^1.2.0",
|
||||
"deep-equal": "^1.1.0",
|
||||
"dlnacasts": "^0.1.0",
|
||||
"drag-drop": "^6.0.2",
|
||||
"drag-drop": "^5.0.1",
|
||||
"es6-error": "^4.1.1",
|
||||
"fn-getter": "^1.0.0",
|
||||
"iso-639-1": "^2.1.3",
|
||||
"languagedetect": "^2.0.0",
|
||||
"location-history": "^1.1.2",
|
||||
"iso-639-1": "^2.1.0",
|
||||
"languagedetect": "^1.2.0",
|
||||
"location-history": "^1.1.1",
|
||||
"material-ui": "^0.20.2",
|
||||
"music-metadata": "6.3.6",
|
||||
"mkdirp": "^0.5.1",
|
||||
"music-metadata": "^4.5.3",
|
||||
"network-address": "^1.1.2",
|
||||
"parse-torrent": "^7.1.3",
|
||||
"parse-torrent": "^7.0.1",
|
||||
"prettier-bytes": "^1.0.4",
|
||||
"prop-types": "^15.7.2",
|
||||
"react": "^16.13.1",
|
||||
"react-dom": "^16.13.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"react": "^16.9.0",
|
||||
"react-dom": "^16.9.0",
|
||||
"rimraf": "^3.0.0",
|
||||
"run-parallel": "^1.1.9",
|
||||
"semver": "^7.3.2",
|
||||
"semver": "^6.3.0",
|
||||
"simple-concat": "^1.0.0",
|
||||
"simple-get": "^4.0.0",
|
||||
"simple-get": "^3.0.3",
|
||||
"srt-to-vtt": "^1.1.3",
|
||||
"vlc-command": "^1.2.0",
|
||||
"webtorrent": ">=0.108.6",
|
||||
"webtorrent": ">=0.107.16",
|
||||
"winreg": "^1.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-eslint": "^10.1.0",
|
||||
"buble": "^0.20.0",
|
||||
"cross-zip": "^3.1.0",
|
||||
"depcheck": "^1.0.0",
|
||||
"electron": "~9.1.0",
|
||||
"electron-osx-sign": "^0.4.17",
|
||||
"electron-packager": "^15.0.0",
|
||||
"electron-winstaller": "^4.0.1",
|
||||
"babel-eslint": "^10.0.3",
|
||||
"buble": "^0.19.8",
|
||||
"cross-zip": "^2.1.6",
|
||||
"depcheck": "^0.8.3",
|
||||
"electron": "~6.0.9",
|
||||
"electron-osx-sign": "^0.4.13",
|
||||
"electron-packager": "^14.0.6",
|
||||
"electron-winstaller": "^4.0.0",
|
||||
"gh-release": "^3.5.0",
|
||||
"minimist": "^1.2.5",
|
||||
"nodemon": "^2.0.4",
|
||||
"open": "^7.0.4",
|
||||
"minimist": "^1.2.0",
|
||||
"nodemon": "^1.19.2",
|
||||
"open": "^6.4.0",
|
||||
"plist": "^3.0.1",
|
||||
"pngjs": "^5.0.0",
|
||||
"pngjs": "^3.4.0",
|
||||
"run-series": "^1.1.8",
|
||||
"spectron": "~11.0.0",
|
||||
"spectron": "^8.0.0",
|
||||
"standard": "*",
|
||||
"tape": "^5.0.1",
|
||||
"walk-sync": "^2.2.0"
|
||||
"tape": "^4.11.0",
|
||||
"walk-sync": "^2.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
@@ -85,8 +87,8 @@
|
||||
"main": "index.js",
|
||||
"optionalDependencies": {
|
||||
"appdmg": "^0.6.0",
|
||||
"electron-installer-debian": "^3.1.0",
|
||||
"electron-installer-redhat": "^3.1.0"
|
||||
"electron-installer-debian": "^2.0.0",
|
||||
"electron-installer-redhat": "^2.0.0"
|
||||
},
|
||||
"private": true,
|
||||
"productName": "WebTorrent",
|
||||
@@ -101,7 +103,7 @@
|
||||
"install-system-deps": "brew install fakeroot dpkg rpm",
|
||||
"open-config": "node ./bin/open-config.js",
|
||||
"package": "node ./bin/package.js",
|
||||
"start": "npm run build && electron --no-sandbox .",
|
||||
"start": "npm run build && electron .",
|
||||
"test": "standard && depcheck --ignores=standard,babel-eslint --ignore-dirs=build,dist && node ./bin/extra-lint.js",
|
||||
"test-integration": "npm run build && node ./test",
|
||||
"update-authors": "./bin/update-authors.sh",
|
||||
|
||||
@@ -23,12 +23,12 @@ module.exports = {
|
||||
CRASH_REPORT_URL: 'https://webtorrent.io/desktop/crash-report',
|
||||
TELEMETRY_URL: 'https://webtorrent.io/desktop/telemetry',
|
||||
|
||||
APP_COPYRIGHT: `Copyright © 2014-${new Date().getFullYear()} ${APP_TEAM}`,
|
||||
APP_COPYRIGHT: 'Copyright © 2014-2019 ' + APP_TEAM,
|
||||
APP_FILE_ICON: path.join(__dirname, '..', 'static', 'WebTorrentFile'),
|
||||
APP_ICON: path.join(__dirname, '..', 'static', 'WebTorrent'),
|
||||
APP_NAME,
|
||||
APP_TEAM,
|
||||
APP_VERSION,
|
||||
APP_NAME: APP_NAME,
|
||||
APP_TEAM: APP_TEAM,
|
||||
APP_VERSION: APP_VERSION,
|
||||
APP_WINDOW_TITLE: APP_NAME,
|
||||
|
||||
CONFIG_PATH: getConfigPath(),
|
||||
@@ -78,9 +78,9 @@ module.exports = {
|
||||
HOME_PAGE_URL: 'https://webtorrent.io',
|
||||
TWITTER_PAGE_URL: 'https://twitter.com/WebTorrentApp',
|
||||
|
||||
IS_PORTABLE,
|
||||
IS_PRODUCTION,
|
||||
IS_TEST,
|
||||
IS_PORTABLE: IS_PORTABLE,
|
||||
IS_PRODUCTION: IS_PRODUCTION,
|
||||
IS_TEST: IS_TEST,
|
||||
|
||||
OS_SYSARCH: arch() === 'x64' ? 'x64' : 'ia32',
|
||||
|
||||
@@ -100,8 +100,8 @@ module.exports = {
|
||||
WINDOW_MIN_HEIGHT: UI_HEADER_HEIGHT + (UI_TORRENT_HEIGHT * 2), // header + 2 torrents
|
||||
WINDOW_MIN_WIDTH: 425,
|
||||
|
||||
UI_HEADER_HEIGHT,
|
||||
UI_TORRENT_HEIGHT
|
||||
UI_HEADER_HEIGHT: UI_HEADER_HEIGHT,
|
||||
UI_TORRENT_HEIGHT: UI_TORRENT_HEIGHT
|
||||
}
|
||||
|
||||
function getConfigPath () {
|
||||
|
||||
@@ -50,5 +50,7 @@ function onResponse (err, res, data) {
|
||||
title: data.title,
|
||||
message: data.message,
|
||||
detail: data.detail
|
||||
})
|
||||
}, noop)
|
||||
}
|
||||
|
||||
function noop () {}
|
||||
|
||||
@@ -61,10 +61,11 @@ function openFiles () {
|
||||
properties: ['openFile']
|
||||
}
|
||||
setTitle(opts.title)
|
||||
const selectedPaths = electron.dialog.showOpenDialogSync(windows.main.win, opts)
|
||||
resetTitle()
|
||||
if (!Array.isArray(selectedPaths)) return
|
||||
windows.main.dispatch('onOpen', selectedPaths)
|
||||
electron.dialog.showOpenDialog(windows.main.win, opts, function (selectedPaths) {
|
||||
resetTitle()
|
||||
if (!Array.isArray(selectedPaths)) return
|
||||
windows.main.dispatch('onOpen', selectedPaths)
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -79,11 +80,12 @@ function openTorrentFile () {
|
||||
properties: ['openFile', 'multiSelections']
|
||||
}
|
||||
setTitle(opts.title)
|
||||
const selectedPaths = electron.dialog.showOpenDialogSync(windows.main.win, opts)
|
||||
resetTitle()
|
||||
if (!Array.isArray(selectedPaths)) return
|
||||
selectedPaths.forEach(function (selectedPath) {
|
||||
windows.main.dispatch('addTorrent', selectedPath)
|
||||
electron.dialog.showOpenDialog(windows.main.win, opts, function (selectedPaths) {
|
||||
resetTitle()
|
||||
if (!Array.isArray(selectedPaths)) return
|
||||
selectedPaths.forEach(function (selectedPath) {
|
||||
windows.main.dispatch('addTorrent', selectedPath)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -114,8 +116,9 @@ function resetTitle () {
|
||||
*/
|
||||
function showOpenSeed (opts) {
|
||||
setTitle(opts.title)
|
||||
const selectedPaths = electron.dialog.showOpenDialogSync(windows.main.win, opts)
|
||||
resetTitle()
|
||||
if (!Array.isArray(selectedPaths)) return
|
||||
windows.main.dispatch('showCreateTorrent', selectedPaths)
|
||||
electron.dialog.showOpenDialog(windows.main.win, opts, function (selectedPaths) {
|
||||
resetTitle()
|
||||
if (!Array.isArray(selectedPaths)) return
|
||||
windows.main.dispatch('showCreateTorrent', selectedPaths)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ function setBadge (count) {
|
||||
if (process.platform === 'darwin' ||
|
||||
(process.platform === 'linux' && app.isUnityRunning())) {
|
||||
log(`setBadge: ${count}`)
|
||||
app.badgeCount = Number(count)
|
||||
app.setBadgeCount(Number(count))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ function init () {
|
||||
isReady = true
|
||||
const state = results.state
|
||||
|
||||
windows.main.init(state, { hidden })
|
||||
windows.main.init(state, { hidden: hidden })
|
||||
windows.webtorrent.init()
|
||||
menu.init()
|
||||
|
||||
|
||||
@@ -141,9 +141,9 @@ function init () {
|
||||
* Shell
|
||||
*/
|
||||
|
||||
ipc.on('openPath', (e, ...args) => {
|
||||
ipc.on('openItem', (e, ...args) => {
|
||||
const shell = require('./shell')
|
||||
shell.openPath(...args)
|
||||
shell.openItem(...args)
|
||||
})
|
||||
ipc.on('showItemInFolder', (e, ...args) => {
|
||||
const shell = require('./shell')
|
||||
@@ -235,8 +235,8 @@ function init () {
|
||||
} else {
|
||||
// Queue message for webtorrent window, it hasn't finished loading yet
|
||||
messageQueueMainToWebTorrent.push({
|
||||
name,
|
||||
args
|
||||
name: name,
|
||||
args: args
|
||||
})
|
||||
log('webtorrent: queueing %s', name)
|
||||
}
|
||||
|
||||
@@ -288,14 +288,6 @@ function getMenuTemplate () {
|
||||
{
|
||||
label: 'Resume All',
|
||||
click: () => windows.main.dispatch('resumeAllTorrents')
|
||||
},
|
||||
{
|
||||
label: 'Remove All From List',
|
||||
click: () => windows.main.dispatch('confirmDeleteAllTorrents', false)
|
||||
},
|
||||
{
|
||||
label: 'Remove All Data Files',
|
||||
click: () => windows.main.dispatch('confirmDeleteAllTorrents', true)
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -365,7 +357,8 @@ function getMenuTemplate () {
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
role: 'services'
|
||||
role: 'services',
|
||||
submenu: []
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module.exports = {
|
||||
openExternal,
|
||||
openPath,
|
||||
openItem,
|
||||
showItemInFolder,
|
||||
moveItemToTrash
|
||||
}
|
||||
@@ -19,9 +19,9 @@ function openExternal (url) {
|
||||
/**
|
||||
* Open the given file in the desktop’s default manner.
|
||||
*/
|
||||
function openPath (path) {
|
||||
log(`openPath: ${path}`)
|
||||
electron.shell.openPath(path)
|
||||
function openItem (path) {
|
||||
log(`openItem: ${path}`)
|
||||
electron.shell.openItem(path)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -72,6 +72,6 @@ function initDarwinWin32 () {
|
||||
(e, notes, name, date, url) => log(`Update downloaded: ${name}: ${url}`)
|
||||
)
|
||||
|
||||
electron.autoUpdater.setFeedURL({ url: AUTO_UPDATE_URL })
|
||||
electron.autoUpdater.setFeedURL(AUTO_UPDATE_URL)
|
||||
electron.autoUpdater.checkForUpdates()
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ function init () {
|
||||
backgroundColor: '#ECECEC',
|
||||
center: true,
|
||||
fullscreen: false,
|
||||
height: 250,
|
||||
height: 170,
|
||||
icon: getIconPath(),
|
||||
maximizable: false,
|
||||
minimizable: false,
|
||||
@@ -25,20 +25,18 @@ function init () {
|
||||
title: 'About ' + config.APP_WINDOW_TITLE,
|
||||
useContentSize: true,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
enableBlinkFeatures: 'AudioVideoTracks'
|
||||
nodeIntegration: true
|
||||
},
|
||||
width: 300
|
||||
})
|
||||
|
||||
win.loadURL(config.WINDOW_ABOUT)
|
||||
|
||||
// No menu on the About window
|
||||
win.setMenu(null)
|
||||
|
||||
win.once('ready-to-show', function () {
|
||||
win.show()
|
||||
// No menu on the About window
|
||||
// Hack: BrowserWindow removeMenu method not working on electron@7
|
||||
// https://github.com/electron/electron/issues/21088
|
||||
win.setMenuBarVisibility(false)
|
||||
})
|
||||
|
||||
win.once('closed', function () {
|
||||
|
||||
@@ -32,6 +32,7 @@ function init (state, options) {
|
||||
|
||||
const win = main.win = new electron.BrowserWindow({
|
||||
backgroundColor: '#282828',
|
||||
backgroundThrottling: false, // do not throttle animations/timers when page is background
|
||||
darkTheme: true, // Forces dark theme (GTK+3)
|
||||
height: initialBounds.height,
|
||||
icon: getIconPath(), // Window icon (Windows, Linux)
|
||||
@@ -43,8 +44,7 @@ function init (state, options) {
|
||||
useContentSize: true, // Specify web page size without OS chrome
|
||||
width: initialBounds.width,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
enableBlinkFeatures: 'AudioVideoTracks'
|
||||
nodeIntegration: true
|
||||
},
|
||||
x: initialBounds.x,
|
||||
y: initialBounds.y
|
||||
|
||||
@@ -13,6 +13,7 @@ const config = require('../../config')
|
||||
function init () {
|
||||
const win = webtorrent.win = new electron.BrowserWindow({
|
||||
backgroundColor: '#1E1E1E',
|
||||
backgroundThrottling: false, // do not throttle animations/timers when page is background
|
||||
center: true,
|
||||
fullscreen: false,
|
||||
fullscreenable: false,
|
||||
@@ -25,8 +26,7 @@ function init () {
|
||||
title: 'webtorrent-hidden-window',
|
||||
useContentSize: true,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
enableBlinkFeatures: 'AudioVideoTracks'
|
||||
nodeIntegration: true
|
||||
},
|
||||
width: 150
|
||||
})
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
const React = require('react')
|
||||
|
||||
const ModalOKCancel = require('./modal-ok-cancel')
|
||||
const { dispatch, dispatcher } = require('../lib/dispatcher')
|
||||
|
||||
module.exports = class DeleteAllTorrentsModal extends React.Component {
|
||||
render () {
|
||||
const { state: { modal: { deleteData } } } = this.props
|
||||
const message = deleteData
|
||||
? 'Are you sure you want to remove all the torrents from the list and delete the data files?'
|
||||
: 'Are you sure you want to remove all the torrents from the list?'
|
||||
const buttonText = deleteData ? 'REMOVE DATA' : 'REMOVE'
|
||||
|
||||
return (
|
||||
<div>
|
||||
<p><strong>{message}</strong></p>
|
||||
<ModalOKCancel
|
||||
cancelText='CANCEL'
|
||||
onCancel={dispatcher('exitModal')}
|
||||
okText={buttonText}
|
||||
onOK={handleRemove}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
||||
function handleRemove () {
|
||||
dispatch('deleteAllTorrents', deleteData)
|
||||
dispatch('exitModal')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,9 +36,14 @@ class PathSelector extends React.Component {
|
||||
properties: ['openFile', 'openDirectory']
|
||||
}, this.props.dialog)
|
||||
|
||||
const filenames = remote.dialog.showOpenDialogSync(remote.getCurrentWindow(), opts)
|
||||
if (!Array.isArray(filenames)) return
|
||||
this.props.onChange && this.props.onChange(filenames[0])
|
||||
remote.dialog.showOpenDialog(
|
||||
remote.getCurrentWindow(),
|
||||
opts,
|
||||
(filenames) => {
|
||||
if (!Array.isArray(filenames)) return
|
||||
this.props.onChange && this.props.onChange(filenames[0])
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
render () {
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
const { dispatch } = require('../lib/dispatcher')
|
||||
|
||||
module.exports = class AudioTracksController {
|
||||
constructor (state) {
|
||||
this.state = state
|
||||
}
|
||||
|
||||
selectAudioTrack (ix) {
|
||||
this.state.playing.audioTracks.selectedIndex = ix
|
||||
dispatch('skip', 0.2) // HACK: hardcoded seek value for smooth audio change
|
||||
}
|
||||
|
||||
toggleAudioTracksMenu () {
|
||||
const audioTracks = this.state.playing.audioTracks
|
||||
audioTracks.showMenu = !audioTracks.showMenu
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ module.exports = class MediaController {
|
||||
ipcRenderer.once('checkForExternalPlayer', function (e, isInstalled) {
|
||||
state.modal = {
|
||||
id: 'unsupported-media-modal',
|
||||
error,
|
||||
error: error,
|
||||
externalPlayerInstalled: isInstalled
|
||||
}
|
||||
})
|
||||
|
||||
@@ -61,12 +61,12 @@ module.exports = class PlaybackController {
|
||||
}
|
||||
|
||||
// Open a file in OS default app.
|
||||
openPath (infoHash, index) {
|
||||
openItem (infoHash, index) {
|
||||
const torrentSummary = TorrentSummary.getByKey(this.state, infoHash)
|
||||
const filePath = path.join(
|
||||
torrentSummary.path,
|
||||
torrentSummary.files[index].path)
|
||||
ipcRenderer.send('openPath', filePath)
|
||||
ipcRenderer.send('openItem', filePath)
|
||||
}
|
||||
|
||||
// Toggle (play or pause) the currently playing media
|
||||
|
||||
@@ -13,13 +13,14 @@ module.exports = class SubtitlesController {
|
||||
}
|
||||
|
||||
openSubtitles () {
|
||||
const filenames = remote.dialog.showOpenDialogSync({
|
||||
remote.dialog.showOpenDialog({
|
||||
title: 'Select a subtitles file.',
|
||||
filters: [{ name: 'Subtitles', extensions: ['vtt', 'srt'] }],
|
||||
properties: ['openFile']
|
||||
}, (filenames) => {
|
||||
if (!Array.isArray(filenames)) return
|
||||
this.addSubtitles(filenames, true)
|
||||
})
|
||||
if (!Array.isArray(filenames)) return
|
||||
this.addSubtitles(filenames, true)
|
||||
}
|
||||
|
||||
selectSubtitle (ix) {
|
||||
@@ -109,7 +110,7 @@ function loadSubtitle (file, cb) {
|
||||
buffer: 'data:text/vtt;base64,' + buf.toString('base64'),
|
||||
language: langDetected,
|
||||
label: langDetected,
|
||||
filePath
|
||||
filePath: filePath
|
||||
}
|
||||
|
||||
cb(null, track)
|
||||
|
||||
@@ -25,7 +25,7 @@ module.exports = class TorrentController {
|
||||
}
|
||||
|
||||
torrentSummary = {
|
||||
torrentKey,
|
||||
torrentKey: torrentKey,
|
||||
status: 'new'
|
||||
}
|
||||
torrents.unshift(torrentSummary)
|
||||
|
||||
@@ -55,7 +55,7 @@ module.exports = class TorrentListController {
|
||||
if (files.length === 0 || typeof files[0] !== 'string') {
|
||||
this.state.location.go({
|
||||
url: 'create-torrent',
|
||||
files,
|
||||
files: files,
|
||||
setup: (cb) => {
|
||||
this.state.window.title = 'Create New Torrent'
|
||||
cb(null)
|
||||
@@ -201,38 +201,26 @@ module.exports = class TorrentListController {
|
||||
}
|
||||
}
|
||||
|
||||
confirmDeleteAllTorrents (deleteData) {
|
||||
this.state.modal = {
|
||||
id: 'delete-all-torrents-modal',
|
||||
deleteData
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: use torrentKey, not infoHash
|
||||
deleteTorrent (infoHash, deleteData) {
|
||||
ipcRenderer.send('wt-stop-torrenting', infoHash)
|
||||
|
||||
const index = this.state.saved.torrents.findIndex((x) => x.infoHash === infoHash)
|
||||
|
||||
if (index > -1) {
|
||||
const summary = this.state.saved.torrents[index]
|
||||
deleteTorrentFile(summary, deleteData)
|
||||
|
||||
// remove torrent and poster file
|
||||
deleteFile(TorrentSummary.getTorrentPath(summary))
|
||||
deleteFile(TorrentSummary.getPosterPath(summary))
|
||||
|
||||
// optionally delete the torrent data
|
||||
if (deleteData) moveItemToTrash(summary)
|
||||
|
||||
// remove torrent from saved list
|
||||
this.state.saved.torrents.splice(index, 1)
|
||||
dispatch('stateSave')
|
||||
|
||||
// prevent user from going forward to a deleted torrent
|
||||
this.state.location.clearForward('player')
|
||||
sound.play('DELETE')
|
||||
} else {
|
||||
throw new TorrentKeyNotFoundError(infoHash)
|
||||
}
|
||||
}
|
||||
|
||||
deleteAllTorrents (deleteData) {
|
||||
this.state.saved.torrents.forEach((summary) => deleteTorrentFile(summary, deleteData))
|
||||
|
||||
this.state.saved.torrents = []
|
||||
dispatch('stateSave')
|
||||
|
||||
// prevent user from going forward to a deleted torrent
|
||||
this.state.location.clearForward('player')
|
||||
@@ -291,24 +279,14 @@ module.exports = class TorrentListController {
|
||||
enabled: torrentSummary.torrentFileName != null
|
||||
}))
|
||||
|
||||
menu.append(new electron.remote.MenuItem({
|
||||
type: 'separator'
|
||||
}))
|
||||
|
||||
const sortedByName = this.state.saved.prefs.sortByName
|
||||
menu.append(new electron.remote.MenuItem({
|
||||
label: `${sortedByName ? '✓ ' : ''}Sort by Name`,
|
||||
click: () => dispatch('updatePreferences', 'sortByName', !sortedByName)
|
||||
}))
|
||||
|
||||
menu.popup({ window: electron.remote.getCurrentWindow() })
|
||||
menu.popup(electron.remote.getCurrentWindow())
|
||||
}
|
||||
|
||||
// Takes a torrentSummary or torrentKey
|
||||
// Shows a Save File dialog, then saves the .torrent file wherever the user requests
|
||||
saveTorrentFileAs (torrentKey) {
|
||||
const torrentSummary = TorrentSummary.getByKey(this.state, torrentKey)
|
||||
if (!torrentSummary) throw new TorrentKeyNotFoundError(torrentKey)
|
||||
if (!torrentSummary) throw new Error('Missing torrentKey: ' + torrentKey)
|
||||
const downloadPath = this.state.saved.prefs.downloadPath
|
||||
const newFileName = path.parse(torrentSummary.name).name + '.torrent'
|
||||
const win = electron.remote.getCurrentWindow()
|
||||
@@ -318,19 +296,18 @@ module.exports = class TorrentListController {
|
||||
filters: [
|
||||
{ name: 'Torrent Files', extensions: ['torrent'] },
|
||||
{ name: 'All Files', extensions: ['*'] }
|
||||
],
|
||||
buttonLabel: 'Save'
|
||||
]
|
||||
}
|
||||
|
||||
const savePath = electron.remote.dialog.showSaveDialogSync(win, opts)
|
||||
|
||||
if (!savePath) return // They clicked Cancel
|
||||
console.log('Saving torrent ' + torrentKey + ' to ' + savePath)
|
||||
const torrentPath = TorrentSummary.getTorrentPath(torrentSummary)
|
||||
fs.readFile(torrentPath, function (err, torrentFile) {
|
||||
if (err) return dispatch('error', err)
|
||||
fs.writeFile(savePath, torrentFile, function (err) {
|
||||
electron.remote.dialog.showSaveDialog(win, opts, function (savePath) {
|
||||
console.log('Saving torrent ' + torrentKey + ' to ' + savePath)
|
||||
if (!savePath) return // They clicked Cancel
|
||||
const torrentPath = TorrentSummary.getTorrentPath(torrentSummary)
|
||||
fs.readFile(torrentPath, function (err, torrentFile) {
|
||||
if (err) return dispatch('error', err)
|
||||
fs.writeFile(savePath, torrentFile, function (err) {
|
||||
if (err) return dispatch('error', err)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -346,7 +323,7 @@ function findFilesRecursive (paths, cb_) {
|
||||
findFilesRecursive([path], function (fileObjs) {
|
||||
ret.push(...fileObjs)
|
||||
if (++numComplete === paths.length) {
|
||||
ret.sort((a, b) => a.path < b.path ? -1 : Number(a.path > b.path))
|
||||
ret.sort((a, b) => a.path < b.path ? -1 : a.path > b.path)
|
||||
cb_(ret)
|
||||
}
|
||||
})
|
||||
@@ -394,14 +371,3 @@ function moveItemToTrash (torrentSummary) {
|
||||
function showItemInFolder (torrentSummary) {
|
||||
ipcRenderer.send('showItemInFolder', TorrentSummary.getFileOrFolder(torrentSummary))
|
||||
}
|
||||
|
||||
function deleteTorrentFile (torrentSummary, deleteData) {
|
||||
ipcRenderer.send('wt-stop-torrenting', torrentSummary.infoHash)
|
||||
|
||||
// remove torrent and poster file
|
||||
deleteFile(TorrentSummary.getTorrentPath(torrentSummary))
|
||||
deleteFile(TorrentSummary.getPosterPath(torrentSummary))
|
||||
|
||||
// optionally delete the torrent data
|
||||
if (deleteData) moveItemToTrash(torrentSummary)
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ module.exports = class UpdateController {
|
||||
console.log('new version skipped by user: v' + version)
|
||||
return
|
||||
}
|
||||
this.state.modal = { id: 'update-available-modal', version }
|
||||
this.state.modal = { id: 'update-available-modal', version: version }
|
||||
}
|
||||
|
||||
// Don't show the modal again until the next version
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const mediaExtensions = {
|
||||
audio: [
|
||||
'.aac', '.aif', '.aiff', '.asf', '.dff', '.dsf', '.flac', '.m2a',
|
||||
'.m2a', '.m4a', '.mpc', '.m4b', '.mka', '.mp2', '.mp3', '.mpc', '.oga',
|
||||
'.ogg', '.opus', '.spx', '.wma', '.wav', '.wv', '.wvp'],
|
||||
'.m4a', '.m4b', '.mp2', '.mp3', '.mpc', '.oga', '.ogg', '.opus',
|
||||
'.spx', '.wma', '.wav', '.wv', '.wvp'],
|
||||
video: [
|
||||
'.avi', '.mp4', '.m4v', '.webm', '.mov', '.mkv', '.mpg', '.mpeg',
|
||||
'.ogv', '.webm', '.wmv'],
|
||||
|
||||
@@ -29,7 +29,7 @@ function run (state) {
|
||||
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.21.0')) migrate_0_21_0(saved)
|
||||
if (semver.lt(version, '0.22.0')) migrate_0_22_0(saved)
|
||||
if (semver.lt(version, '0.21.1')) migrate_0_21_1(saved)
|
||||
|
||||
// Config is now on the new version
|
||||
state.saved.version = config.APP_VERSION
|
||||
@@ -216,7 +216,7 @@ function migrate_0_21_0 (saved) {
|
||||
}
|
||||
}
|
||||
|
||||
function migrate_0_22_0 (saved) {
|
||||
function migrate_0_21_1 (saved) {
|
||||
if (saved.prefs.externalPlayerPath == null) {
|
||||
saved.prefs.externalPlayerPath = ''
|
||||
}
|
||||
|
||||
@@ -105,11 +105,6 @@ function getDefaultPlayState () {
|
||||
selectedIndex: -1, /* current subtitle track */
|
||||
showMenu: false /* popover menu, above the video */
|
||||
},
|
||||
audioTracks: {
|
||||
tracks: [],
|
||||
selectedIndex: 0, /* current audio track */
|
||||
showMenu: false /* popover menu, above the video */
|
||||
},
|
||||
aspectRatio: 0 /* aspect ratio of the video */
|
||||
}
|
||||
}
|
||||
@@ -202,20 +197,19 @@ function shouldHidePlayerControls () {
|
||||
this.playing.playbackRate === 1
|
||||
}
|
||||
|
||||
async function load (cb) {
|
||||
let saved = await appConfig.read()
|
||||
|
||||
if (!saved || !saved.version) {
|
||||
console.log('Missing config file: Creating new one')
|
||||
try {
|
||||
saved = setupStateSaved()
|
||||
} catch (err) {
|
||||
onSavedState(err)
|
||||
return
|
||||
function load (cb) {
|
||||
appConfig.read(function (err, saved) {
|
||||
if (err || !saved.version) {
|
||||
console.log('Missing config file: Creating new one')
|
||||
try {
|
||||
saved = setupStateSaved()
|
||||
} catch (err) {
|
||||
onSavedState(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onSavedState(null, saved)
|
||||
onSavedState(null, saved)
|
||||
})
|
||||
|
||||
function onSavedState (err, saved) {
|
||||
if (err) return cb(err)
|
||||
@@ -233,7 +227,7 @@ async function load (cb) {
|
||||
}
|
||||
|
||||
// Write state.saved to the JSON state file
|
||||
async function saveImmediate (state, cb) {
|
||||
function saveImmediate (state, cb) {
|
||||
console.log('Saving state to ' + appConfig.filePath)
|
||||
|
||||
// Clean up, so that we're not saving any pending state
|
||||
@@ -256,10 +250,8 @@ async function saveImmediate (state, cb) {
|
||||
return torrent
|
||||
})
|
||||
|
||||
try {
|
||||
await appConfig.write(copy)
|
||||
State.emit('stateSaved')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
appConfig.write(copy, (err) => {
|
||||
if (err) console.error(err)
|
||||
else State.emit('stateSaved')
|
||||
})
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ function getLargestFileByExtension (torrent, extensions) {
|
||||
* 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 {Array} Array of torrent file objects matching one of the given extensions
|
||||
* @returns {number} Array of torrent file objects matching one of the given extensions
|
||||
*/
|
||||
function filterOnExtension (torrent, extensions) {
|
||||
return torrent.files.filter(file => {
|
||||
@@ -117,7 +117,7 @@ function torrentPosterFromAudio (torrent, cb) {
|
||||
|
||||
const bestCover = imageFiles.map(file => {
|
||||
return {
|
||||
file,
|
||||
file: file,
|
||||
score: scoreAudioCoverFile(file)
|
||||
}
|
||||
}).reduce((a, b) => {
|
||||
|
||||
@@ -99,10 +99,6 @@ function onState (err, _state) {
|
||||
const SubtitlesController = require('./controllers/subtitles-controller')
|
||||
return new SubtitlesController(state)
|
||||
}),
|
||||
audioTracks: createGetter(() => {
|
||||
const AudioTracksController = require('./controllers/audio-tracks-controller')
|
||||
return new AudioTracksController(state)
|
||||
}),
|
||||
torrent: createGetter(() => {
|
||||
const TorrentController = require('./controllers/torrent-controller')
|
||||
return new TorrentController(state)
|
||||
@@ -255,10 +251,6 @@ const dispatchHandlers = {
|
||||
controllers.torrentList().confirmDeleteTorrent(infoHash, deleteData),
|
||||
deleteTorrent: (infoHash, deleteData) =>
|
||||
controllers.torrentList().deleteTorrent(infoHash, deleteData),
|
||||
confirmDeleteAllTorrents: (deleteData) =>
|
||||
controllers.torrentList().confirmDeleteAllTorrents(deleteData),
|
||||
deleteAllTorrents: (deleteData) =>
|
||||
controllers.torrentList().deleteAllTorrents(deleteData),
|
||||
toggleSelectTorrent: (infoHash) =>
|
||||
controllers.torrentList().toggleSelectTorrent(infoHash),
|
||||
openTorrentContextMenu: (infoHash) =>
|
||||
@@ -280,7 +272,7 @@ const dispatchHandlers = {
|
||||
changePlaybackRate: (dir) => controllers.playback().changePlaybackRate(dir),
|
||||
changeVolume: (delta) => controllers.playback().changeVolume(delta),
|
||||
setVolume: (vol) => controllers.playback().setVolume(vol),
|
||||
openPath: (infoHash, index) => controllers.playback().openPath(infoHash, index),
|
||||
openItem: (infoHash, index) => controllers.playback().openItem(infoHash, index),
|
||||
|
||||
// Subtitles
|
||||
openSubtitles: () => controllers.subtitles().openSubtitles(),
|
||||
@@ -289,10 +281,6 @@ const dispatchHandlers = {
|
||||
checkForSubtitles: () => controllers.subtitles().checkForSubtitles(),
|
||||
addSubtitles: (files, autoSelect) => controllers.subtitles().addSubtitles(files, autoSelect),
|
||||
|
||||
// Audio Tracks
|
||||
selectAudioTrack: (index) => controllers.audioTracks().selectAudioTrack(index),
|
||||
toggleAudioTracksMenu: () => controllers.audioTracks().toggleAudioTracksMenu(),
|
||||
|
||||
// Local media: <video>, <audio>, external players
|
||||
mediaStalled: () => controllers.media().mediaStalled(),
|
||||
mediaError: (err) => controllers.media().mediaError(err),
|
||||
@@ -312,7 +300,7 @@ const dispatchHandlers = {
|
||||
// Preferences screen
|
||||
preferences: () => controllers.prefs().show(),
|
||||
updatePreferences: (key, value) => controllers.prefs().update(key, value),
|
||||
checkDownloadPath,
|
||||
checkDownloadPath: checkDownloadPath,
|
||||
startFolderWatcher: () => controllers.folderWatcher().start(),
|
||||
stopFolderWatcher: () => controllers.folderWatcher().stop(),
|
||||
|
||||
@@ -322,20 +310,20 @@ const dispatchHandlers = {
|
||||
|
||||
// Navigation between screens (back, forward, ESC, etc)
|
||||
exitModal: () => { state.modal = null },
|
||||
backToList,
|
||||
escapeBack,
|
||||
backToList: backToList,
|
||||
escapeBack: escapeBack,
|
||||
back: () => state.location.back(),
|
||||
forward: () => state.location.forward(),
|
||||
cancel: () => state.location.cancel(),
|
||||
|
||||
// Controlling the window
|
||||
setDimensions,
|
||||
setDimensions: setDimensions,
|
||||
toggleFullScreen: (setTo) => ipcRenderer.send('toggleFullScreen', setTo),
|
||||
setTitle: (title) => { state.window.title = title },
|
||||
resetTitle: () => { state.window.title = config.APP_WINDOW_TITLE },
|
||||
|
||||
// Everything else
|
||||
onOpen,
|
||||
onOpen: onOpen,
|
||||
error: onError,
|
||||
uncaughtError: (proc, err) => telemetry.logUncaughtError(proc, err),
|
||||
stateSave: () => State.save(state),
|
||||
@@ -563,7 +551,7 @@ function onBlur () {
|
||||
}
|
||||
|
||||
function onVisibilityChange () {
|
||||
state.window.isVisible = !document.hidden
|
||||
state.window.isVisible = !document.webkitHidden
|
||||
}
|
||||
|
||||
function onFullscreenChanged (e, isFullScreen) {
|
||||
|
||||
@@ -24,9 +24,7 @@ const Modals = {
|
||||
),
|
||||
'remove-torrent-modal': createGetter(() => require('../components/remove-torrent-modal')),
|
||||
'update-available-modal': createGetter(() => require('../components/update-available-modal')),
|
||||
'unsupported-media-modal': createGetter(() => require('../components/unsupported-media-modal')),
|
||||
'delete-all-torrents-modal':
|
||||
createGetter(() => require('../components/delete-all-torrents-modal'))
|
||||
'unsupported-media-modal': createGetter(() => require('../components/unsupported-media-modal'))
|
||||
}
|
||||
|
||||
const fontFamily = process.platform === 'win32'
|
||||
|
||||
@@ -54,6 +54,10 @@ function renderMedia (state) {
|
||||
mediaElement.pause()
|
||||
} else if (!state.playing.isPaused && mediaElement.paused) {
|
||||
mediaElement.play()
|
||||
.then(
|
||||
() => dispatch('mediaSuccess'),
|
||||
err => dispatch('mediaError', err.name === 'NotSupportedError' ? 'Codec unsupported' : `${err.name}: ${err.message}`)
|
||||
)
|
||||
}
|
||||
// When the user clicks or drags on the progress bar, jump to that position
|
||||
if (state.playing.jumpToTime != null) {
|
||||
@@ -95,13 +99,6 @@ function renderMedia (state) {
|
||||
delete file.selectedSubtitle
|
||||
}
|
||||
|
||||
// Switch to selected audio track
|
||||
const audioTracks = mediaElement.audioTracks || []
|
||||
for (let j = 0; j < audioTracks.length; j++) {
|
||||
const isSelectedTrack = j === state.playing.audioTracks.selectedIndex
|
||||
audioTracks[j].enabled = isSelectedTrack
|
||||
}
|
||||
|
||||
state.playing.volume = mediaElement.volume
|
||||
}
|
||||
|
||||
@@ -114,9 +111,9 @@ function renderMedia (state) {
|
||||
trackTags.push(
|
||||
<track
|
||||
key={i}
|
||||
default={isSelected}
|
||||
default={isSelected ? 'default' : ''}
|
||||
label={track.label}
|
||||
kind='subtitles'
|
||||
type='subtitles'
|
||||
src={track.buffer}
|
||||
/>
|
||||
)
|
||||
@@ -132,7 +129,6 @@ function renderMedia (state) {
|
||||
onLoadedMetadata={onLoadedMetadata}
|
||||
onEnded={onEnded}
|
||||
onStalled={dispatcher('mediaStalled')}
|
||||
onError={dispatcher('mediaError')}
|
||||
onTimeUpdate={dispatcher('mediaTimeUpdate')}
|
||||
onEncrypted={dispatcher('mediaEncrypted')}
|
||||
>
|
||||
@@ -152,50 +148,15 @@ function renderMedia (state) {
|
||||
</div>
|
||||
)
|
||||
|
||||
// As soon as we know the video dimensions, resize the window
|
||||
function onLoadedMetadata (e) {
|
||||
const mediaElement = e.target
|
||||
|
||||
// check if we can decode video and audio track
|
||||
if (state.playing.type === 'video') {
|
||||
if (mediaElement.videoTracks.length === 0) {
|
||||
dispatch('mediaError', 'Video codec unsupported')
|
||||
}
|
||||
|
||||
if (mediaElement.audioTracks.length === 0) {
|
||||
dispatch('mediaError', 'Audio codec unsupported')
|
||||
}
|
||||
|
||||
dispatch('mediaSuccess')
|
||||
|
||||
const dimensions = {
|
||||
width: mediaElement.videoWidth,
|
||||
height: mediaElement.videoHeight
|
||||
}
|
||||
|
||||
// As soon as we know the video dimensions, resize the window
|
||||
dispatch('setDimensions', dimensions)
|
||||
|
||||
// set audioTracks
|
||||
const tracks = []
|
||||
for (let i = 0; i < mediaElement.audioTracks.length; i++) {
|
||||
tracks.push({
|
||||
label: mediaElement.audioTracks[i].label || `Track ${i + 1}`,
|
||||
language: mediaElement.audioTracks[i].language
|
||||
})
|
||||
}
|
||||
|
||||
state.playing.audioTracks.tracks = tracks
|
||||
state.playing.audioTracks.selectedIndex = 0
|
||||
}
|
||||
|
||||
// check if we can decode audio track
|
||||
if (state.playing.type === 'audio') {
|
||||
if (mediaElement.audioTracks.length === 0) {
|
||||
dispatch('mediaError', 'Audio codec unsupported')
|
||||
}
|
||||
|
||||
dispatch('mediaSuccess')
|
||||
if (state.playing.type !== 'video') return
|
||||
const video = e.target
|
||||
const dimensions = {
|
||||
width: video.videoWidth,
|
||||
height: video.videoHeight
|
||||
}
|
||||
dispatch('setDimensions', dimensions)
|
||||
}
|
||||
|
||||
function onEnded (e) {
|
||||
@@ -500,27 +461,6 @@ function renderSubtitleOptions (state) {
|
||||
)
|
||||
}
|
||||
|
||||
function renderAudioTrackOptions (state) {
|
||||
const audioTracks = state.playing.audioTracks
|
||||
if (!audioTracks.tracks.length || !audioTracks.showMenu) return
|
||||
|
||||
const items = audioTracks.tracks.map(function (track, ix) {
|
||||
const isSelected = state.playing.audioTracks.selectedIndex === ix
|
||||
return (
|
||||
<li key={ix} onClick={dispatcher('selectAudioTrack', ix)}>
|
||||
<i className='icon'>{'radio_button_' + (isSelected ? 'checked' : 'unchecked')}</i>
|
||||
{track.label}
|
||||
</li>
|
||||
)
|
||||
})
|
||||
|
||||
return (
|
||||
<ul key='audio-track-options' className='options-list'>
|
||||
{items}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
|
||||
function renderPlayerControls (state) {
|
||||
const positionPercent = 100 * state.playing.currentTime / state.playing.duration
|
||||
const playbackCursorStyle = { left: 'calc(' + positionPercent + '% - 3px)' }
|
||||
@@ -529,9 +469,6 @@ function renderPlayerControls (state) {
|
||||
: state.playing.subtitles.selectedIndex >= 0
|
||||
? 'active'
|
||||
: ''
|
||||
const multiAudioClass = state.playing.audioTracks.tracks.length > 1
|
||||
? 'active'
|
||||
: 'disabled'
|
||||
const prevClass = Playlist.hasPrevious(state) ? '' : 'disabled'
|
||||
const nextClass = Playlist.hasNext(state) ? '' : 'disabled'
|
||||
|
||||
@@ -546,7 +483,7 @@ function renderPlayerControls (state) {
|
||||
<div
|
||||
key='scrub-bar'
|
||||
className='scrub-bar'
|
||||
draggable
|
||||
draggable='true'
|
||||
onDragStart={handleDragStart}
|
||||
onClick={handleScrub}
|
||||
onDrag={handleScrub}
|
||||
@@ -596,14 +533,6 @@ function renderPlayerControls (state) {
|
||||
>
|
||||
closed_caption
|
||||
</i>
|
||||
), (
|
||||
<i
|
||||
key='audio-tracks'
|
||||
className={'icon multi-audio float-right ' + multiAudioClass}
|
||||
onClick={handleAudioTracks}
|
||||
>
|
||||
library_music
|
||||
</i>
|
||||
))
|
||||
}
|
||||
|
||||
@@ -710,7 +639,6 @@ function renderPlayerControls (state) {
|
||||
{elements}
|
||||
{renderCastOptions(state)}
|
||||
{renderSubtitleOptions(state)}
|
||||
{renderAudioTrackOptions(state)}
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -754,10 +682,6 @@ function renderPlayerControls (state) {
|
||||
dispatch('toggleSubtitlesMenu')
|
||||
}
|
||||
}
|
||||
|
||||
function handleAudioTracks (e) {
|
||||
dispatch('toggleAudioTracksMenu')
|
||||
}
|
||||
}
|
||||
|
||||
// Renders the loading bar. Shows which parts of the torrent are loaded, which
|
||||
|
||||
@@ -284,17 +284,10 @@ module.exports = class TorrentList extends React.Component {
|
||||
)
|
||||
} else {
|
||||
// We do know the files. List them and show download stats for each one
|
||||
const sortByName = this.props.state.saved.prefs.sortByName
|
||||
const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' })
|
||||
let fileRows = torrentSummary.files
|
||||
const fileRows = torrentSummary.files
|
||||
.filter((file) => !file.path.includes('/.____padding_file/'))
|
||||
.map((file, index) => ({ file, index }))
|
||||
|
||||
if (sortByName) {
|
||||
fileRows = fileRows.sort((a, b) => collator.compare(a.file.name, b.file.name))
|
||||
}
|
||||
|
||||
fileRows = fileRows.map((obj) => this.renderFileRow(torrentSummary, obj.file, obj.index))
|
||||
.map((object) => this.renderFileRow(torrentSummary, object.file, object.index))
|
||||
|
||||
filesElement = (
|
||||
<div key='files' className='files'>
|
||||
@@ -346,7 +339,7 @@ module.exports = class TorrentList extends React.Component {
|
||||
} else {
|
||||
icon = 'description' /* file icon, opens in OS default app */
|
||||
handleClick = isDone
|
||||
? dispatcher('openPath', infoHash, index)
|
||||
? dispatcher('openItem', infoHash, index)
|
||||
: (e) => e.stopPropagation() // noop if file is not ready
|
||||
}
|
||||
// TODO: add a css 'disabled' class to indicate that a file cannot be opened/streamed
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
console.time('init')
|
||||
|
||||
const crypto = require('crypto')
|
||||
const util = require('util')
|
||||
const deepEqual = require('deep-equal')
|
||||
const defaultAnnounceList = require('create-torrent').announceList
|
||||
const electron = require('electron')
|
||||
const fs = require('fs')
|
||||
const mkdirp = require('mkdirp')
|
||||
const mm = require('music-metadata')
|
||||
const networkAddress = require('network-address')
|
||||
const path = require('path')
|
||||
@@ -112,8 +113,8 @@ function startTorrenting (torrentKey, torrentID, path, fileModtimes, selections)
|
||||
console.log('starting torrent %s: %s', torrentKey, torrentID)
|
||||
|
||||
const torrent = client.add(torrentID, {
|
||||
path,
|
||||
fileModtimes
|
||||
path: path,
|
||||
fileModtimes: fileModtimes
|
||||
})
|
||||
torrent.key = torrentKey
|
||||
|
||||
@@ -215,7 +216,7 @@ function saveTorrentFile (torrentKey) {
|
||||
}
|
||||
|
||||
// Otherwise, save the .torrent file, under the app config folder
|
||||
fs.mkdir(config.TORRENT_PATH, { recursive: true }, function (_) {
|
||||
mkdirp(config.TORRENT_PATH, function (_) {
|
||||
fs.writeFile(torrentPath, torrent.torrentFile, function (err) {
|
||||
if (err) return console.log('error saving torrent file %s: %o', torrentPath, err)
|
||||
console.log('saved torrent file %s', torrentPath)
|
||||
@@ -232,7 +233,7 @@ function generateTorrentPoster (torrentKey) {
|
||||
torrentPoster(torrent, function (err, buf, extension) {
|
||||
if (err) return console.log('error generating poster: %o', err)
|
||||
// save it for next time
|
||||
fs.mkdir(config.POSTER_PATH, { recursive: true }, function (err) {
|
||||
mkdirp(config.POSTER_PATH, function (err) {
|
||||
if (err) return console.log('error creating poster dir: %o', err)
|
||||
const posterFileName = torrent.infoHash + extension
|
||||
const posterFilePath = path.join(config.POSTER_PATH, posterFileName)
|
||||
@@ -248,7 +249,7 @@ function generateTorrentPoster (torrentKey) {
|
||||
function updateTorrentProgress () {
|
||||
const progress = getTorrentProgress()
|
||||
// TODO: diff torrent-by-torrent, not once for the whole update
|
||||
if (prevProgress && util.isDeepStrictEqual(progress, prevProgress)) {
|
||||
if (prevProgress && deepEqual(progress, prevProgress, { strict: true })) {
|
||||
return /* don't send heavy object if it hasn't changed */
|
||||
}
|
||||
ipc.send('wt-progress', progress)
|
||||
@@ -350,18 +351,15 @@ function getAudioMetadata (infoHash, index) {
|
||||
ipc.send('wt-audio-metadata', infoHash, index, event.metadata)
|
||||
}
|
||||
}
|
||||
const onMetadata = file.done
|
||||
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
|
||||
onMetaData
|
||||
.then(
|
||||
metadata => {
|
||||
ipc.send('wt-audio-metadata', infoHash, index, metadata)
|
||||
console.log(`metadata for file='${file.name}' completed.`)
|
||||
},
|
||||
() => console.log(`metadata for file='${file.name}' completed.`),
|
||||
err => {
|
||||
console.log(
|
||||
`error getting audio metadata for ${infoHash}:${index}`,
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
<p>
|
||||
Version <script>document.write(require('../package.json').version)</script>
|
||||
(<script>document.write(require('webtorrent/package.json').version)</script>)
|
||||
(<script>document.write(process.arch)</script>)
|
||||
(<script>document.write(process.arch === 'x64' ? '64-bit' : '32-bit')</script>)
|
||||
</p>
|
||||
<p><script>document.write(require('../build/config').APP_COPYRIGHT)</script></p>
|
||||
<p><script>document.write(require('../config').APP_COPYRIGHT)</script></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -5,7 +5,7 @@ Name=<%= productName %>
|
||||
<% if (genericName) { %>GenericName=<%= genericName %><% } %>
|
||||
<% if (description) { %>Comment=<%= description %><% } %>
|
||||
Icon=<%= name %>
|
||||
<% if (name) { %>Exec=<%= name %> --no-sandbox %U<% } %><%/*HACK: --no-sandbox fixes an Electron 6 bug. See: #1703*/%>
|
||||
<% if (name) { %>Exec=<%= name %> %U<% } %>
|
||||
Terminal=false
|
||||
Actions=CreateNewTorrent;OpenTorrentFile;OpenTorrentAddress;
|
||||
<% if (mimeType && mimeType.length) { %>MimeType=<%= mimeType.join(';') %>;<% } %>
|
||||
@@ -15,12 +15,12 @@ StartupNotify=true
|
||||
|
||||
[Desktop Action CreateNewTorrent]
|
||||
Name=Create New Torrent...
|
||||
<% if (name) { %>Exec=<%= name %> --no-sandbox -n <% } %><%/*HACK: --no-sandbox fixes an Electron 6 bug. See: #1703*/%>
|
||||
<% if (name) { %>Exec=<%= name %> -n <% } %>
|
||||
|
||||
[Desktop Action OpenTorrentFile]
|
||||
Name=Open Torrent File...
|
||||
<% if (name) { %>Exec=<%= name %> --no-sandbox -o <% } %><%/*HACK: --no-sandbox fixes an Electron 6 bug. See: #1703*/%>
|
||||
<% if (name) { %>Exec=<%= name %> -o <% } %>
|
||||
|
||||
[Desktop Action OpenTorrentAddress]
|
||||
Name=Open Torrent Address...
|
||||
<% if (name) { %>Exec=<%= name %> --no-sandbox -u <% } %><%/*HACK: --no-sandbox fixes an Electron 6 bug. See: #1703*/%>
|
||||
<% if (name) { %>Exec=<%= name %> -u <% } %>
|
||||
|
||||
@@ -623,11 +623,6 @@ body.drag .app::after {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.player .controls .icon.multi-audio {
|
||||
font-size: 26px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.player .controls .icon.fullscreen {
|
||||
font-size: 26px;
|
||||
margin-right: 15px;
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
const electron = require('electron')
|
||||
const config = require('./config')
|
||||
|
||||
console.log('Mocking electron.dialog.showOpenDialogSync...')
|
||||
electron.dialog.showOpenDialogSync = showOpenDialogSync
|
||||
|
||||
function showOpenDialogSync (win, opts) {
|
||||
return /select.*torrent file/i.test(opts.title)
|
||||
console.log('Mocking electron.dialog.showOpenDialog...')
|
||||
electron.dialog.showOpenDialog = function (win, opts, cb) {
|
||||
const ret = /select.*torrent file/i.test(opts.title)
|
||||
? config.TORRENT_FILES
|
||||
: config.SEED_FILES
|
||||
cb(ret)
|
||||
}
|
||||
|
||||
console.log('Mocking electron.dialog.showSaveDialogSync...')
|
||||
electron.dialog.showSaveDialogSync = showSaveDialogSync
|
||||
|
||||
function showSaveDialogSync (win, opts) {
|
||||
return config.SAVED_TORRENT_FILE
|
||||
console.log('Mocking electron.remote.dialog.showSaveDialog...')
|
||||
electron.dialog.showSaveDialog = function (win, opts, cb) {
|
||||
cb(config.SAVED_TORRENT_FILE)
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 966 KiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 899 KiB After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 134 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 351 KiB After Width: | Height: | Size: 400 KiB |
|
Before Width: | Height: | Size: 630 KiB After Width: | Height: | Size: 737 KiB |
|
Before Width: | Height: | Size: 378 KiB After Width: | Height: | Size: 511 KiB |
|
Before Width: | Height: | Size: 380 KiB After Width: | Height: | Size: 514 KiB |
|
Before Width: | Height: | Size: 380 KiB After Width: | Height: | Size: 514 KiB |
|
Before Width: | Height: | Size: 380 KiB After Width: | Height: | Size: 514 KiB |
|
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 381 KiB After Width: | Height: | Size: 515 KiB |
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 904 KiB |
|
Before Width: | Height: | Size: 746 KiB After Width: | Height: | Size: 873 KiB |
|
Before Width: | Height: | Size: 1003 KiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1019 KiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 1003 KiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 492 KiB After Width: | Height: | Size: 575 KiB |
|
Before Width: | Height: | Size: 630 KiB After Width: | Height: | Size: 737 KiB |
|
Before Width: | Height: | Size: 915 KiB After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 904 KiB After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 905 KiB After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 899 KiB After Width: | Height: | Size: 1.1 MiB |
@@ -1,6 +1,7 @@
|
||||
const Application = require('spectron').Application
|
||||
const { copyFileSync } = require('fs')
|
||||
const fs = require('fs')
|
||||
const mkdirp = require('mkdirp')
|
||||
const parseTorrent = require('parse-torrent')
|
||||
const path = require('path')
|
||||
const PNG = require('pngjs').PNG
|
||||
@@ -96,24 +97,22 @@ function screenshotCreateOrCompare (app, t, name) {
|
||||
} catch (err) {
|
||||
ssBuf = Buffer.alloc(0)
|
||||
}
|
||||
|
||||
return app.browserWindow.focus()
|
||||
.then(() => wait())
|
||||
.then(() => app.browserWindow.capturePage())
|
||||
.then(function (buffer) {
|
||||
if (ssBuf.length === 0) {
|
||||
console.log('Saving screenshot ' + ssPath)
|
||||
fs.writeFileSync(ssPath, buffer)
|
||||
} else {
|
||||
const match = compareIgnoringTransparency(buffer, ssBuf)
|
||||
t.ok(match, 'screenshot comparison ' + name)
|
||||
if (!match) {
|
||||
const ssFailedPath = path.join(ssDir, name + '-failed.png')
|
||||
console.log('Saving screenshot, failed comparison: ' + ssFailedPath)
|
||||
fs.writeFileSync(ssFailedPath, buffer)
|
||||
}
|
||||
return wait().then(function () {
|
||||
return app.browserWindow.capturePage()
|
||||
}).then(function (buffer) {
|
||||
if (ssBuf.length === 0) {
|
||||
console.log('Saving screenshot ' + ssPath)
|
||||
fs.writeFileSync(ssPath, buffer)
|
||||
} else {
|
||||
const match = compareIgnoringTransparency(buffer, ssBuf)
|
||||
t.ok(match, 'screenshot comparison ' + name)
|
||||
if (!match) {
|
||||
const ssFailedPath = path.join(ssDir, name + '-failed.png')
|
||||
console.log('Saving screenshot, failed comparison: ' + ssFailedPath)
|
||||
fs.writeFileSync(ssFailedPath, buffer)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Compares two PNGs, ignoring any transparent regions in bufExpected.
|
||||
@@ -159,8 +158,8 @@ function compareIgnoringTransparency (bufActual, bufExpected) {
|
||||
function resetTestDataDir () {
|
||||
rimraf.sync(config.TEST_DIR)
|
||||
// Create TEST_DIR as well as /Downloads and /Desktop
|
||||
fs.mkdirSync(config.TEST_DIR_DOWNLOAD, { recursive: true })
|
||||
fs.mkdirSync(config.TEST_DIR_DESKTOP, { recursive: true })
|
||||
mkdirp.sync(config.TEST_DIR_DOWNLOAD)
|
||||
mkdirp.sync(config.TEST_DIR_DESKTOP)
|
||||
}
|
||||
|
||||
function deleteTestDataDir () {
|
||||
@@ -179,7 +178,6 @@ function compareDownloadFolder (t, dirname, filenames) {
|
||||
}
|
||||
const expectedSorted = filenames.slice().sort()
|
||||
const actualSorted = actualFilenames.slice().sort()
|
||||
console.log(actualSorted)
|
||||
t.deepEqual(actualSorted, expectedSorted, 'download folder contents: ' + dirname)
|
||||
} catch (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
@@ -212,14 +210,12 @@ function compareTorrentFiles (t, pathActual, pathExpected) {
|
||||
function compareTorrentFile (t, pathActual, fieldsExpected) {
|
||||
const bufActual = fs.readFileSync(pathActual)
|
||||
const fieldsActual = extractImportantFields(parseTorrent(bufActual))
|
||||
if (Array.isArray(fieldsExpected.announce)) fieldsExpected.announce.sort()
|
||||
t.deepEqual(fieldsActual, fieldsExpected, 'torrent contents: ' + pathActual)
|
||||
}
|
||||
|
||||
function extractImportantFields (parsedTorrent) {
|
||||
let { infoHash, name, announce, urlList, comment } = parsedTorrent
|
||||
const { infoHash, name, announce, urlList, comment } = parsedTorrent
|
||||
const priv = parsedTorrent.private // private is a reserved word in JS
|
||||
announce = announce.slice().sort()
|
||||
return { infoHash, name, announce, urlList, comment, private: priv }
|
||||
}
|
||||
|
||||
|
||||
@@ -38,19 +38,18 @@ test('create-torrent', function (t) {
|
||||
|
||||
const expectedTorrent = {
|
||||
announce: [
|
||||
'udp://tracker.leechers-paradise.org:6969',
|
||||
'udp://tracker.coppersurfer.tk:6969',
|
||||
'udp://tracker.opentrackr.org:1337',
|
||||
'udp://explodie.org:6969',
|
||||
'udp://tracker.coppersurfer.tk:6969',
|
||||
'udp://tracker.empire-js.us:1337',
|
||||
'udp://tracker.leechers-paradise.org:6969',
|
||||
'udp://tracker.opentrackr.org:1337',
|
||||
'wss://tracker.btorrent.xyz',
|
||||
'wss://tracker.fastcast.nz',
|
||||
'wss://tracker.openwebtorrent.com'
|
||||
],
|
||||
infoHash: 'b31a80b3dd807c2fdde4c4da1a0db6123fa35883',
|
||||
name: 'tmp.jpg',
|
||||
urlList: [],
|
||||
comment: undefined,
|
||||
private: undefined
|
||||
urlList: []
|
||||
}
|
||||
|
||||
// Set up the files to seed
|
||||
@@ -78,7 +77,9 @@ test('create-torrent', function (t) {
|
||||
'dispatch("saveTorrentFileAs", 6)'))
|
||||
.then(() => setup.wait())
|
||||
// Mock saves to <temp folder>/Desktop/saved.torrent
|
||||
.then(() => setup.compareTorrentFile(t, config.SAVED_TORRENT_FILE, expectedTorrent))
|
||||
.then(() => setup.compareTorrentFile(t,
|
||||
config.SAVED_TORRENT_FILE,
|
||||
expectedTorrent))
|
||||
.then(() => setup.endTest(app, t),
|
||||
(err) => setup.endTest(app, t, err || 'error'))
|
||||
})
|
||||
|
||||
@@ -12,7 +12,7 @@ test('audio-streaming', function (t) {
|
||||
.then(() => app.client.moveToObject('#torrent-wired'))
|
||||
.then(() => setup.wait())
|
||||
.then(() => app.client.click('#torrent-wired .icon.play'))
|
||||
.then(() => app.client.waitUntilTextExists('.player', 'Beastie Boys'))
|
||||
.then(() => app.client.waitUntilTextExists('.player', 'The Wired CD'))
|
||||
// Pause. Skip to two seconds in. Wait another two seconds for it to load.
|
||||
.then(() => app.webContents.executeJavaScript('dispatch("playPause")'))
|
||||
.then(() => app.webContents.executeJavaScript('dispatch("skipTo", 2)'))
|
||||
@@ -45,7 +45,6 @@ test('audio-streaming', function (t) {
|
||||
// Back. Return to torrent list
|
||||
.then(() => app.client.click('.back'))
|
||||
.then(() => app.client.waitUntilTextExists('.torrent-list', 'Big Buck Bunny'))
|
||||
.then(() => app.client.waitUntilTextExists('.torrent-list', 'Seeding', 60e3))
|
||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired-list'))
|
||||
// Forward. Should play again where we left off (should not stay paused)
|
||||
.then(() => app.client.click('.forward'))
|
||||
|
||||
@@ -11,6 +11,8 @@ test('torrent-list: show download path missing', function (t) {
|
||||
t.timeoutAfter(20e3)
|
||||
const app = setup.createApp()
|
||||
setup.waitForLoad(app, t)
|
||||
.then(() => app.client.getTitle())
|
||||
.then((text) => console.log('Title ' + text))
|
||||
.then(() => app.client.waitUntilTextExists('.torrent-list', 'Download path missing'))
|
||||
.then((err) => t.notOk(err))
|
||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'torrent-list-download-path-missing'))
|
||||
@@ -42,7 +44,7 @@ test('torrent-list: start, stop, and delete torrents', function (t) {
|
||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'torrent-list-delete-prompt'))
|
||||
// Click cancel on the resulting confirmation dialog. Should be same as before.
|
||||
.then(() => app.client.click('.control.cancel'))
|
||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'torrent-list-2'))
|
||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'torrent-list'))
|
||||
// Click delete on the first torrent again
|
||||
.then(() => app.client.click('.icon.delete'))
|
||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'torrent-list-delete-prompt'))
|
||||
@@ -70,20 +72,19 @@ test('torrent-list: expand torrent, unselect file', function (t) {
|
||||
.then(() => app.client.waitUntilTextExists('.torrent-list', '0%'))
|
||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'torrent-list-cosmos-expand-start'))
|
||||
// Make sure that it creates all files EXCEPT the deslected one
|
||||
// TODO: Disabled test because it stopped working
|
||||
// .then(() => setup.compareDownloadFolder(t, 'CosmosLaundromatFirstCycle', [
|
||||
// // TODO: the .gif should NOT be here, since we just deselected it.
|
||||
// // This is a bug. See https://github.com/webtorrent/webtorrent-desktop/issues/719
|
||||
// 'Cosmos Laundromat - First Cycle (1080p).gif',
|
||||
// 'Cosmos Laundromat - First Cycle (1080p).mp4',
|
||||
// 'Cosmos Laundromat - First Cycle (1080p).ogv',
|
||||
// 'CosmosLaundromat-FirstCycle1080p.en.srt',
|
||||
// 'CosmosLaundromat-FirstCycle1080p.es.srt',
|
||||
// 'CosmosLaundromat-FirstCycle1080p.fr.srt',
|
||||
// 'CosmosLaundromat-FirstCycle1080p.it.srt',
|
||||
// 'CosmosLaundromatFirstCycle_meta.sqlite',
|
||||
// 'CosmosLaundromatFirstCycle_meta.xml'
|
||||
// ]))
|
||||
.then(() => setup.compareDownloadFolder(t, 'CosmosLaundromatFirstCycle', [
|
||||
// TODO: the .gif should NOT be here, since we just deselected it.
|
||||
// This is a bug. See https://github.com/webtorrent/webtorrent-desktop/issues/719
|
||||
'Cosmos Laundromat - First Cycle (1080p).gif',
|
||||
'Cosmos Laundromat - First Cycle (1080p).mp4',
|
||||
'Cosmos Laundromat - First Cycle (1080p).ogv',
|
||||
'CosmosLaundromat-FirstCycle1080p.en.srt',
|
||||
'CosmosLaundromat-FirstCycle1080p.es.srt',
|
||||
'CosmosLaundromat-FirstCycle1080p.fr.srt',
|
||||
'CosmosLaundromat-FirstCycle1080p.it.srt',
|
||||
'CosmosLaundromatFirstCycle_meta.sqlite',
|
||||
'CosmosLaundromatFirstCycle_meta.xml'
|
||||
]))
|
||||
// Delete torrent plus data
|
||||
// Spectron doesn't have proper support for menu clicks yet...
|
||||
.then(() => app.webContents.executeJavaScript(
|
||||
@@ -93,8 +94,7 @@ test('torrent-list: expand torrent, unselect file', function (t) {
|
||||
.then(() => app.client.click('.control.ok'))
|
||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'torrent-list-cosmos-deleted'))
|
||||
// Make sure that all the files are gone
|
||||
// TODO: Disabled test because it stopped working
|
||||
// .then(() => setup.compareDownloadFolder(t, 'CosmosLaundromatFirstCycle', null))
|
||||
.then(() => setup.compareDownloadFolder(t, 'CosmosLaundromatFirstCycle', null))
|
||||
.then(() => setup.endTest(app, t),
|
||||
(err) => setup.endTest(app, t, err || 'error'))
|
||||
})
|
||||
|
||||