prep v5.0.0, refactored getTrackUrl to use the duplicated getTrackId, and applied some formatting

This commit is contained in:
Rick van Lieshout 2023-04-21 11:26:10 +02:00
parent 1de71aa82b
commit 0d93bedb4d
7 changed files with 904 additions and 49 deletions

View File

@ -4,6 +4,11 @@ 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/), 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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## 5.0.0
- Replaced "skipping arists" with a full implementation of an Adblock mechanism
> Disabled audio & visual ads, unlocked lyrics, suggested track, track info, unlimited skips thanks to uBlockOrigin custom filters ([source](https://github.com/uBlockOrigin/uAssets/issues/17495))
## 4.4.0 ## 4.4.0
- Updated shortcut hint on the menubar to reflect the new `ctrl+=` shortcut. - Updated shortcut hint on the menubar to reflect the new `ctrl+=` shortcut.

View File

@ -94,7 +94,7 @@ To install and work with the code on this project follow these steps:
- Notifications - Notifications
- Custom hotkeys ([source](https://defkey.com/tidal-desktop-shortcuts)) - Custom hotkeys ([source](https://defkey.com/tidal-desktop-shortcuts))
- API for status and playback - API for status and playback
- Disabled audio & visual ads, unlocked lyrics, suggested track, track info, unlimited skips thanks to uBlockOrigin custom filters ([source](https://github.com/uBlockOrigin/uAssets/issues/17495)) - Disabled audio & visual ads, unlocked lyrics, suggested track, track info, and unlimited skips thanks to uBlockOrigin custom filters ([source](https://github.com/uBlockOrigin/uAssets/issues/17495))
- Custom [integrations](#integrations) - Custom [integrations](#integrations)
- [Settings feature](./docs/settings.png) to disable certain functionality. (`ctrl+=` or `ctrl+0`) - [Settings feature](./docs/settings.png) to disable certain functionality. (`ctrl+=` or `ctrl+0`)
- AlbumArt in integrations ([best-effort](https://github.com/Mastermindzh/tidal-hifi/pull/88#pullrequestreview-840814847)) - AlbumArt in integrations ([best-effort](https://github.com/Mastermindzh/tidal-hifi/pull/88#pullrequestreview-840814847))
@ -140,7 +140,7 @@ Whilst there are a handful of projects attempting to run Tidal on Electron they
Sometimes it's just easier to start over, cover my own needs and then making it available to the public :) Sometimes it's just easier to start over, cover my own needs and then making it available to the public :)
## Special thanks to... ## Special thanks to
- [Castlabs](https://castlabs.com/) - [Castlabs](https://castlabs.com/)
For maintaining Electron with Widevine CDM installation, Verified Media Path (VMP), and persistent licenses (StorageID) For maintaining Electron with Widevine CDM installation, Verified Media Path (VMP), and persistent licenses (StorageID)

841
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "tidal-hifi", "name": "tidal-hifi",
"version": "4.4.0", "version": "5.0.0",
"description": "Tidal on Electron with widevine(hifi) support", "description": "Tidal on Electron with widevine(hifi) support",
"main": "src/main.js", "main": "src/main.js",
"scripts": { "scripts": {
@ -45,6 +45,7 @@
"electron": "git+https://github.com/castlabs/electron-releases.git#v19.0.5+wvcus", "electron": "git+https://github.com/castlabs/electron-releases.git#v19.0.5+wvcus",
"electron-builder": "^23.3.3", "electron-builder": "^23.3.3",
"js-yaml": "^3.14.1", "js-yaml": "^3.14.1",
"markdown-toc": "^1.2.0",
"prettier": "^2.7.1", "prettier": "^2.7.1",
"sass-lint": "^1.13.1", "sass-lint": "^1.13.1",
"sass-lint-auto-fix": "^0.21.2" "sass-lint-auto-fix": "^0.21.2"

View File

@ -1,5 +1,13 @@
require("@electron/remote/main").initialize(); require("@electron/remote/main").initialize();
const { app, BrowserWindow, components, globalShortcut, ipcMain, protocol, session } = require("electron"); const {
app,
BrowserWindow,
components,
globalShortcut,
ipcMain,
protocol,
session,
} = require("electron");
const { const {
settings, settings,
store, store,

View File

@ -48,7 +48,7 @@
<p>Show a notification when a new song starts.</p> <p>Show a notification when a new song starts.</p>
</div> </div>
<label class="switch"> <label class="switch">
<input id="notifications" type="checkbox"> <input id="notifications" type="checkbox" />
<span class="switch__slider"></span> <span class="switch__slider"></span>
</label> </label>
</div> </div>
@ -58,7 +58,7 @@
<p>The following list of artists (1 per line) will be skipped automatically.</p> <p>The following list of artists (1 per line) will be skipped automatically.</p>
</div> </div>
<label class="switch"> <label class="switch">
<input id="skipArtists" type="checkbox"> <input id="skipArtists" type="checkbox" />
<span class="switch__slider"></span> <span class="switch__slider"></span>
</label> </label>
</div> </div>
@ -66,14 +66,16 @@
<div class="group__option"> <div class="group__option">
<div class="group__description"> <div class="group__description">
<h4>Block ads</h4> <h4>Block ads</h4>
<p>Disabled audio & visual ads, unlocked lyrics, suggested track, track info, unlimited skips</p> <p>
Disabled audio & visual ads, unlocked lyrics, suggested track, track info,
unlimited skips
</p>
</div> </div>
<label class="switch"> <label class="switch">
<input id="adBlock" type="checkbox"> <input id="adBlock" type="checkbox" />
<span class="switch__slider"></span> <span class="switch__slider"></span>
</label> </label>
</div> </div>
</div> </div>
<div class="group"> <div class="group">
<p class="group__title">UI</p> <p class="group__title">UI</p>
@ -83,7 +85,7 @@
<p>Always show TIDAL Hi-Fi's menu bar.</p> <p>Always show TIDAL Hi-Fi's menu bar.</p>
</div> </div>
<label class="switch"> <label class="switch">
<input id="menuBar" type="checkbox"> <input id="menuBar" type="checkbox" />
<span class="switch__slider"></span> <span class="switch__slider"></span>
</label> </label>
</div> </div>
@ -96,7 +98,7 @@
<p>Show TIDAL Hi-Fi's tray icon.</p> <p>Show TIDAL Hi-Fi's tray icon.</p>
</div> </div>
<label class="switch"> <label class="switch">
<input id="trayIcon" type="checkbox"> <input id="trayIcon" type="checkbox" />
<span class="switch__slider"></span> <span class="switch__slider"></span>
</label> </label>
</div> </div>
@ -106,7 +108,7 @@
<p>Minimize window on close instead.</p> <p>Minimize window on close instead.</p>
</div> </div>
<label class="switch"> <label class="switch">
<input id="minimizeOnClose" type="checkbox"> <input id="minimizeOnClose" type="checkbox" />
<span class="switch__slider"></span> <span class="switch__slider"></span>
</label> </label>
</div> </div>
@ -119,7 +121,7 @@
</p> </p>
</div> </div>
<label class="switch"> <label class="switch">
<input id="enableCustomHotkeys" type="checkbox"> <input id="enableCustomHotkeys" type="checkbox" />
<span class="switch__slider"></span> <span class="switch__slider"></span>
</label> </label>
</div> </div>
@ -129,7 +131,7 @@
<p>Prevent opening multiple TIDAL Hi-Fi's instances.</p> <p>Prevent opening multiple TIDAL Hi-Fi's instances.</p>
</div> </div>
<label class="switch"> <label class="switch">
<input id="singleInstance" type="checkbox"> <input id="singleInstance" type="checkbox" />
<span class="switch__slider"></span> <span class="switch__slider"></span>
</label> </label>
</div> </div>
@ -141,8 +143,8 @@
<p class="group__title">API</p> <p class="group__title">API</p>
<div class="group__description"> <div class="group__description">
<p> <p>
TIDAL Hi-Fi has a built-in web API to allow users to get current song information. You can optionally TIDAL Hi-Fi has a built-in web API to allow users to get current song information.
enable playback control as well. You can optionally enable playback control as well.
</p> </p>
</div> </div>
<div class="group__option"> <div class="group__option">
@ -151,14 +153,14 @@
<p>Enable the TIDAL Hi-Fi web API.</p> <p>Enable the TIDAL Hi-Fi web API.</p>
</div> </div>
<label class="switch"> <label class="switch">
<input id="apiCheckbox" type="checkbox"> <input id="apiCheckbox" type="checkbox" />
<span class="switch__slider"></span> <span class="switch__slider"></span>
</label> </label>
</div> </div>
<div class="group__option"> <div class="group__option">
<div class="group__description"> <div class="group__description">
<label for="port">API port</label> <label for="port">API port</label>
<input id="port" type="text" class="text-input" name="port"> <input id="port" type="text" class="text-input" name="port" />
</div> </div>
</div> </div>
<div class="group__option"> <div class="group__option">
@ -167,7 +169,7 @@
<p>Enable playback control from the web API.</p> <p>Enable playback control from the web API.</p>
</div> </div>
<label class="switch"> <label class="switch">
<input id="playBackControl" type="checkbox"> <input id="playBackControl" type="checkbox" />
<span class="switch__slider"></span> <span class="switch__slider"></span>
</label> </label>
</div> </div>
@ -179,18 +181,20 @@
<p class="group__title">Integrations</p> <p class="group__title">Integrations</p>
<div class="group__description"> <div class="group__description">
<p> <p>
TIDAL Hi-Fi is extensible through the use of integrations. TIDAL Hi-Fi is extensible through the use of integrations. You can enable or
You can enable or disable them here. disable them here.
</p> </p>
</div> </div>
<div class="group__option"> <div class="group__option">
<div class="group__description"> <div class="group__description">
<h4>MPRIS</h4> <h4>MPRIS</h4>
<p>Enable MPRIS interface which provides a mechanism for discovery, querying and basic playback control <p>
on Linux systems.</p> Enable MPRIS interface which provides a mechanism for discovery, querying and
basic playback control on Linux systems.
</p>
</div> </div>
<label class="switch"> <label class="switch">
<input id="mprisCheckbox" type="checkbox"> <input id="mprisCheckbox" type="checkbox" />
<span class="switch__slider"></span> <span class="switch__slider"></span>
</label> </label>
</div> </div>
@ -200,7 +204,7 @@
<p>Show what you're listening to on Discord.</p> <p>Show what you're listening to on Discord.</p>
</div> </div>
<label class="switch"> <label class="switch">
<input id="enableDiscord" type="checkbox"> <input id="enableDiscord" type="checkbox" />
<span class="switch__slider"></span> <span class="switch__slider"></span>
</label> </label>
</div> </div>
@ -214,12 +218,12 @@
<div class="group__description"> <div class="group__description">
<h4>Disable hardware built-in media keys</h4> <h4>Disable hardware built-in media keys</h4>
<p> <p>
Also prevents certain desktop environments from recognizing the chrome Also prevents certain desktop environments from recognizing the chrome MPRIS
MPRIS client separately from the custom MPRIS client. client separately from the custom MPRIS client.
</p> </p>
</div> </div>
<label class="switch"> <label class="switch">
<input id="disableHardwareMediaKeys" type="checkbox"> <input id="disableHardwareMediaKeys" type="checkbox" />
<span class="switch__slider"></span> <span class="switch__slider"></span>
</label> </label>
</div> </div>
@ -229,17 +233,19 @@
<p>Move a part of the rendering to the GPU for increased performance.</p> <p>Move a part of the rendering to the GPU for increased performance.</p>
</div> </div>
<label class="switch"> <label class="switch">
<input id="gpuRasterization" type="checkbox"> <input id="gpuRasterization" type="checkbox" />
<span class="switch__slider"></span> <span class="switch__slider"></span>
</label> </label>
</div> </div>
<div class="group__option"> <div class="group__option">
<div class="group__description"> <div class="group__description">
<h4>Disable Background Throttling</h4> <h4>Disable Background Throttling</h4>
<p>Makes app more responsive while in the background, at the cost of performance.</p> <p>
Makes app more responsive while in the background, at the cost of performance.
</p>
</div> </div>
<label class="switch"> <label class="switch">
<input id="disableBackgroundThrottle" type="checkbox"> <input id="disableBackgroundThrottle" type="checkbox" />
<span class="switch__slider"></span> <span class="switch__slider"></span>
</label> </label>
</div> </div>
@ -247,17 +253,20 @@
</section> </section>
<section id="about-section" class="tabs__section about-section"> <section id="about-section" class="tabs__section about-section">
<img alt="tidal icon" class="about-section__icon" src="./icon.png"> <img alt="tidal icon" class="about-section__icon" src="./icon.png" />
<p class="about-section__text"> <p class="about-section__text">
<a class="external-link" data-url="https://github.com/Mastermindzh/tidal-hifi">TIDAL Hi-Fi</a> <a class="external-link" data-url="https://github.com/Mastermindzh/tidal-hifi">TIDAL Hi-Fi</a>
is made by <a class="external-link" data-url="https://www.rickvanlieshout.com"> is made by
Rick van Lieshout</a>. <br>It uses <a class="external-link" data-url="https://castlabs.com/">Castlabs'</a> <a class="external-link" data-url="https://www.rickvanlieshout.com">
Rick van Lieshout</a>. <br />It uses
<a class="external-link" data-url="https://castlabs.com/">Castlabs'</a>
version of Electron for widevine support. version of Electron for widevine support.
</p> </p>
</section> </section>
<footer class="footer"> <footer class="footer">
<p class="footer__note">Some settings may require a restart of TIDAL Hi-Fi. To do so, click the button below: <p class="footer__note">
Some settings may require a restart of TIDAL Hi-Fi. To do so, click the button below:
</p> </p>
<button class="footer__button" id="restart">Restart TIDAL Hi-Fi</button> <button class="footer__button" id="restart">Restart TIDAL Hi-Fi</button>
</footer> </footer>

View File

@ -313,19 +313,14 @@ function updateMediaInfo(options, notify) {
* If it's a song it returns the track URL, if not it will return undefined * If it's a song it returns the track URL, if not it will return undefined
*/ */
function getTrackURL() { function getTrackURL() {
const URLelement = elements.get("title").querySelector("a"); const id = getTrackID();
if (URLelement !== null) { return `https://tidal.com/browse/track/${id}`;
const id = URLelement.href.replace(/[^0-9]/g, "");
return `https://tidal.com/browse/track/${id}`;
}
return window.location;
} }
function getTrackID() { function getTrackID() {
const URLelement = elements.get("title").querySelector("a"); const URLelement = elements.get("title").querySelector("a");
if (URLelement !== null) { if (URLelement !== null) {
const id = URLelement.href.replace(/[^0-9]/g, ""); const id = URLelement.href.replace(/\D/g, "");
return id; return id;
} }
@ -402,7 +397,7 @@ setInterval(function () {
} }
} }
} }
}, 1000); }, 100);
if (process.platform === "linux" && store.get(settings.mpris)) { if (process.platform === "linux" && store.get(settings.mpris)) {
try { try {