Merge pull request #1590 from webtorrent/update-electron

Update to electron 4; it may not be perfect, but we have to move on
This commit is contained in:
Borewit
2019-07-30 21:44:22 +02:00
committed by GitHub
6 changed files with 3227 additions and 2335 deletions

5539
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -55,7 +55,7 @@
"buble": "^0.19.6", "buble": "^0.19.6",
"cross-zip": "^2.0.1", "cross-zip": "^2.0.1",
"depcheck": "^0.8.0", "depcheck": "^0.8.0",
"electron": "^1.8.8", "electron": "^4.0.0",
"electron-osx-sign": "^0.4.11", "electron-osx-sign": "^0.4.11",
"electron-packager": "~8.5.1", "electron-packager": "~8.5.1",
"electron-winstaller": "^2.6.4", "electron-winstaller": "^2.6.4",

View File

@@ -16,6 +16,9 @@ const windows = require('./windows')
let shouldQuit = false let shouldQuit = false
let argv = sliceArgv(process.argv) let argv = sliceArgv(process.argv)
// allow electron/chromium to play startup sounds (without user interaction)
app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required')
// Start the app without showing the main window when auto launching on login // Start the app without showing the main window when auto launching on login
// (On Windows and Linux, we get a flag. On MacOS, we get special API.) // (On Windows and Linux, we get a flag. On MacOS, we get special API.)
const hidden = argv.includes('--hidden') || const hidden = argv.includes('--hidden') ||
@@ -38,17 +41,19 @@ if (!shouldQuit && !config.IS_PORTABLE) {
// signal this instance and quit. Note: This feature creates a lock file in // signal this instance and quit. Note: This feature creates a lock file in
// %APPDATA%\Roaming\WebTorrent so we do not do it for the Portable App since // %APPDATA%\Roaming\WebTorrent so we do not do it for the Portable App since
// we want to be "silent" as well as "portable". // we want to be "silent" as well as "portable".
shouldQuit = app.makeSingleInstance(onAppOpen) if (!app.requestSingleInstanceLock()) {
if (shouldQuit) { shouldQuit = true
app.quit()
} }
} }
if (!shouldQuit) { if (shouldQuit) {
app.quit()
} else {
init() init()
} }
function init () { function init () {
app.on('second-instance', (event, commandLine, workingDirectory) => onAppOpen(commandLine))
if (config.IS_PORTABLE) { if (config.IS_PORTABLE) {
const path = require('path') const path = require('path')
// Put all user data into the "Portable Settings" folder // Put all user data into the "Portable Settings" folder

View File

@@ -40,7 +40,7 @@ function init (state, options) {
minWidth: config.WINDOW_MIN_WIDTH, minWidth: config.WINDOW_MIN_WIDTH,
show: false, show: false,
title: config.APP_WINDOW_TITLE, title: config.APP_WINDOW_TITLE,
titleBarStyle: 'hidden-inset', // Hide title bar (Mac) titleBarStyle: 'hiddenInset', // Hide title bar (Mac)
useContentSize: true, // Specify web page size without OS chrome useContentSize: true, // Specify web page size without OS chrome
width: initialBounds.width, width: initialBounds.width,
x: initialBounds.x, x: initialBounds.x,
@@ -209,7 +209,7 @@ function toggleDevTools () {
if (main.win.webContents.isDevToolsOpened()) { if (main.win.webContents.isDevToolsOpened()) {
main.win.webContents.closeDevTools() main.win.webContents.closeDevTools()
} else { } else {
main.win.webContents.openDevTools({ detach: true }) main.win.webContents.openDevTools({ mode: 'detach' })
} }
} }

View File

@@ -56,6 +56,6 @@ function toggleDevTools () {
webtorrent.win.webContents.closeDevTools() webtorrent.win.webContents.closeDevTools()
webtorrent.win.hide() webtorrent.win.hide()
} else { } else {
webtorrent.win.webContents.openDevTools({ detach: true }) webtorrent.win.webContents.openDevTools({ mode: 'detach' })
} }
} }

View File

@@ -308,7 +308,7 @@ function renderAudioMetadata (state) {
format.push(Math.round(fileSummary.audioInfo.format.bitrate / 1000) + ' kbps') // 128 kbps format.push(Math.round(fileSummary.audioInfo.format.bitrate / 1000) + ' kbps') // 128 kbps
} }
if (fileSummary.audioInfo.format.sampleRate) { if (fileSummary.audioInfo.format.sampleRate) {
format.push(Math.round(fileSummary.audioInfo.format.sampleRate / 100) / 10 + ' kHz') // 44.1 kHz format.push(Math.round(fileSummary.audioInfo.format.sampleRate / 100) / 10 + ' kHz')
} }
if (fileSummary.audioInfo.format.bitsPerSample) { if (fileSummary.audioInfo.format.bitsPerSample) {
format.push(fileSummary.audioInfo.format.bitsPerSample + ' bit') format.push(fileSummary.audioInfo.format.bitsPerSample + ' bit')