From 40d80e08725f604c7252bd082e99a6d97a22a510 Mon Sep 17 00:00:00 2001 From: Mastermindzh Date: Mon, 14 Aug 2023 21:26:09 +0200 Subject: [PATCH] made sure all windows run with the same web preferences set --- CHANGELOG.md | 6 ++++++ README.md | 7 ------- src/features/flags/flags.ts | 2 +- src/main.ts | 26 +++++++++++++++++++++----- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c5dc6b..adcf15a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/README.md b/README.md index 267b320..abac078 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/src/features/flags/flags.ts b/src/features/flags/flags.ts index 3ec730a..df5dbef 100644 --- a/src/features/flags/flags.ts +++ b/src/features/flags/flags.ts @@ -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); } diff --git a/src/main.ts b/src/main.ts index 24ea755..b4522ca 100644 --- a/src/main.ts +++ b/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() {