Compare commits
30 Commits
fix-startu
...
feross-tes
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aec43c73f2 | ||
|
|
3baa74d3f9 | ||
|
|
9b91b8c76a | ||
|
|
54b1832007 | ||
|
|
e714e00223 | ||
|
|
6989484e7c | ||
|
|
53164a058d | ||
|
|
f84078c865 | ||
|
|
7eda218e82 | ||
|
|
54b0c23f11 | ||
|
|
b34417b1fc | ||
|
|
40005351b5 | ||
|
|
6255ccd253 | ||
|
|
4a10a2dfd1 | ||
|
|
992ab0bf10 | ||
|
|
83a2d090ff | ||
|
|
8133ce7b92 | ||
|
|
6a07f705f7 | ||
|
|
9455912d98 | ||
|
|
052e0a4a31 | ||
|
|
b8b1ddc138 | ||
|
|
a92fee3532 | ||
|
|
aff402f6e0 | ||
|
|
a39691fdad | ||
|
|
7eecf709f9 | ||
|
|
dd13de5f65 | ||
|
|
647eaf5af9 | ||
|
|
24394a9028 | ||
|
|
28bf22a710 | ||
|
|
d631ed1cc7 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -2,3 +2,7 @@ node_modules/
|
|||||||
build/
|
build/
|
||||||
dist/
|
dist/
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
|
|
||||||
|
# JetBrains IntelliJ IDEA project files
|
||||||
|
.idea
|
||||||
|
*.iml
|
||||||
|
|||||||
@@ -158,6 +158,11 @@ The Mac app can only be packaged from **macOS**.
|
|||||||
|
|
||||||
The Linux app can be packaged from **any** platform.
|
The Linux app can be packaged from **any** platform.
|
||||||
|
|
||||||
|
If packaging from Mac, install system dependencies with Homebrew by running:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run install-system-deps
|
||||||
|
```
|
||||||
|
|
||||||
#### Recommended readings to start working in the app
|
#### Recommended readings to start working in the app
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
const { CONFIG_PATH } = require('../src/config')
|
const { CONFIG_PATH } = require('../src/config')
|
||||||
const opn = require('opn')
|
const open = require('open')
|
||||||
|
|
||||||
opn(CONFIG_PATH)
|
open(CONFIG_PATH)
|
||||||
|
|||||||
@@ -501,35 +501,29 @@ function buildLinux (cb) {
|
|||||||
// Create .deb file for Debian-based platforms
|
// Create .deb file for Debian-based platforms
|
||||||
console.log('Linux: Creating deb...')
|
console.log('Linux: Creating deb...')
|
||||||
|
|
||||||
const deb = require('nobin-debian-installer')()
|
const installer = require('electron-installer-debian')
|
||||||
const destPath = path.join('/opt', pkg.name)
|
|
||||||
|
|
||||||
deb.pack({
|
const options = {
|
||||||
package: pkg,
|
src: filesPath + '/',
|
||||||
info: {
|
dest: DIST_PATH,
|
||||||
arch: 'amd64',
|
arch: 'amd64',
|
||||||
targetDir: DIST_PATH,
|
bin: 'WebTorrent',
|
||||||
depends: 'gconf2, libgtk2.0-0, libnss3, libxss1',
|
icon: {
|
||||||
scripts: {
|
'48x48': path.join(config.STATIC_PATH, 'linux/share/icons/hicolor/48x48/apps/webtorrent-desktop.png'),
|
||||||
postinst: path.join(config.STATIC_PATH, 'linux', 'postinst'),
|
'256x256': path.join(config.STATIC_PATH, 'linux/share/icons/hicolor/256x256/apps/webtorrent-desktop.png')
|
||||||
prerm: path.join(config.STATIC_PATH, 'linux', 'prerm')
|
},
|
||||||
}
|
categories: ['Network', 'FileTransfer', 'P2P'],
|
||||||
}
|
mimeType: ['application/x-bittorrent', 'x-scheme-handler/magnet', 'x-scheme-handler/stream-magnet'],
|
||||||
}, [{
|
desktopTemplate: path.join(config.STATIC_PATH, 'linux/webtorrent-desktop.ejs')
|
||||||
src: ['./**'],
|
}
|
||||||
dest: destPath,
|
|
||||||
expand: true,
|
installer(options).then(
|
||||||
cwd: filesPath
|
() => {
|
||||||
}, {
|
console.log('Linux: Created deb.')
|
||||||
src: ['./**'],
|
cb(null)
|
||||||
dest: path.join('/usr', 'share'),
|
},
|
||||||
expand: true,
|
(err) => cb(err)
|
||||||
cwd: path.join(config.STATIC_PATH, 'linux', 'share')
|
)
|
||||||
}], function (err) {
|
|
||||||
if (err) return cb(err)
|
|
||||||
console.log('Linux: Created deb.')
|
|
||||||
cb(null)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function packageZip (filesPath, cb) {
|
function packageZip (filesPath, cb) {
|
||||||
|
|||||||
1449
package-lock.json
generated
1449
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
22
package.json
22
package.json
@@ -11,7 +11,7 @@
|
|||||||
"url": "https://github.com/webtorrent/webtorrent-desktop/issues"
|
"url": "https://github.com/webtorrent/webtorrent-desktop/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"airplayer": "^2.0.0",
|
"airplayer": "github:webtorrent/airplayer#fix-security",
|
||||||
"application-config": "^1.0.1",
|
"application-config": "^1.0.1",
|
||||||
"arch": "^2.1.1",
|
"arch": "^2.1.1",
|
||||||
"auto-launch": "^5.0.5",
|
"auto-launch": "^5.0.5",
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
"chokidar": "^3.0.2",
|
"chokidar": "^3.0.2",
|
||||||
"chromecasts": "^1.9.1",
|
"chromecasts": "^1.9.1",
|
||||||
"cp-file": "^7.0.0",
|
"cp-file": "^7.0.0",
|
||||||
"create-torrent": "^4.3.1",
|
"create-torrent": "^4.4.1",
|
||||||
"debounce": "^1.2.0",
|
"debounce": "^1.2.0",
|
||||||
"deep-equal": "^1.1.0",
|
"deep-equal": "^1.1.0",
|
||||||
"dlnacasts": "^0.1.0",
|
"dlnacasts": "^0.1.0",
|
||||||
@@ -32,9 +32,8 @@
|
|||||||
"location-history": "^1.1.1",
|
"location-history": "^1.1.1",
|
||||||
"material-ui": "^0.20.2",
|
"material-ui": "^0.20.2",
|
||||||
"mkdirp": "^0.5.1",
|
"mkdirp": "^0.5.1",
|
||||||
"music-metadata": "^4.5.0",
|
"music-metadata": "^4.5.3",
|
||||||
"network-address": "^1.1.2",
|
"network-address": "^1.1.2",
|
||||||
"nobin-debian-installer": "github:webtorrent/nobin-debian-installer",
|
|
||||||
"parse-torrent": "^7.0.1",
|
"parse-torrent": "^7.0.1",
|
||||||
"prettier-bytes": "^1.0.4",
|
"prettier-bytes": "^1.0.4",
|
||||||
"prop-types": "^15.7.2",
|
"prop-types": "^15.7.2",
|
||||||
@@ -47,7 +46,7 @@
|
|||||||
"simple-get": "^3.0.3",
|
"simple-get": "^3.0.3",
|
||||||
"srt-to-vtt": "^1.1.3",
|
"srt-to-vtt": "^1.1.3",
|
||||||
"vlc-command": "^1.2.0",
|
"vlc-command": "^1.2.0",
|
||||||
"webtorrent": ">=0.107.7",
|
"webtorrent": ">=0.107.16",
|
||||||
"winreg": "^1.2.4"
|
"winreg": "^1.2.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -55,14 +54,14 @@
|
|||||||
"buble": "^0.19.8",
|
"buble": "^0.19.8",
|
||||||
"cross-zip": "^2.1.6",
|
"cross-zip": "^2.1.6",
|
||||||
"depcheck": "^0.8.3",
|
"depcheck": "^0.8.3",
|
||||||
"electron": "~6.0.7",
|
"electron": "~6.0.9",
|
||||||
"electron-osx-sign": "^0.4.12",
|
"electron-osx-sign": "^0.4.13",
|
||||||
"electron-packager": "^14.0.5",
|
"electron-packager": "^14.0.6",
|
||||||
"electron-winstaller": "^4.0.0",
|
"electron-winstaller": "^4.0.0",
|
||||||
"gh-release": "^3.5.0",
|
"gh-release": "^3.5.0",
|
||||||
"minimist": "^1.2.0",
|
"minimist": "^1.2.0",
|
||||||
"nodemon": "^1.19.2",
|
"nodemon": "^1.19.2",
|
||||||
"opn": "^6.0.0",
|
"open": "^6.4.0",
|
||||||
"plist": "^3.0.1",
|
"plist": "^3.0.1",
|
||||||
"pngjs": "^3.4.0",
|
"pngjs": "^3.4.0",
|
||||||
"run-series": "^1.1.8",
|
"run-series": "^1.1.8",
|
||||||
@@ -88,7 +87,8 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"appdmg": "^0.6.0"
|
"appdmg": "^0.6.0",
|
||||||
|
"electron-installer-debian": "^2.0.0"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"productName": "WebTorrent",
|
"productName": "WebTorrent",
|
||||||
@@ -100,9 +100,9 @@
|
|||||||
"build": "buble src --output build",
|
"build": "buble src --output build",
|
||||||
"clean": "node ./bin/clean.js",
|
"clean": "node ./bin/clean.js",
|
||||||
"gh-release": "gh-release",
|
"gh-release": "gh-release",
|
||||||
|
"install-system-deps": "brew install fakeroot dpkg",
|
||||||
"open-config": "node ./bin/open-config.js",
|
"open-config": "node ./bin/open-config.js",
|
||||||
"package": "node ./bin/package.js",
|
"package": "node ./bin/package.js",
|
||||||
"prepublish": "npm run build",
|
|
||||||
"start": "npm run build && electron .",
|
"start": "npm run build && electron .",
|
||||||
"test": "standard && depcheck --ignores=standard,babel-eslint --ignore-dirs=build,dist && node ./bin/extra-lint.js",
|
"test": "standard && depcheck --ignores=standard,babel-eslint --ignore-dirs=build,dist && node ./bin/extra-lint.js",
|
||||||
"test-integration": "npm run build && node ./test",
|
"test-integration": "npm run build && node ./test",
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
const appConfig = require('application-config')('WebTorrent')
|
const appConfig = require('application-config')('WebTorrent')
|
||||||
|
appConfig.filePath = appConfig.filePath.replace('\\Local\\', '\\Roaming\\')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
const arch = require('arch')
|
const arch = require('arch')
|
||||||
|
|
||||||
|
// console.log('electron appData: ', (electron.remote ? electron.remote : electron).app.getPath('appData'))
|
||||||
|
console.log('appConfig.filePath', appConfig.filePath)
|
||||||
|
|
||||||
const APP_NAME = 'WebTorrent'
|
const APP_NAME = 'WebTorrent'
|
||||||
const APP_TEAM = 'WebTorrent, LLC'
|
const APP_TEAM = 'WebTorrent, LLC'
|
||||||
const APP_VERSION = require('../package.json').version
|
const APP_VERSION = require('../package.json').version
|
||||||
@@ -34,12 +38,12 @@ module.exports = {
|
|||||||
CONFIG_PATH: getConfigPath(),
|
CONFIG_PATH: getConfigPath(),
|
||||||
|
|
||||||
DEFAULT_TORRENTS: [
|
DEFAULT_TORRENTS: [
|
||||||
{
|
// {
|
||||||
testID: 'bbb',
|
// testID: 'bbb',
|
||||||
name: 'Big Buck Bunny',
|
// name: 'Big Buck Bunny',
|
||||||
posterFileName: 'bigBuckBunny.jpg',
|
// posterFileName: 'bigBuckBunny.jpg',
|
||||||
torrentFileName: 'bigBuckBunny.torrent'
|
// torrentFileName: 'bigBuckBunny.torrent'
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
testID: 'cosmos',
|
testID: 'cosmos',
|
||||||
name: 'Cosmos Laundromat (Preview)',
|
name: 'Cosmos Laundromat (Preview)',
|
||||||
@@ -73,8 +77,10 @@ module.exports = {
|
|||||||
GITHUB_URL: 'https://github.com/webtorrent/webtorrent-desktop',
|
GITHUB_URL: 'https://github.com/webtorrent/webtorrent-desktop',
|
||||||
GITHUB_URL_ISSUES: 'https://github.com/webtorrent/webtorrent-desktop/issues',
|
GITHUB_URL_ISSUES: 'https://github.com/webtorrent/webtorrent-desktop/issues',
|
||||||
GITHUB_URL_RAW: 'https://raw.githubusercontent.com/webtorrent/webtorrent-desktop/master',
|
GITHUB_URL_RAW: 'https://raw.githubusercontent.com/webtorrent/webtorrent-desktop/master',
|
||||||
|
GITHUB_URL_RELEASES: 'https://github.com/webtorrent/webtorrent-desktop/releases',
|
||||||
|
|
||||||
HOME_PAGE_URL: 'https://webtorrent.io',
|
HOME_PAGE_URL: 'https://webtorrent.io',
|
||||||
|
TWITTER_PAGE_URL: 'https://twitter.com/WebTorrentApp',
|
||||||
|
|
||||||
IS_PORTABLE: IS_PORTABLE,
|
IS_PORTABLE: IS_PORTABLE,
|
||||||
IS_PRODUCTION: IS_PRODUCTION,
|
IS_PRODUCTION: IS_PRODUCTION,
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ function install () {
|
|||||||
break
|
break
|
||||||
case 'win32': installWin32()
|
case 'win32': installWin32()
|
||||||
break
|
break
|
||||||
case 'linux': installLinux()
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,8 +21,6 @@ function uninstall () {
|
|||||||
break
|
break
|
||||||
case 'win32': uninstallWin32()
|
case 'win32': uninstallWin32()
|
||||||
break
|
break
|
||||||
case 'linux': uninstallLinux()
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,100 +265,3 @@ function uninstallWin32 () {
|
|||||||
function commandToArgs (command) {
|
function commandToArgs (command) {
|
||||||
return command.map((arg) => `"${arg}"`).join(' ')
|
return command.map((arg) => `"${arg}"`).join(' ')
|
||||||
}
|
}
|
||||||
|
|
||||||
function installLinux () {
|
|
||||||
const fs = require('fs')
|
|
||||||
const os = require('os')
|
|
||||||
const path = require('path')
|
|
||||||
|
|
||||||
const config = require('../config')
|
|
||||||
const log = require('./log')
|
|
||||||
|
|
||||||
// Do not install in user dir if running on system
|
|
||||||
if (/^\/opt/.test(process.execPath)) return
|
|
||||||
|
|
||||||
installDesktopFile()
|
|
||||||
installIconFile()
|
|
||||||
|
|
||||||
function installDesktopFile () {
|
|
||||||
const templatePath = path.join(
|
|
||||||
config.STATIC_PATH, 'linux', 'webtorrent-desktop.desktop'
|
|
||||||
)
|
|
||||||
fs.readFile(templatePath, 'utf8', writeDesktopFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
function writeDesktopFile (err, desktopFile) {
|
|
||||||
if (err) return log.error(err.message)
|
|
||||||
|
|
||||||
const appPath = config.IS_PRODUCTION
|
|
||||||
? path.dirname(process.execPath)
|
|
||||||
: config.ROOT_PATH
|
|
||||||
|
|
||||||
desktopFile = desktopFile
|
|
||||||
.replace(/\$APP_NAME/g, config.APP_NAME)
|
|
||||||
.replace(/\$APP_PATH/g, appPath)
|
|
||||||
.replace(/\$EXEC_PATH/g, EXEC_COMMAND.join(' '))
|
|
||||||
.replace(/\$TRY_EXEC_PATH/g, process.execPath)
|
|
||||||
|
|
||||||
const desktopFilePath = path.join(
|
|
||||||
os.homedir(),
|
|
||||||
'.local',
|
|
||||||
'share',
|
|
||||||
'applications',
|
|
||||||
'webtorrent-desktop.desktop'
|
|
||||||
)
|
|
||||||
fs.mkdirp(path.dirname(desktopFilePath))
|
|
||||||
fs.writeFile(desktopFilePath, desktopFile, err => {
|
|
||||||
if (err) return log.error(err.message)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function installIconFile () {
|
|
||||||
const iconStaticPath = path.join(config.STATIC_PATH, 'WebTorrent.png')
|
|
||||||
fs.readFile(iconStaticPath, writeIconFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
function writeIconFile (err, iconFile) {
|
|
||||||
if (err) return log.error(err.message)
|
|
||||||
|
|
||||||
const mkdirp = require('mkdirp')
|
|
||||||
|
|
||||||
const iconFilePath = path.join(
|
|
||||||
os.homedir(),
|
|
||||||
'.local',
|
|
||||||
'share',
|
|
||||||
'icons',
|
|
||||||
'webtorrent-desktop.png'
|
|
||||||
)
|
|
||||||
mkdirp(path.dirname(iconFilePath), err => {
|
|
||||||
if (err) return log.error(err.message)
|
|
||||||
fs.writeFile(iconFilePath, iconFile, err => {
|
|
||||||
if (err) log.error(err.message)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function uninstallLinux () {
|
|
||||||
const os = require('os')
|
|
||||||
const path = require('path')
|
|
||||||
const rimraf = require('rimraf')
|
|
||||||
|
|
||||||
const desktopFilePath = path.join(
|
|
||||||
os.homedir(),
|
|
||||||
'.local',
|
|
||||||
'share',
|
|
||||||
'applications',
|
|
||||||
'webtorrent-desktop.desktop'
|
|
||||||
)
|
|
||||||
rimraf.sync(desktopFilePath)
|
|
||||||
|
|
||||||
const iconFilePath = path.join(
|
|
||||||
os.homedir(),
|
|
||||||
'.local',
|
|
||||||
'share',
|
|
||||||
'icons',
|
|
||||||
'webtorrent-desktop.png'
|
|
||||||
)
|
|
||||||
rimraf.sync(iconFilePath)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -302,6 +302,13 @@ function getMenuTemplate () {
|
|||||||
shell.openExternal(config.HOME_PAGE_URL)
|
shell.openExternal(config.HOME_PAGE_URL)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Release Notes',
|
||||||
|
click: () => {
|
||||||
|
const shell = require('./shell')
|
||||||
|
shell.openExternal(config.GITHUB_URL_RELEASES)
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'Contribute on GitHub',
|
label: 'Contribute on GitHub',
|
||||||
click: () => {
|
click: () => {
|
||||||
@@ -318,6 +325,13 @@ function getMenuTemplate () {
|
|||||||
const shell = require('./shell')
|
const shell = require('./shell')
|
||||||
shell.openExternal(config.GITHUB_URL_ISSUES)
|
shell.openExternal(config.GITHUB_URL_ISSUES)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Follow us on Twitter',
|
||||||
|
click: () => {
|
||||||
|
const shell = require('./shell')
|
||||||
|
shell.openExternal(config.TWITTER_PAGE_URL)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
const React = require('react')
|
const React = require('react')
|
||||||
const TextField = require('material-ui/TextField').default
|
const TextField = require('material-ui/TextField').default
|
||||||
|
const { clipboard } = require('electron')
|
||||||
|
|
||||||
const ModalOKCancel = require('./modal-ok-cancel')
|
const ModalOKCancel = require('./modal-ok-cancel')
|
||||||
const { dispatch, dispatcher } = require('../lib/dispatcher')
|
const { dispatch, dispatcher } = require('../lib/dispatcher')
|
||||||
|
const { isMagnetLink } = require('../lib/torrent-player')
|
||||||
|
|
||||||
module.exports = class OpenTorrentAddressModal extends React.Component {
|
module.exports = class OpenTorrentAddressModal extends React.Component {
|
||||||
render () {
|
render () {
|
||||||
@@ -30,6 +32,12 @@ module.exports = class OpenTorrentAddressModal extends React.Component {
|
|||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
this.torrentURL.input.focus()
|
this.torrentURL.input.focus()
|
||||||
|
const clipboardContent = clipboard.readText()
|
||||||
|
|
||||||
|
if (isMagnetLink(clipboardContent)) {
|
||||||
|
this.torrentURL.input.value = clipboardContent
|
||||||
|
this.torrentURL.input.select()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ module.exports = class TorrentController {
|
|||||||
this.state = state
|
this.state = state
|
||||||
}
|
}
|
||||||
|
|
||||||
torrentInfoHash (torrentKey, infoHash) {
|
torrentParsed (torrentKey, infoHash, magnetURI) {
|
||||||
let torrentSummary = this.getTorrentSummary(torrentKey)
|
let torrentSummary = this.getTorrentSummary(torrentKey)
|
||||||
console.log('got infohash for %s torrent %s',
|
console.log('got infohash for %s torrent %s',
|
||||||
torrentSummary ? 'existing' : 'new', torrentKey)
|
torrentSummary ? 'existing' : 'new', torrentKey)
|
||||||
@@ -33,6 +33,7 @@ module.exports = class TorrentController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
torrentSummary.infoHash = infoHash
|
torrentSummary.infoHash = infoHash
|
||||||
|
torrentSummary.magnetURI = magnetURI
|
||||||
dispatch('update')
|
dispatch('update')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +63,6 @@ module.exports = class TorrentController {
|
|||||||
torrentSummary.status = 'downloading'
|
torrentSummary.status = 'downloading'
|
||||||
torrentSummary.name = torrentSummary.displayName || torrentInfo.name
|
torrentSummary.name = torrentSummary.displayName || torrentInfo.name
|
||||||
torrentSummary.path = torrentInfo.path
|
torrentSummary.path = torrentInfo.path
|
||||||
torrentSummary.magnetURI = torrentInfo.magnetURI
|
|
||||||
// TODO: make torrentInfo immutable, save separately as torrentSummary.info
|
// TODO: make torrentInfo immutable, save separately as torrentSummary.info
|
||||||
// For now, check whether torrentSummary.files has already been set:
|
// For now, check whether torrentSummary.files has already been set:
|
||||||
const hasDetailedFileInfo = torrentSummary.files && torrentSummary.files[0].path
|
const hasDetailedFileInfo = torrentSummary.files && torrentSummary.files[0].path
|
||||||
|
|||||||
@@ -151,8 +151,10 @@ function setupStateSaved (cb) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
Promise.all(tasks)
|
Promise.all(tasks)
|
||||||
.then(() => cb(null, saved))
|
.then(
|
||||||
.catch(err => cb(err))
|
() => cb(null, saved),
|
||||||
|
err => cb(err)
|
||||||
|
)
|
||||||
|
|
||||||
function createTorrentObject (t) {
|
function createTorrentObject (t) {
|
||||||
// TODO: Doing several fs.readFileSync calls during first startup is not ideal
|
// TODO: Doing several fs.readFileSync calls during first startup is not ideal
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ module.exports = {
|
|||||||
isVideo,
|
isVideo,
|
||||||
isAudio,
|
isAudio,
|
||||||
isTorrent,
|
isTorrent,
|
||||||
|
isMagnetLink,
|
||||||
isPlayableTorrentSummary
|
isPlayableTorrentSummary
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,9 +32,15 @@ function isAudio (file) {
|
|||||||
// - a file object where obj.name is ends in .torrent
|
// - a file object where obj.name is ends in .torrent
|
||||||
// - a string that's a magnet link (magnet://...)
|
// - a string that's a magnet link (magnet://...)
|
||||||
function isTorrent (file) {
|
function isTorrent (file) {
|
||||||
const isTorrentFile = getFileExtension(file) === '.torrent'
|
return isTorrentFile(file) || isMagnetLink(file)
|
||||||
const isMagnet = typeof file === 'string' && /^(stream-)?magnet:/.test(file)
|
}
|
||||||
return isTorrentFile || isMagnet
|
|
||||||
|
function isTorrentFile (file) {
|
||||||
|
return getFileExtension(file) === '.torrent'
|
||||||
|
}
|
||||||
|
|
||||||
|
function isMagnetLink (link) {
|
||||||
|
return typeof link === 'string' && /^(stream-)?magnet:/.test(link)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFileExtension (file) {
|
function getFileExtension (file) {
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ function setupIpc () {
|
|||||||
ipcRenderer.on('windowBoundsChanged', onWindowBoundsChanged)
|
ipcRenderer.on('windowBoundsChanged', onWindowBoundsChanged)
|
||||||
|
|
||||||
const tc = controllers.torrent()
|
const tc = controllers.torrent()
|
||||||
ipcRenderer.on('wt-infohash', (e, ...args) => tc.torrentInfoHash(...args))
|
ipcRenderer.on('wt-parsed', (e, ...args) => tc.torrentParsed(...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-done', () => controllers.torrentList().resumePausedTorrents())
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ function addTorrentEvents (torrent) {
|
|||||||
torrent.on('error', (err) =>
|
torrent.on('error', (err) =>
|
||||||
ipc.send('wt-error', torrent.key, err.message))
|
ipc.send('wt-error', torrent.key, err.message))
|
||||||
torrent.on('infoHash', () =>
|
torrent.on('infoHash', () =>
|
||||||
ipc.send('wt-infohash', torrent.key, torrent.infoHash))
|
ipc.send('wt-parsed', torrent.key, torrent.infoHash, torrent.magnetURI))
|
||||||
torrent.on('metadata', torrentMetadata)
|
torrent.on('metadata', torrentMetadata)
|
||||||
torrent.on('ready', torrentReady)
|
torrent.on('ready', torrentReady)
|
||||||
torrent.on('done', torrentDone)
|
torrent.on('done', torrentDone)
|
||||||
@@ -358,11 +358,15 @@ function getAudioMetadata (infoHash, index) {
|
|||||||
: mm.parseStream(file.createReadStream(), file.name, options)
|
: mm.parseStream(file.createReadStream(), file.name, options)
|
||||||
|
|
||||||
onMetaData
|
onMetaData
|
||||||
.then(() => {
|
.then(
|
||||||
console.log(`metadata for file='${file.name}' completed.`)
|
() => console.log(`metadata for file='${file.name}' completed.`),
|
||||||
}).catch(function (err) {
|
err => {
|
||||||
return console.log('error getting audio metadata for ' + infoHash + ':' + index, err)
|
console.log(
|
||||||
})
|
`error getting audio metadata for ${infoHash}:${index}`,
|
||||||
|
err
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectFiles (torrentOrInfoHash, selections) {
|
function selectFiles (torrentOrInfoHash, selections) {
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
chmod +x /opt/webtorrent-desktop/WebTorrent
|
|
||||||
ln -s -f /opt/webtorrent-desktop/WebTorrent /usr/bin/webtorrent-desktop
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
rm /usr/bin/webtorrent-desktop
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Name=$APP_NAME
|
|
||||||
Version=1.0
|
|
||||||
GenericName=BitTorrent Client
|
|
||||||
X-GNOME-FullName=$APP_NAME
|
|
||||||
Comment=Download and share files over BitTorrent
|
|
||||||
Type=Application
|
|
||||||
Icon=webtorrent-desktop
|
|
||||||
Terminal=false
|
|
||||||
Path=$APP_PATH
|
|
||||||
Exec=$EXEC_PATH %U
|
|
||||||
TryExec=$TRY_EXEC_PATH
|
|
||||||
StartupNotify=false
|
|
||||||
Categories=Network;FileTransfer;P2P;
|
|
||||||
MimeType=application/x-bittorrent;x-scheme-handler/magnet;x-scheme-handler/stream-magnet;
|
|
||||||
|
|
||||||
Actions=CreateNewTorrent;OpenTorrentFile;OpenTorrentAddress;
|
|
||||||
|
|
||||||
[Desktop Action CreateNewTorrent]
|
|
||||||
Name=Create New Torrent...
|
|
||||||
Exec=$EXEC_PATH -n
|
|
||||||
|
|
||||||
[Desktop Action OpenTorrentFile]
|
|
||||||
Name=Open Torrent File...
|
|
||||||
Exec=$EXEC_PATH -o
|
|
||||||
|
|
||||||
[Desktop Action OpenTorrentAddress]
|
|
||||||
Name=Open Torrent Address...
|
|
||||||
Exec=$EXEC_PATH -u
|
|
||||||
26
static/linux/webtorrent-desktop.ejs
Normal file
26
static/linux/webtorrent-desktop.ejs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
<% if (version) { %>Version=<%= version %><% } %>
|
||||||
|
Name=<%= productName %>
|
||||||
|
<% if (genericName) { %>GenericName=<%= genericName %><% } %>
|
||||||
|
<% if (description) { %>Comment=<%= description %><% } %>
|
||||||
|
Icon=<%= name %>
|
||||||
|
<% if (name) { %>Exec=<%= name %> %U<% } %>
|
||||||
|
Terminal=false
|
||||||
|
Actions=CreateNewTorrent;OpenTorrentFile;OpenTorrentAddress;
|
||||||
|
<% if (mimeType && mimeType.length) { %>MimeType=<%= mimeType.join(';') %>;<% } %>
|
||||||
|
<% if (categories && categories.length) { %>Categories=<%= categories.join(';') %>;<% } %>
|
||||||
|
StartupNotify=true
|
||||||
|
<% if (name) { %>StartupWMClass=<%= name %> <% } %>
|
||||||
|
|
||||||
|
[Desktop Action CreateNewTorrent]
|
||||||
|
Name=Create New Torrent...
|
||||||
|
<% if (name) { %>Exec=<%= name %> -n <% } %>
|
||||||
|
|
||||||
|
[Desktop Action OpenTorrentFile]
|
||||||
|
Name=Open Torrent File...
|
||||||
|
<% if (name) { %>Exec=<%= name %> -o <% } %>
|
||||||
|
|
||||||
|
[Desktop Action OpenTorrentAddress]
|
||||||
|
Name=Open Torrent Address...
|
||||||
|
<% if (name) { %>Exec=<%= name %> -u <% } %>
|
||||||
Reference in New Issue
Block a user