mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2025-07-28 00:22:26 +02:00
prep v5.0.0, refactored getTrackUrl to use the duplicated getTrackId, and applied some formatting
This commit is contained in:
10
src/main.js
10
src/main.js
@@ -1,5 +1,13 @@
|
||||
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 {
|
||||
settings,
|
||||
store,
|
||||
|
@@ -48,7 +48,7 @@
|
||||
<p>Show a notification when a new song starts.</p>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input id="notifications" type="checkbox">
|
||||
<input id="notifications" type="checkbox" />
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -58,7 +58,7 @@
|
||||
<p>The following list of artists (1 per line) will be skipped automatically.</p>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input id="skipArtists" type="checkbox">
|
||||
<input id="skipArtists" type="checkbox" />
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -66,14 +66,16 @@
|
||||
<div class="group__option">
|
||||
<div class="group__description">
|
||||
<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>
|
||||
<label class="switch">
|
||||
<input id="adBlock" type="checkbox">
|
||||
<input id="adBlock" type="checkbox" />
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="group">
|
||||
<p class="group__title">UI</p>
|
||||
@@ -83,7 +85,7 @@
|
||||
<p>Always show TIDAL Hi-Fi's menu bar.</p>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input id="menuBar" type="checkbox">
|
||||
<input id="menuBar" type="checkbox" />
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -96,7 +98,7 @@
|
||||
<p>Show TIDAL Hi-Fi's tray icon.</p>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input id="trayIcon" type="checkbox">
|
||||
<input id="trayIcon" type="checkbox" />
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -106,7 +108,7 @@
|
||||
<p>Minimize window on close instead.</p>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input id="minimizeOnClose" type="checkbox">
|
||||
<input id="minimizeOnClose" type="checkbox" />
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -119,7 +121,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input id="enableCustomHotkeys" type="checkbox">
|
||||
<input id="enableCustomHotkeys" type="checkbox" />
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -129,7 +131,7 @@
|
||||
<p>Prevent opening multiple TIDAL Hi-Fi's instances.</p>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input id="singleInstance" type="checkbox">
|
||||
<input id="singleInstance" type="checkbox" />
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -141,8 +143,8 @@
|
||||
<p class="group__title">API</p>
|
||||
<div class="group__description">
|
||||
<p>
|
||||
TIDAL Hi-Fi has a built-in web API to allow users to get current song information. You can optionally
|
||||
enable playback control as well.
|
||||
TIDAL Hi-Fi has a built-in web API to allow users to get current song information.
|
||||
You can optionally enable playback control as well.
|
||||
</p>
|
||||
</div>
|
||||
<div class="group__option">
|
||||
@@ -151,14 +153,14 @@
|
||||
<p>Enable the TIDAL Hi-Fi web API.</p>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input id="apiCheckbox" type="checkbox">
|
||||
<input id="apiCheckbox" type="checkbox" />
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="group__option">
|
||||
<div class="group__description">
|
||||
<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 class="group__option">
|
||||
@@ -167,7 +169,7 @@
|
||||
<p>Enable playback control from the web API.</p>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input id="playBackControl" type="checkbox">
|
||||
<input id="playBackControl" type="checkbox" />
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -179,18 +181,20 @@
|
||||
<p class="group__title">Integrations</p>
|
||||
<div class="group__description">
|
||||
<p>
|
||||
TIDAL Hi-Fi is extensible through the use of integrations.
|
||||
You can enable or disable them here.
|
||||
TIDAL Hi-Fi is extensible through the use of integrations. You can enable or
|
||||
disable them here.
|
||||
</p>
|
||||
</div>
|
||||
<div class="group__option">
|
||||
<div class="group__description">
|
||||
<h4>MPRIS</h4>
|
||||
<p>Enable MPRIS interface which provides a mechanism for discovery, querying and basic playback control
|
||||
on Linux systems.</p>
|
||||
<p>
|
||||
Enable MPRIS interface which provides a mechanism for discovery, querying and
|
||||
basic playback control on Linux systems.
|
||||
</p>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input id="mprisCheckbox" type="checkbox">
|
||||
<input id="mprisCheckbox" type="checkbox" />
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -200,7 +204,7 @@
|
||||
<p>Show what you're listening to on Discord.</p>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input id="enableDiscord" type="checkbox">
|
||||
<input id="enableDiscord" type="checkbox" />
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -214,12 +218,12 @@
|
||||
<div class="group__description">
|
||||
<h4>Disable hardware built-in media keys</h4>
|
||||
<p>
|
||||
Also prevents certain desktop environments from recognizing the chrome
|
||||
MPRIS client separately from the custom MPRIS client.
|
||||
Also prevents certain desktop environments from recognizing the chrome MPRIS
|
||||
client separately from the custom MPRIS client.
|
||||
</p>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input id="disableHardwareMediaKeys" type="checkbox">
|
||||
<input id="disableHardwareMediaKeys" type="checkbox" />
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -229,17 +233,19 @@
|
||||
<p>Move a part of the rendering to the GPU for increased performance.</p>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input id="gpuRasterization" type="checkbox">
|
||||
<input id="gpuRasterization" type="checkbox" />
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="group__option">
|
||||
<div class="group__description">
|
||||
<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>
|
||||
<label class="switch">
|
||||
<input id="disableBackgroundThrottle" type="checkbox">
|
||||
<input id="disableBackgroundThrottle" type="checkbox" />
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -247,17 +253,20 @@
|
||||
</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">
|
||||
<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">
|
||||
Rick van Lieshout</a>. <br>It uses <a class="external-link" data-url="https://castlabs.com/">Castlabs'</a>
|
||||
is made by
|
||||
<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.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<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>
|
||||
<button class="footer__button" id="restart">Restart TIDAL Hi-Fi</button>
|
||||
</footer>
|
||||
@@ -266,4 +275,4 @@
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
@@ -313,19 +313,14 @@ function updateMediaInfo(options, notify) {
|
||||
* If it's a song it returns the track URL, if not it will return undefined
|
||||
*/
|
||||
function getTrackURL() {
|
||||
const URLelement = elements.get("title").querySelector("a");
|
||||
if (URLelement !== null) {
|
||||
const id = URLelement.href.replace(/[^0-9]/g, "");
|
||||
return `https://tidal.com/browse/track/${id}`;
|
||||
}
|
||||
|
||||
return window.location;
|
||||
const id = getTrackID();
|
||||
return `https://tidal.com/browse/track/${id}`;
|
||||
}
|
||||
|
||||
function getTrackID() {
|
||||
const URLelement = elements.get("title").querySelector("a");
|
||||
if (URLelement !== null) {
|
||||
const id = URLelement.href.replace(/[^0-9]/g, "");
|
||||
const id = URLelement.href.replace(/\D/g, "");
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -402,7 +397,7 @@ setInterval(function () {
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 1000);
|
||||
}, 100);
|
||||
|
||||
if (process.platform === "linux" && store.get(settings.mpris)) {
|
||||
try {
|
||||
|
Reference in New Issue
Block a user