From 4330994b3251ee88d7e91667f3e34911d3b6c756 Mon Sep 17 00:00:00 2001 From: Rick van Lieshout Date: Sun, 20 Apr 2025 13:04:01 +0200 Subject: [PATCH] chore: added debug possibilities --- .vscode/launch.json | 26 ++++++++++++++++--- .../DomController/DomTidalController.ts | 2 +- src/main.ts | 3 ++- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 05f34cf..d996adc 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,15 +2,35 @@ "version": "0.2.0", "configurations": [ { + // we can use this to debug the main process "name": "Electron: Main", "type": "node", "request": "launch", - "program": "${workspaceFolder}/node_modules/electron/dist/electron", - "args": ["."], + "runtimeExecutable": "${workspaceFolder}/node_modules/electron/dist/electron", + "args": [ + "${workspaceFolder}/ts-dist/main.js", + "--no-sandbox", + "--disable-gpu", + "--disable-software-rasterizer", + "--in-process-gpu", + "--inspect=0.0.0.0:5858", + "--remote-debugging-port=8315" + ], "protocol": "inspector", "env": { "ELECTRON_DISABLE_SECURITY_WARNINGS": "false" - } + }, + "outputCapture": "std" + }, + // first run, then connect this to make sure we debug the UI + { + "name": "Electron: Renderer", + "type": "chrome", + "request": "attach", + "port": 8315, + "webRoot": "${workspaceFolder}", + "sourceMaps": true, + "skipFiles": ["/**"] } ] } diff --git a/src/TidalControllers/DomController/DomTidalController.ts b/src/TidalControllers/DomController/DomTidalController.ts index c8e75e7..e30d398 100644 --- a/src/TidalControllers/DomController/DomTidalController.ts +++ b/src/TidalControllers/DomController/DomTidalController.ts @@ -103,7 +103,7 @@ export class DomTidalController implements TidalController globalThis.location.href.includes("/playlist/") || globalThis.location.href.includes("/mix/") ) { - if (this.getCurrentlyPlayingStatus() === MediaStatus.playing) { + if (this.currentlyPlaying === MediaStatus.playing) { // find the currently playing element from the list (which might be in an album icon), traverse back up to the mediaItem (row) and select the album cell. // document.querySelector("[class^='isPlayingIcon'], [data-test-is-playing='true']").closest('[data-type="mediaItem"]').querySelector('[class^="album"]').textContent const row = window.document.querySelector(this.currentlyPlaying).closest(this.mediaItem); diff --git a/src/main.ts b/src/main.ts index 4c1ca44..cf64152 100644 --- a/src/main.ts +++ b/src/main.ts @@ -32,7 +32,8 @@ const PROTOCOL_PREFIX = "tidal"; const windowPreferences = { sandbox: false, plugins: true, - devTools: true, // I like tinkering, others might too + devTools: true, // Ensure devTools is enabled for debugging + contextIsolation: false, // Disable context isolation for debugging }; setDefaultFlags(app);