Merge branch 'master' into update_spectron

This commit is contained in:
Feross Aboukhadijeh
2019-09-05 21:54:05 -07:00
committed by GitHub
5 changed files with 686 additions and 797 deletions

2
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,2 @@
github: feross
custom: https://paypal.me/borewit

View File

@@ -119,7 +119,7 @@ const darwin = {
// Build for Mac // Build for Mac
platform: 'darwin', platform: 'darwin',
// Build x64 binaries only. // Build x64 binary only.
arch: 'x64', arch: 'x64',
// The bundle identifier to use in the application's plist (Mac only). // The bundle identifier to use in the application's plist (Mac only).
@@ -140,8 +140,8 @@ const win32 = {
// Build for Windows. // Build for Windows.
platform: 'win32', platform: 'win32',
// Build ia32 and x64 binaries. // Build x64 binary only.
arch: ['ia32', 'x64'], arch: 'x64',
// Object hash of application metadata to embed into the executable (Windows only) // Object hash of application metadata to embed into the executable (Windows only)
win32metadata: { win32metadata: {
@@ -174,8 +174,8 @@ const linux = {
// Build for Linux. // Build for Linux.
platform: 'linux', platform: 'linux',
// Build ia32 and x64 binaries. // Build x64 binary onle.
arch: ['ia32', 'x64'] arch: 'x64'
// Note: Application icon for Linux is specified via the BrowserWindow `icon` option. // Note: Application icon for Linux is specified via the BrowserWindow `icon` option.
} }
@@ -396,21 +396,17 @@ function buildWin32 (cb) {
const tasks = [] const tasks = []
buildPath.forEach(function (filesPath) { buildPath.forEach(function (filesPath) {
const destArch = filesPath.split('-').pop()
if (argv.package === 'exe' || argv.package === 'all') { if (argv.package === 'exe' || argv.package === 'all') {
tasks.push((cb) => packageInstaller(filesPath, destArch, cb)) tasks.push((cb) => packageInstaller(filesPath, cb))
} }
if (argv.package === 'portable' || argv.package === 'all') { if (argv.package === 'portable' || argv.package === 'all') {
tasks.push((cb) => packagePortable(filesPath, destArch, cb)) tasks.push((cb) => packagePortable(filesPath, cb))
} }
}) })
series(tasks, cb) series(tasks, cb)
function packageInstaller (filesPath, destArch, cb) { function packageInstaller (filesPath, cb) {
console.log(`Windows: Creating ${destArch} installer...`) console.log(`Windows: Creating installer...`)
const archStr = destArch === 'ia32' ? '-ia32' : ''
installer.createWindowsInstaller({ installer.createWindowsInstaller({
appDirectory: filesPath, appDirectory: filesPath,
@@ -423,26 +419,17 @@ function buildWin32 (cb) {
noMsi: true, noMsi: true,
outputDirectory: DIST_PATH, outputDirectory: DIST_PATH,
productName: config.APP_NAME, productName: config.APP_NAME,
/**
* Only create delta updates for the Windows x64 build because 90% of our
* users have Windows x64 and the delta files take a *very* long time to
* generate. Also, the ia32 files on GitHub have non-standard Squirrel
* names (i.e. RELEASES-ia32 instead of RELEASES) and so Squirrel won't
* find them unless we proxy the requests.
*/
// TODO: Re-enable Windows 64-bit delta updates when we confirm that they // TODO: Re-enable Windows 64-bit delta updates when we confirm that they
// work correctly in the presence of the "ia32" .nupkg files. I // work correctly in the presence of the "ia32" .nupkg files. I
// (feross) noticed them listed in the 64-bit RELEASES file and // (feross) noticed them listed in the 64-bit RELEASES file and
// manually edited them out for the v0.17 release. Shipping only // manually edited them out for the v0.17 release. Shipping only
// full updates for now will work fine, with no ill-effects. // full updates for now will work fine, with no ill-effects.
// remoteReleases: destArch === 'x64' // remoteReleases: config.GITHUB_URL,
// ? config.GITHUB_URL
// : undefined,
/** /**
* If you hit a "GitHub API rate limit exceeded" error, set this token! * If you hit a "GitHub API rate limit exceeded" error, set this token!
*/ */
// remoteToken: process.env.WEBTORRENT_GITHUB_API_TOKEN, // remoteToken: process.env.WEBTORRENT_GITHUB_API_TOKEN,
setupExe: config.APP_NAME + 'Setup-v' + config.APP_VERSION + archStr + '.exe', setupExe: config.APP_NAME + 'Setup-v' + config.APP_VERSION + '.exe',
setupIcon: config.APP_ICON + '.ico', setupIcon: config.APP_ICON + '.ico',
signWithParams: signWithParams, signWithParams: signWithParams,
title: config.APP_NAME, title: config.APP_NAME,
@@ -450,7 +437,7 @@ function buildWin32 (cb) {
version: pkg.version version: pkg.version
}) })
.then(function () { .then(function () {
console.log(`Windows: Created ${destArch} installer.`) console.log(`Windows: Created installer.`)
/** /**
* Delete extraneous Squirrel files (i.e. *.nupkg delta files for older * Delete extraneous Squirrel files (i.e. *.nupkg delta files for older
@@ -462,42 +449,13 @@ function buildWin32 (cb) {
fs.unlinkSync(path.join(DIST_PATH, filename)) fs.unlinkSync(path.join(DIST_PATH, filename))
}) })
if (destArch === 'ia32') {
console.log('Windows: Renaming ia32 installer files...')
// RELEASES -> RELEASES-ia32
const relPath = path.join(DIST_PATH, 'RELEASES-ia32')
fs.renameSync(
path.join(DIST_PATH, 'RELEASES'),
relPath
)
// WebTorrent-vX.X.X-full.nupkg -> WebTorrent-vX.X.X-ia32-full.nupkg
fs.renameSync(
path.join(DIST_PATH, `${config.APP_NAME}-${config.APP_VERSION}-full.nupkg`),
path.join(DIST_PATH, `${config.APP_NAME}-${config.APP_VERSION}-ia32-full.nupkg`)
)
// Change file name inside RELEASES-ia32 to match renamed file
const relContent = fs.readFileSync(relPath, 'utf8')
const relContent32 = relContent.replace('full.nupkg', 'ia32-full.nupkg')
fs.writeFileSync(relPath, relContent32)
if (relContent === relContent32) {
// Sanity check
throw new Error('Fixing RELEASES-ia32 failed. Replacement did not modify the file.')
}
console.log('Windows: Renamed ia32 installer files.')
}
cb(null) cb(null)
}) })
.catch(cb) .catch(cb)
} }
function packagePortable (filesPath, destArch, cb) { function packagePortable (filesPath, cb) {
console.log(`Windows: Creating ${destArch} portable app...`) console.log(`Windows: Creating portable app...`)
const portablePath = path.join(filesPath, 'Portable Settings') const portablePath = path.join(filesPath, 'Portable Settings')
mkdirp.sync(portablePath) mkdirp.sync(portablePath)
@@ -508,13 +466,11 @@ function buildWin32 (cb) {
const tempPath = path.join(portablePath, 'Temp') const tempPath = path.join(portablePath, 'Temp')
mkdirp.sync(tempPath) mkdirp.sync(tempPath)
const archStr = destArch === 'ia32' ? '-ia32' : ''
const inPath = path.join(DIST_PATH, path.basename(filesPath)) const inPath = path.join(DIST_PATH, path.basename(filesPath))
const outPath = path.join(DIST_PATH, BUILD_NAME + '-win' + archStr + '.zip') const outPath = path.join(DIST_PATH, BUILD_NAME + '-win.zip')
zip.zipSync(inPath, outPath) zip.zipSync(inPath, outPath)
console.log(`Windows: Created ${destArch} portable app.`) console.log(`Windows: Created portable app.`)
cb(null) cb(null)
} }
}) })
@@ -528,21 +484,19 @@ function buildLinux (cb) {
const tasks = [] const tasks = []
buildPath.forEach(function (filesPath) { buildPath.forEach(function (filesPath) {
const destArch = filesPath.split('-').pop()
if (argv.package === 'deb' || argv.package === 'all') { if (argv.package === 'deb' || argv.package === 'all') {
tasks.push((cb) => packageDeb(filesPath, destArch, cb)) tasks.push((cb) => packageDeb(filesPath, cb))
} }
if (argv.package === 'zip' || argv.package === 'all') { if (argv.package === 'zip' || argv.package === 'all') {
tasks.push((cb) => packageZip(filesPath, destArch, cb)) tasks.push((cb) => packageZip(filesPath, cb))
} }
}) })
series(tasks, cb) series(tasks, cb)
}) })
function packageDeb (filesPath, destArch, cb) { function packageDeb (filesPath, cb) {
// Create .deb file for Debian-based platforms // Create .deb file for Debian-based platforms
console.log(`Linux: Creating ${destArch} deb...`) console.log(`Linux: Creating deb...`)
const deb = require('nobin-debian-installer')() const deb = require('nobin-debian-installer')()
const destPath = path.join('/opt', pkg.name) const destPath = path.join('/opt', pkg.name)
@@ -550,7 +504,7 @@ function buildLinux (cb) {
deb.pack({ deb.pack({
package: pkg, package: pkg,
info: { info: {
arch: destArch === 'x64' ? 'amd64' : 'i386', arch: 'amd64',
targetDir: DIST_PATH, targetDir: DIST_PATH,
depends: 'gconf2, libgtk2.0-0, libnss3, libxss1', depends: 'gconf2, libgtk2.0-0, libnss3, libxss1',
scripts: { scripts: {
@@ -570,22 +524,20 @@ function buildLinux (cb) {
cwd: path.join(config.STATIC_PATH, 'linux', 'share') cwd: path.join(config.STATIC_PATH, 'linux', 'share')
}], function (err) { }], function (err) {
if (err) return cb(err) if (err) return cb(err)
console.log(`Linux: Created ${destArch} deb.`) console.log(`Linux: Created deb.`)
cb(null) cb(null)
}) })
} }
function packageZip (filesPath, destArch, cb) { function packageZip (filesPath, cb) {
// Create .zip file for Linux // Create .zip file for Linux
console.log(`Linux: Creating ${destArch} zip...`) console.log(`Linux: Creating zip...`)
const archStr = destArch === 'ia32' ? '-ia32' : ''
const inPath = path.join(DIST_PATH, path.basename(filesPath)) const inPath = path.join(DIST_PATH, path.basename(filesPath))
const outPath = path.join(DIST_PATH, BUILD_NAME + '-linux' + archStr + '.zip') const outPath = path.join(DIST_PATH, BUILD_NAME + '-linux.zip')
zip.zipSync(inPath, outPath) zip.zipSync(inPath, outPath)
console.log(`Linux: Created ${destArch} zip.`) console.log(`Linux: Created zip.`)
cb(null) cb(null)
} }
} }

1301
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -12,64 +12,63 @@
}, },
"dependencies": { "dependencies": {
"airplayer": "^2.0.0", "airplayer": "^2.0.0",
"application-config": "^1.0.0", "application-config": "^1.0.1",
"arch": "^2.0.0", "arch": "^2.1.1",
"auto-launch": "^5.0.5", "auto-launch": "^5.0.5",
"bitfield": "^1.0.2", "bitfield": "^3.0.0",
"capture-frame": "^3.0.0", "capture-frame": "^3.0.0",
"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.0.0", "create-torrent": "^4.3.1",
"debounce": "^1.0.0", "debounce": "^1.2.0",
"deep-equal": "^1.0.1", "deep-equal": "^1.1.0",
"dlnacasts": "^0.1.0", "dlnacasts": "^0.1.0",
"drag-drop": "^4.1.0", "drag-drop": "^5.0.1",
"es6-error": "^4.0.0", "es6-error": "^4.1.1",
"fn-getter": "^1.0.0", "fn-getter": "^1.0.0",
"iso-639-1": "^2.0.5", "iso-639-1": "^2.1.0",
"languagedetect": "^1.2.0", "languagedetect": "^1.2.0",
"location-history": "^1.0.0", "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.3.0", "music-metadata": "^4.5.0",
"network-address": "^1.1.0", "network-address": "^1.1.2",
"parse-torrent": "^7.0.0", "parse-torrent": "^7.0.1",
"prettier-bytes": "^1.0.1", "prettier-bytes": "^1.0.4",
"prop-types": "^15.6.2", "prop-types": "^15.7.2",
"react": "^16.5.2", "react": "^16.9.0",
"react-dom": "^16.5.2", "react-dom": "^16.9.0",
"rimraf": "^3.0.0", "rimraf": "^3.0.0",
"run-parallel": "^1.1.6", "run-parallel": "^1.1.9",
"semver": "^6.0.0", "semver": "^6.3.0",
"simple-concat": "^1.0.0", "simple-concat": "^1.0.0",
"simple-get": "^3.0.3", "simple-get": "^3.0.3",
"srt-to-vtt": "^1.1.1", "srt-to-vtt": "^1.1.3",
"vlc-command": "^1.0.1", "vlc-command": "^1.2.0",
"webtorrent": "0.x", "webtorrent": ">=0.107.7",
"winreg": "^1.2.0", "winreg": "^1.2.4"
"zero-fill": "^2.2.3"
}, },
"devDependencies": { "devDependencies": {
"babel-eslint": "^10.0.2", "babel-eslint": "^10.0.3",
"buble": "^0.19.6", "buble": "^0.19.8",
"cross-zip": "^2.0.1", "cross-zip": "^2.1.6",
"depcheck": "^0.8.0", "depcheck": "^0.8.3",
"electron": "~6.0.1", "electron": "~6.0.7",
"electron-osx-sign": "^0.4.11", "electron-osx-sign": "^0.4.12",
"electron-packager": "^14.0.4", "electron-packager": "^14.0.5",
"electron-winstaller": "^2.6.4", "electron-winstaller": "^4.0.0",
"gh-release": "^3.4.0", "gh-release": "^3.5.0",
"minimist": "^1.2.0", "minimist": "^1.2.0",
"nobin-debian-installer": "0.0.10", "nobin-debian-installer": "0.0.10",
"nodemon": "^1.18.8", "nodemon": "^1.19.2",
"opn": "^6.0.0", "opn": "^6.0.0",
"plist": "^3.0.1", "plist": "^3.0.1",
"pngjs": "^3.0.0", "pngjs": "^3.4.0",
"run-series": "^1.1.4", "run-series": "^1.1.8",
"spectron": "^8.0.0", "spectron": "^8.0.0",
"standard": "*", "standard": "*",
"tape": "^4.9.1", "tape": "^4.11.0",
"walk-sync": "^2.0.2" "walk-sync": "^2.0.2"
}, },
"engines": { "engines": {

View File

@@ -3,7 +3,6 @@
const React = require('react') const React = require('react')
const Bitfield = require('bitfield') const Bitfield = require('bitfield')
const prettyBytes = require('prettier-bytes') const prettyBytes = require('prettier-bytes')
const zeroFill = require('zero-fill')
const TorrentSummary = require('../lib/torrent-summary') const TorrentSummary = require('../lib/torrent-summary')
const Playlist = require('../lib/playlist') const Playlist = require('../lib/playlist')
@@ -762,10 +761,10 @@ function formatTime (time, total) {
const totalMinutes = Math.floor(total / 60) const totalMinutes = Math.floor(total / 60)
const hours = Math.floor(time / 3600) const hours = Math.floor(time / 3600)
let minutes = Math.floor(time % 3600 / 60) let minutes = Math.floor(time % 3600 / 60)
if (totalMinutes > 9) { if (totalMinutes > 9 && minutes < 10) {
minutes = zeroFill(2, minutes) minutes = '0' + minutes
} }
const seconds = zeroFill(2, Math.floor(time % 60)) const seconds = `0${Math.floor(time % 60)}`.slice(-2)
return (totalHours > 0 ? hours + ':' : '') + minutes + ':' + seconds return (totalHours > 0 ? hours + ':' : '') + minutes + ':' + seconds
} }