made sure all windows run with the same web preferences set

This commit is contained in:
Rick van Lieshout 2023-08-14 21:26:09 +02:00
parent 239139e674
commit 40d80e0872
4 changed files with 28 additions and 13 deletions

View File

@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [5.7.0]
- Renamed app to TIDAL Hi-Fi.
- Made sure all windows run with the same web preferences set (compared to main app).
- Fixes the last.fm bug.
## [5.6.0]
- Added support for Wayland (on by default) fixes [#262](https://github.com/Mastermindzh/tidal-hifi/issues/262) and [#157](https://github.com/Mastermindzh/tidal-hifi/issues/157)

View File

@ -26,7 +26,6 @@ The web version of [listen.tidal.com](https://listen.tidal.com) running in elect
- [Using source](#using-source)
- [Integrations](#integrations)
- [Known bugs](#known-bugs)
- [last.fm doesn't work out of the box. Use rescrobbler as a workaround](#lastfm-doesnt-work-out-of-the-box-use-rescrobbler-as-a-workaround)
- [DRM not working on Windows](#drm-not-working-on-windows)
- [Special thanks to](#special-thanks-to)
- [Donations](#donations)
@ -148,12 +147,6 @@ Integrations with other projects that are not included natively:
## Known bugs
### last.fm doesn't work out of the box. Use rescrobbler as a workaround
The last.fm login doesn't work, as is evident from the following issue: [Last.fm login doesn't work](https://github.com/Mastermindzh/tidal-hifi/issues/4).
However, in that same issue you can read about a workaround using [rescrobbler](https://github.com/InputUsername/rescrobbled).
For now, that will be the default workaround.
### DRM not working on Windows
Most Windows users run into DRM issues when trying to use TIDAL Hi-Fi.

View File

@ -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);
}

View File

@ -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,
...windowPreferences,
...{
preload: path.join(__dirname, "preload.js"),
plugins: true,
devTools: true, // I like tinkering, others might too
},
},
});
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() {