mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2025-07-28 00:22:26 +02:00
made sure all windows run with the same web preferences set
This commit is contained in:
@@ -21,7 +21,6 @@ export function setManagedFlagsFromSettings(app: App) {
|
||||
for (const [key, value] of Object.entries(flagsFromSettings)) {
|
||||
if (value) {
|
||||
flags[key].forEach((flag) => {
|
||||
Logger.log(`enabling command line option ${flag.flag} with value ${flag.value}`);
|
||||
setFlag(app, flag.flag, flag.value);
|
||||
});
|
||||
}
|
||||
@@ -37,5 +36,6 @@ export function setManagedFlagsFromSettings(app: App) {
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function setFlag(app: App, flag: string, value?: any) {
|
||||
Logger.log(`enabling command line option ${flag} with value ${value}`);
|
||||
app.commandLine.appendSwitch(flag, value);
|
||||
}
|
||||
|
26
src/main.ts
26
src/main.ts
@@ -31,10 +31,14 @@ import { addTray, refreshTray } from "./scripts/tray";
|
||||
const tidalUrl = "https://listen.tidal.com";
|
||||
|
||||
initialize();
|
||||
|
||||
let mainWindow: BrowserWindow;
|
||||
const icon = path.join(__dirname, "../assets/icon.png");
|
||||
const PROTOCOL_PREFIX = "tidal";
|
||||
const windowPreferences = {
|
||||
sandbox: false,
|
||||
plugins: true,
|
||||
devTools: true, // I like tinkering, others might too
|
||||
};
|
||||
|
||||
setDefaultFlags(app);
|
||||
setManagedFlagsFromSettings(app);
|
||||
@@ -78,10 +82,10 @@ function createWindow(options = { x: 0, y: 0, backgroundColor: "white" }) {
|
||||
backgroundColor: options.backgroundColor,
|
||||
autoHideMenuBar: true,
|
||||
webPreferences: {
|
||||
sandbox: false,
|
||||
preload: path.join(__dirname, "preload.js"),
|
||||
plugins: true,
|
||||
devTools: true, // I like tinkering, others might too
|
||||
...windowPreferences,
|
||||
...{
|
||||
preload: path.join(__dirname, "preload.js"),
|
||||
},
|
||||
},
|
||||
});
|
||||
enable(mainWindow.webContents);
|
||||
@@ -113,6 +117,18 @@ function createWindow(options = { x: 0, y: 0, backgroundColor: "white" }) {
|
||||
const { width, height } = mainWindow.getBounds();
|
||||
settingsStore.set(settings.windowBounds.root, { width, height });
|
||||
});
|
||||
mainWindow.webContents.setWindowOpenHandler(() => {
|
||||
return {
|
||||
action: "allow",
|
||||
overrideBrowserWindowOptions: {
|
||||
webPreferences: {
|
||||
sandbox: false,
|
||||
plugins: true,
|
||||
devTools: true, // I like tinkering, others might too
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function registerHttpProtocols() {
|
||||
|
Reference in New Issue
Block a user