This commit is contained in:
Samuel Elliott 2019-04-06 08:20:28 +01:00
parent 26f3f2440c
commit fbba0a8c21
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
2 changed files with 14 additions and 3 deletions

View File

@ -47,7 +47,7 @@ import process from 'process';
import os from 'os';
import path from 'path';
import sass from 'node-sass';
import { BrowserWindow as OriginalBrowserWindow, dialog, session, shell } from 'electron';
import { BrowserWindow as OriginalBrowserWindow, dialog, session, shell, protocol } from 'electron';
import deepmerge from 'deepmerge';
import ContentSecurityPolicy from 'csp-parse';
import keytar from 'keytar';
@ -240,8 +240,15 @@ export class BetterDiscord {
async init() {
console.log('[BetterDiscord] init');
await this.waitForWindowUtils();
// Electron 5.0.0-beta.2 moves this - previously it was in webFrame (renderer)
// https://github.com/electron/electron/pull/16625
if (protocol.registerSchemesAsPrivileged) {
protocol.registerSchemesAsPrivileged([{ scheme: 'chrome-extension' }]);
}
await this.ensureDirectories();
await this.waitForWindowUtils();
this.windowUtils.on('did-finish-load', () => this.injectScripts(true));

View File

@ -17,7 +17,11 @@ import electron, { ipcRenderer } from 'electron';
console.log('[BetterDiscord|Sparkplug]');
electron.webFrame.registerURLSchemeAsPrivileged('chrome-extension');
// Electron 5.0.0-beta.2 moves this to protocol (main)
// https://github.com/electron/electron/pull/16625
if (electron.webFrame.registerURLSchemeAsPrivileged) {
electron.webFrame.registerURLSchemeAsPrivileged('chrome-extension');
}
const currentWindow = electron.remote.getCurrentWindow();