forked from olcxjas-softworks/LarpixClient
Compatibility tweaks
- Fix (i hope all) electron issues - Add complete blah support - Add userscript
This commit is contained in:
parent
588d55abf8
commit
7ff648ba3a
19 changed files with 478 additions and 576 deletions
|
|
@ -1,4 +1,4 @@
|
|||
require('./rt/electron-rt');
|
||||
//////////////////////////////
|
||||
// User Defined Preload scripts below
|
||||
console.log('User Preload!');
|
||||
//console.log('User Preload!');
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class ElectronCapacitorApp {
|
|||
{ role: 'viewMenu' },
|
||||
];
|
||||
this.CapacitorFileConfig = capacitorFileConfig;
|
||||
this.customScheme = (_b = (_a = this.CapacitorFileConfig.electron) === null || _a === void 0 ? void 0 : _a.customUrlScheme) !== null && _b !== void 0 ? _b : 'capacitor-electron';
|
||||
this.customScheme = (_b = (_a = this.CapacitorFileConfig.electron) === null || _a === void 0 ? void 0 : _a.customUrlScheme) !== null && _b !== void 0 ? _b : 'miarven';
|
||||
if (trayMenuTemplate) {
|
||||
this.TrayMenuTemplate = trayMenuTemplate;
|
||||
}
|
||||
|
|
@ -101,8 +101,10 @@ class ElectronCapacitorApp {
|
|||
height: this.mainWindowState.height,
|
||||
autoHideMenuBar: true,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
nodeIntegration: false,
|
||||
contextIsolation: true,
|
||||
webSecurity: true,
|
||||
allowRunningInsecureContent: true,
|
||||
// Use preload to inject the electron varriant overrides for capacitor plugins.
|
||||
// preload: join(app.getAppPath(), "node_modules", "@capacitor-community", "electron", "dist", "runtime", "electron-rt.js"),
|
||||
preload: preloadPath,
|
||||
|
|
@ -175,6 +177,11 @@ class ElectronCapacitorApp {
|
|||
electron_1.CapElectronEventEmitter.emit('CAPELECTRON_DeeplinkListenerInitialized', '');
|
||||
}, 400);
|
||||
});
|
||||
this.MainWindow.webContents.on('before-input-event', (event, input) => {
|
||||
if (input.control && input.shift && input.key.toLowerCase() === 'i') {
|
||||
this.MainWindow.webContents.openDevTools();
|
||||
}
|
||||
});
|
||||
this.MainWindow.setMenu(null);
|
||||
this.MainWindow.setAutoHideMenuBar(true);
|
||||
this.MainWindow.removeMenu();
|
||||
|
|
@ -186,8 +193,8 @@ function setupContentSecurityPolicy(customScheme) {
|
|||
electron_2.session.defaultSession.webRequest.onHeadersReceived((details, callback) => {
|
||||
callback({
|
||||
responseHeaders: Object.assign(Object.assign({}, details.responseHeaders), { 'Content-Security-Policy': [
|
||||
electronIsDev
|
||||
? `default-src ${customScheme}://* 'unsafe-inline' devtools://* 'unsafe-eval' data:`
|
||||
true
|
||||
? `default-src ${customScheme}://* 'unsafe-inline' 'unsafe-eval' devtools://* http://* https://* ws://* wss://* * data: blob:; frame-src *; style-src * 'unsafe-inline';`
|
||||
: `default-src ${customScheme}://* 'unsafe-inline' data:`,
|
||||
] }),
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue