Compare commits
15 Commits
5.6.0
...
3df82b93db
Author | SHA1 | Date | |
---|---|---|---|
3df82b93db | |||
|
789ba83936 | ||
a962029b0b | |||
d8e4a493b9 | |||
3d0b38361a | |||
1c7385fa50 | |||
510812f384 | |||
5144f67fbc | |||
81b81580c6 | |||
534547ce67 | |||
|
1610e3cc05 | ||
|
e50e7de12e | ||
|
42be522b8e | ||
40d80e0872 | |||
239139e674 |
6
.vscode/settings.json
vendored
@@ -16,5 +16,9 @@
|
|||||||
"tracklist",
|
"tracklist",
|
||||||
"widevine",
|
"widevine",
|
||||||
"xesam"
|
"xesam"
|
||||||
]
|
],
|
||||||
|
"sonarlint.connectedMode.project": {
|
||||||
|
"connectionId": "public-sonarcloud",
|
||||||
|
"projectKey": "Mastermindzh_tidal-hifi"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
17
CHANGELOG.md
@@ -4,10 +4,19 @@ 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.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.
|
||||||
|
- Added settings to customize the Discord rich presence information
|
||||||
|
- Discord settings are now also collapsible like the ListenBrainz ones are
|
||||||
|
- Restyled settings menu to include version number and useful links on the about page
|
||||||
|
|
||||||
## [5.6.0]
|
## [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)
|
- 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)
|
||||||
- Made it clear in the readme that this tidal-hifi client supports High & Max audio settings. fixes [#261](https://github.com/Mastermindzh/tidal-hifi/issues/261)
|
- Made it clear in the readme that this TIDAL Hi-Fi client supports High & Max audio settings. fixes [#261](https://github.com/Mastermindzh/tidal-hifi/issues/261)
|
||||||
- Added app suspension inhibitors when music is playing. fixes [#257](https://github.com/Mastermindzh/tidal-hifi/issues/257)
|
- Added app suspension inhibitors when music is playing. fixes [#257](https://github.com/Mastermindzh/tidal-hifi/issues/257)
|
||||||
- Fixed bug with theme files from user directory trying to load: "an error occurred reading the theme file"
|
- Fixed bug with theme files from user directory trying to load: "an error occurred reading the theme file"
|
||||||
- Fixed: config flags not being set correctly
|
- Fixed: config flags not being set correctly
|
||||||
@@ -89,7 +98,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- New settings window by BlueManCZ
|
- New settings window by BlueManCZ
|
||||||
- Fixed the desktop files in electron-builder
|
- Fixed the desktop files in electron-builder
|
||||||
- icon is set to new static path based on Arch/Debian
|
- icon is set to new static path based on Arch/Debian
|
||||||
- Name has changed to Tidal-Hifi
|
- Name has changed to TIDAL Hi-Fi
|
||||||
|
|
||||||
## 4.1.2
|
## 4.1.2
|
||||||
|
|
||||||
@@ -137,7 +146,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
- Updated to Electron 15
|
- Updated to Electron 15
|
||||||
- Fixed the develop "build-unpacked" command
|
- Fixed the develop "build-unpacked" command
|
||||||
- Added setting to disable multiple tidal-hifi windows (defaults to true)
|
- Added setting to disable multiple TIDAL Hi-Fi windows (defaults to true)
|
||||||
- Added setting to disable HardwareMediaKeyHandling (defaults to false)
|
- Added setting to disable HardwareMediaKeyHandling (defaults to false)
|
||||||
|
|
||||||
## 2.8.2
|
## 2.8.2
|
||||||
@@ -175,7 +184,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## 2.5.0
|
## 2.5.0
|
||||||
|
|
||||||
- Notify-send now correctly shows "Tidal HiFi" as the program name
|
- Notify-send now correctly shows "Tidal Hi-Fi" as the program name
|
||||||
- Updated dependencies (including electron itself)
|
- Updated dependencies (including electron itself)
|
||||||
|
|
||||||
### known issues
|
### known issues
|
||||||
|
30
README.md
@@ -1,20 +1,20 @@
|
|||||||
# Tidal-hifi<img src = "./build/icon.png" height="40" align="right"/>
|
# TIDAL Hi-Fi (Max quality)<img src = "./build/icon.png" height="40" align="right"/>
|
||||||
|
|
||||||
 [](https://github.com/Mastermindzh/tidal-hifi/actions) [](https://ci.mastermindzh.tech/Mastermindzh/tidal-hifi) [](https://discord.gg/yhNwf4v4He)
|
 [](https://github.com/Mastermindzh/tidal-hifi/actions) [](https://ci.mastermindzh.tech/Mastermindzh/tidal-hifi) [](https://discord.gg/yhNwf4v4He)
|
||||||
|
|
||||||
The web version of [listen.tidal.com](https://listen.tidal.com) running in electron with hifi (High & Max) support thanks to widevine.
|
The web version of [listen.tidal.com](https://listen.tidal.com) running in electron with Hi-Fi (High & Max) support thanks to widevine.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
<!-- toc -->
|
<!-- toc -->
|
||||||
|
|
||||||
- [Tidal-hifi](#tidal-hifi)
|
- [TIDAL Hi-Fi (Max quality)](#tidal-hi-fi-max-quality)
|
||||||
- [Table of Contents](#table-of-contents)
|
- [Table of Contents](#table-of-contents)
|
||||||
- [Features](#features)
|
- [Features](#features)
|
||||||
- [Contributions](#contributions)
|
- [Contributions](#contributions)
|
||||||
- [Why did I create tidal-hifi?](#why-did-i-create-tidal-hifi)
|
- [Why did I create TIDAL Hi-Fi?](#why-did-i-create-tidal-hi-fi)
|
||||||
- [Why not extend existing projects?](#why-not-extend-existing-projects)
|
- [Why not extend existing projects?](#why-not-extend-existing-projects)
|
||||||
- [Installation](#installation)
|
- [Installation](#installation)
|
||||||
- [Dependencies](#dependencies)
|
- [Dependencies](#dependencies)
|
||||||
@@ -26,7 +26,6 @@ The web version of [listen.tidal.com](https://listen.tidal.com) running in elect
|
|||||||
- [Using source](#using-source)
|
- [Using source](#using-source)
|
||||||
- [Integrations](#integrations)
|
- [Integrations](#integrations)
|
||||||
- [Known bugs](#known-bugs)
|
- [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)
|
- [DRM not working on Windows](#drm-not-working-on-windows)
|
||||||
- [Special thanks to](#special-thanks-to)
|
- [Special thanks to](#special-thanks-to)
|
||||||
- [Donations](#donations)
|
- [Donations](#donations)
|
||||||
@@ -42,6 +41,7 @@ The web version of [listen.tidal.com](https://listen.tidal.com) running in elect
|
|||||||
- Notifications
|
- Notifications
|
||||||
- Custom [theming](./docs/theming.md)
|
- Custom [theming](./docs/theming.md)
|
||||||
- Custom hotkeys ([source](https://defkey.com/tidal-desktop-shortcuts))
|
- Custom hotkeys ([source](https://defkey.com/tidal-desktop-shortcuts))
|
||||||
|
- Better icons thanks to [Papirus-icon-theme](https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/)
|
||||||
- [Settings feature](./docs/images/settings.png) to disable certain functionality. (`ctrl+=` or `ctrl+0`)
|
- [Settings feature](./docs/images/settings.png) to disable certain functionality. (`ctrl+=` or `ctrl+0`)
|
||||||
- API for status and playback
|
- API for status and playback
|
||||||
- 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))
|
- 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))
|
||||||
@@ -58,7 +58,7 @@ To contribute you can use the standard GitHub features (issues, prs, etc) or joi
|
|||||||
|
|
||||||
-  [Join the Discord server](https://discord.gg/yhNwf4v4He)
|
-  [Join the Discord server](https://discord.gg/yhNwf4v4He)
|
||||||
|
|
||||||
## Why did I create tidal-hifi?
|
## Why did I create TIDAL Hi-Fi?
|
||||||
|
|
||||||
I moved from Spotify over to Tidal and found Linux support to be lacking.
|
I moved from Spotify over to Tidal and found Linux support to be lacking.
|
||||||
When I started this project there weren't any Linux apps that offered Tidal's "hifi" options nor any scripts to control it.
|
When I started this project there weren't any Linux apps that offered Tidal's "hifi" options nor any scripts to control it.
|
||||||
@@ -103,10 +103,10 @@ To install with `snap` you need to download the pre-packaged snap-package from t
|
|||||||
|
|
||||||
### Arch Linux
|
### Arch Linux
|
||||||
|
|
||||||
Arch Linux users can use the AUR to install tidal-hifi:
|
Arch Linux users can use the AUR to install TIDAL Hi-Fi:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
trizen tidal-hifi-bin
|
trizen tidal-hifi-git
|
||||||
```
|
```
|
||||||
|
|
||||||
### Flatpak
|
### Flatpak
|
||||||
@@ -130,13 +130,13 @@ nix-env -iA nixpkgs.tidal-hifi
|
|||||||
To install and work with the code on this project follow these steps:
|
To install and work with the code on this project follow these steps:
|
||||||
|
|
||||||
- git clone [https://github.com/Mastermindzh/tidal-hifi.git](https://github.com/Mastermindzh/tidal-hifi.git)
|
- git clone [https://github.com/Mastermindzh/tidal-hifi.git](https://github.com/Mastermindzh/tidal-hifi.git)
|
||||||
- cd tidal-hifi
|
- cd TIDAL Hi-Fi
|
||||||
- npm install
|
- npm install
|
||||||
- npm start
|
- npm start
|
||||||
|
|
||||||
## Integrations
|
## Integrations
|
||||||
|
|
||||||
tidal-hifi comes with several integrations out of the box.
|
TIDAL Hi-Fi comes with several integrations out of the box.
|
||||||
You can find these in the settings menu (`ctrl + =` by default) under the "integrations" tab.
|
You can find these in the settings menu (`ctrl + =` by default) under the "integrations" tab.
|
||||||
|
|
||||||

|

|
||||||
@@ -148,15 +148,9 @@ Integrations with other projects that are not included natively:
|
|||||||
|
|
||||||
## Known bugs
|
## 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
|
### DRM not working on Windows
|
||||||
|
|
||||||
Most Windows users run into DRM issues when trying to use tidal-hifi.
|
Most Windows users run into DRM issues when trying to use TIDAL Hi-Fi.
|
||||||
Nothing I can do about that I'm afraid... Tidal is working on removing/changing DRM so when they finish with that we can give it another shot.
|
Nothing I can do about that I'm afraid... Tidal is working on removing/changing DRM so when they finish with that we can give it another shot.
|
||||||
|
|
||||||
## Special thanks to
|
## Special thanks to
|
||||||
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 24 KiB |
BIN
assets/icon.png
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 24 KiB |
BIN
build/icon.icns
Executable file → Normal file
BIN
build/icon.png
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 63 KiB |
@@ -1,10 +1,10 @@
|
|||||||
# Theming tidal-hifi
|
# Theming TIDAL Hi-Fi
|
||||||
|
|
||||||
## Table of contents
|
## Table of contents
|
||||||
|
|
||||||
<!-- toc -->
|
<!-- toc -->
|
||||||
|
|
||||||
- [Theming tidal-hifi](#theming-tidal-hifi)
|
- [Theming TIDAL Hi-Fi](#theming-TIDAL Hi-Fi)
|
||||||
- [Table of contents](#table-of-contents)
|
- [Table of contents](#table-of-contents)
|
||||||
- [Custom CSS](#custom-css)
|
- [Custom CSS](#custom-css)
|
||||||
- [config](#config)
|
- [config](#config)
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<!-- tocstop -->
|
<!-- tocstop -->
|
||||||
|
|
||||||
By default tidal-hifi comes with a few themes.
|
By default TIDAL Hi-Fi comes with a few themes.
|
||||||
You can select these in the settings window under the theming tab as shown below.
|
You can select these in the settings window under the theming tab as shown below.
|
||||||
|
|
||||||

|

|
||||||
|
12
package-lock.json
generated
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "tidal-hifi",
|
"name": "TIDAL Hi-Fi",
|
||||||
"version": "5.6.0",
|
"version": "5.6.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "tidal-hifi",
|
"name": "TIDAL Hi-Fi",
|
||||||
"version": "5.6.0",
|
"version": "5.6.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
"discord-rpc": "^4.0.1",
|
"discord-rpc": "^4.0.1",
|
||||||
"electron-store": "^8.1.0",
|
"electron-store": "^8.1.0",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"hotkeys-js": "^3.11.2",
|
"hotkeys-js": "^3.12.0",
|
||||||
"mpris-service": "^2.1.2",
|
"mpris-service": "^2.1.2",
|
||||||
"request": "^2.88.2",
|
"request": "^2.88.2",
|
||||||
"sass": "^1.64.1"
|
"sass": "^1.64.1"
|
||||||
@@ -4855,9 +4855,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/hotkeys-js": {
|
"node_modules/hotkeys-js": {
|
||||||
"version": "3.11.2",
|
"version": "3.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/hotkeys-js/-/hotkeys-js-3.11.2.tgz",
|
"resolved": "https://registry.npmjs.org/hotkeys-js/-/hotkeys-js-3.12.0.tgz",
|
||||||
"integrity": "sha512-hLuR+wtvrVrVFHku5cud44cPXQf5ke+96TonRaGzlNSt22rh2LH65avLYFNsc+QpzMuOEQG/IxJT5mEop99rvg=="
|
"integrity": "sha512-Z+N573ycUKIGwFYS3ID1RzMJiGmtWMGKMiaNLyJS8B1ei+MllF4ZYmKS2T0kMWBktOz+WZLVNikftEgnukOrXg=="
|
||||||
},
|
},
|
||||||
"node_modules/html-tags": {
|
"node_modules/html-tags": {
|
||||||
"version": "3.3.1",
|
"version": "3.3.1",
|
||||||
|
@@ -43,7 +43,7 @@
|
|||||||
"discord-rpc": "^4.0.1",
|
"discord-rpc": "^4.0.1",
|
||||||
"electron-store": "^8.1.0",
|
"electron-store": "^8.1.0",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"hotkeys-js": "^3.11.2",
|
"hotkeys-js": "^3.12.0",
|
||||||
"mpris-service": "^2.1.2",
|
"mpris-service": "^2.1.2",
|
||||||
"request": "^2.88.2",
|
"request": "^2.88.2",
|
||||||
"sass": "^1.64.1"
|
"sass": "^1.64.1"
|
||||||
|
16
scripts/resize-icons.sh
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$1" != "" ]; then # check if arg 1 is present
|
||||||
|
FILE=$1
|
||||||
|
else
|
||||||
|
echo "Please provide a file as an argument."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
SIZES=("16x16" "22x22" "24x24" "32x32" "48x48" "64x64" "128x128" "256x256" "384x384")
|
||||||
|
|
||||||
|
echo "Resizing $FILE..."
|
||||||
|
|
||||||
|
for i in "${SIZES[@]}"; do
|
||||||
|
convert "$FILE" -resize "$i" "$i.png"
|
||||||
|
done
|
@@ -20,6 +20,10 @@ export const settings = {
|
|||||||
disableHardwareMediaKeys: "disableHardwareMediaKeys",
|
disableHardwareMediaKeys: "disableHardwareMediaKeys",
|
||||||
enableCustomHotkeys: "enableCustomHotkeys",
|
enableCustomHotkeys: "enableCustomHotkeys",
|
||||||
enableDiscord: "enableDiscord",
|
enableDiscord: "enableDiscord",
|
||||||
|
discord: {
|
||||||
|
detailsPrefix: "discord.detailsPrefix",
|
||||||
|
buttonText: "discord.buttonText",
|
||||||
|
},
|
||||||
ListenBrainz: {
|
ListenBrainz: {
|
||||||
root: "ListenBrainz",
|
root: "ListenBrainz",
|
||||||
enabled: "ListenBrainz.enabled",
|
enabled: "ListenBrainz.enabled",
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
export default {
|
export default {
|
||||||
name: "tidal-hifi",
|
name: "TIDAL Hi-Fi",
|
||||||
};
|
};
|
||||||
|
@@ -21,7 +21,6 @@ export function setManagedFlagsFromSettings(app: App) {
|
|||||||
for (const [key, value] of Object.entries(flagsFromSettings)) {
|
for (const [key, value] of Object.entries(flagsFromSettings)) {
|
||||||
if (value) {
|
if (value) {
|
||||||
flags[key].forEach((flag) => {
|
flags[key].forEach((flag) => {
|
||||||
Logger.log(`enabling command line option ${flag.flag} with value ${flag.value}`);
|
|
||||||
setFlag(app, flag.flag, 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
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
function setFlag(app: App, flag: string, value?: any) {
|
function setFlag(app: App, flag: string, value?: any) {
|
||||||
|
Logger.log(`enabling command line option ${flag} with value ${value}`);
|
||||||
app.commandLine.appendSwitch(flag, value);
|
app.commandLine.appendSwitch(flag, value);
|
||||||
}
|
}
|
||||||
|
24
src/main.ts
@@ -37,10 +37,14 @@ const tidalUrl = "https://listen.tidal.com";
|
|||||||
let mainInhibitorId = -1;
|
let mainInhibitorId = -1;
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
let mainWindow: BrowserWindow;
|
let mainWindow: BrowserWindow;
|
||||||
const icon = path.join(__dirname, "../assets/icon.png");
|
const icon = path.join(__dirname, "../assets/icon.png");
|
||||||
const PROTOCOL_PREFIX = "tidal";
|
const PROTOCOL_PREFIX = "tidal";
|
||||||
|
const windowPreferences = {
|
||||||
|
sandbox: false,
|
||||||
|
plugins: true,
|
||||||
|
devTools: true, // I like tinkering, others might too
|
||||||
|
};
|
||||||
|
|
||||||
setDefaultFlags(app);
|
setDefaultFlags(app);
|
||||||
setManagedFlagsFromSettings(app);
|
setManagedFlagsFromSettings(app);
|
||||||
@@ -84,10 +88,10 @@ function createWindow(options = { x: 0, y: 0, backgroundColor: "white" }) {
|
|||||||
backgroundColor: options.backgroundColor,
|
backgroundColor: options.backgroundColor,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
sandbox: false,
|
...windowPreferences,
|
||||||
|
...{
|
||||||
preload: path.join(__dirname, "preload.js"),
|
preload: path.join(__dirname, "preload.js"),
|
||||||
plugins: true,
|
},
|
||||||
devTools: true, // I like tinkering, others might too
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
enable(mainWindow.webContents);
|
enable(mainWindow.webContents);
|
||||||
@@ -120,6 +124,18 @@ function createWindow(options = { x: 0, y: 0, backgroundColor: "white" }) {
|
|||||||
const { width, height } = mainWindow.getBounds();
|
const { width, height } = mainWindow.getBounds();
|
||||||
settingsStore.set(settings.windowBounds.root, { width, height });
|
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() {
|
function registerHttpProtocols() {
|
||||||
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 32 KiB |
@@ -7,6 +7,20 @@ import { Logger } from "../../features/logger";
|
|||||||
import { settingsStore } from "./../../scripts/settings";
|
import { settingsStore } from "./../../scripts/settings";
|
||||||
import { getOptions, getOptionsHeader, getThemeListFromDirectory } from "./theming";
|
import { getOptions, getOptionsHeader, getThemeListFromDirectory } from "./theming";
|
||||||
|
|
||||||
|
// All switches on the settings screen that show additional options based on their state
|
||||||
|
const switchesWithSettings = {
|
||||||
|
listenBrainz: {
|
||||||
|
switch: "enableListenBrainz",
|
||||||
|
classToHide: "listenbrainz__options",
|
||||||
|
settingsKey: settings.ListenBrainz.enabled,
|
||||||
|
},
|
||||||
|
discord: {
|
||||||
|
switch: "enableDiscord",
|
||||||
|
classToHide: "discord_options",
|
||||||
|
settingsKey: settings.enableDiscord,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
let adBlock: HTMLInputElement,
|
let adBlock: HTMLInputElement,
|
||||||
api: HTMLInputElement,
|
api: HTMLInputElement,
|
||||||
customCSS: HTMLInputElement,
|
customCSS: HTMLInputElement,
|
||||||
@@ -30,7 +44,9 @@ let adBlock: HTMLInputElement,
|
|||||||
enableListenBrainz: HTMLInputElement,
|
enableListenBrainz: HTMLInputElement,
|
||||||
ListenBrainzAPI: HTMLInputElement,
|
ListenBrainzAPI: HTMLInputElement,
|
||||||
ListenBrainzToken: HTMLInputElement,
|
ListenBrainzToken: HTMLInputElement,
|
||||||
enableWaylandSupport: HTMLInputElement;
|
enableWaylandSupport: HTMLInputElement,
|
||||||
|
discord_details_prefix: HTMLInputElement,
|
||||||
|
discord_button_text: HTMLInputElement;
|
||||||
|
|
||||||
function getThemeFiles() {
|
function getThemeFiles() {
|
||||||
const selectElement = document.getElementById("themesList") as HTMLSelectElement;
|
const selectElement = document.getElementById("themesList") as HTMLSelectElement;
|
||||||
@@ -69,6 +85,20 @@ function handleFileUploads() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hide or unhide an element
|
||||||
|
* @param checked
|
||||||
|
* @param toggleOptions
|
||||||
|
*/
|
||||||
|
function setElementHidden(
|
||||||
|
checked: boolean,
|
||||||
|
toggleOptions: { switch: string; classToHide: string }
|
||||||
|
) {
|
||||||
|
const element = document.getElementById(toggleOptions.classToHide);
|
||||||
|
|
||||||
|
checked ? element.classList.remove("hidden") : element.classList.add("hidden");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sync the UI forms with the current settings
|
* Sync the UI forms with the current settings
|
||||||
*/
|
*/
|
||||||
@@ -98,6 +128,13 @@ function refreshSettings() {
|
|||||||
enableListenBrainz.checked = settingsStore.get(settings.ListenBrainz.enabled);
|
enableListenBrainz.checked = settingsStore.get(settings.ListenBrainz.enabled);
|
||||||
ListenBrainzAPI.value = settingsStore.get(settings.ListenBrainz.api);
|
ListenBrainzAPI.value = settingsStore.get(settings.ListenBrainz.api);
|
||||||
ListenBrainzToken.value = settingsStore.get(settings.ListenBrainz.token);
|
ListenBrainzToken.value = settingsStore.get(settings.ListenBrainz.token);
|
||||||
|
discord_details_prefix.value = settingsStore.get(settings.discord.detailsPrefix);
|
||||||
|
discord_button_text.value = settingsStore.get(settings.discord.buttonText);
|
||||||
|
|
||||||
|
// set state of all switches with additional settings
|
||||||
|
Object.values(switchesWithSettings).forEach((settingSwitch) => {
|
||||||
|
setElementHidden(settingsStore.get(settingSwitch.settingsKey), settingSwitch);
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.log("Refreshing settings failed.", error);
|
Logger.log("Refreshing settings failed.", error);
|
||||||
}
|
}
|
||||||
@@ -118,7 +155,7 @@ function hide() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restart tidal-hifi after changes
|
* Restart TIDAL Hi-Fi after changes
|
||||||
*/
|
*/
|
||||||
function restart() {
|
function restart() {
|
||||||
app.relaunch();
|
app.relaunch();
|
||||||
@@ -144,18 +181,22 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
function addInputListener(source: HTMLInputElement, key: string) {
|
function addInputListener(
|
||||||
|
source: HTMLInputElement,
|
||||||
|
key: string,
|
||||||
|
toggleOptions?: { switch: string; classToHide: string }
|
||||||
|
) {
|
||||||
source.addEventListener("input", () => {
|
source.addEventListener("input", () => {
|
||||||
if (source.value === "on") {
|
if (source.value === "on") {
|
||||||
settingsStore.set(key, source.checked);
|
settingsStore.set(key, source.checked);
|
||||||
} else {
|
} else {
|
||||||
settingsStore.set(key, source.value);
|
settingsStore.set(key, source.value);
|
||||||
}
|
}
|
||||||
// Live update the view for ListenBrainz input, hide if disabled/show if enabled
|
|
||||||
if (source.value === "on" && source.id === "enableListenBrainz") {
|
if (toggleOptions) {
|
||||||
source.checked
|
if (source.value === "on" && source.id === toggleOptions.switch) {
|
||||||
? document.getElementById("listenbrainz__options").removeAttribute("hidden")
|
setElementHidden(source.checked, toggleOptions);
|
||||||
: document.getElementById("listenbrainz__options").setAttribute("hidden", "true");
|
}
|
||||||
}
|
}
|
||||||
ipcRenderer.send(globalEvents.storeChanged);
|
ipcRenderer.send(globalEvents.storeChanged);
|
||||||
});
|
});
|
||||||
@@ -207,19 +248,17 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
enableListenBrainz = get("enableListenBrainz");
|
enableListenBrainz = get("enableListenBrainz");
|
||||||
ListenBrainzAPI = get("ListenBrainzAPI");
|
ListenBrainzAPI = get("ListenBrainzAPI");
|
||||||
ListenBrainzToken = get("ListenBrainzToken");
|
ListenBrainzToken = get("ListenBrainzToken");
|
||||||
|
discord_details_prefix = get("discord_details_prefix");
|
||||||
|
discord_button_text = get("discord_button_text");
|
||||||
|
|
||||||
refreshSettings();
|
refreshSettings();
|
||||||
enableListenBrainz.checked
|
|
||||||
? document.getElementById("listenbrainz__options").removeAttribute("hidden")
|
|
||||||
: document.getElementById("listenbrainz__options").setAttribute("hidden", "true");
|
|
||||||
|
|
||||||
addInputListener(adBlock, settings.adBlock);
|
addInputListener(adBlock, settings.adBlock);
|
||||||
addInputListener(api, settings.api);
|
addInputListener(api, settings.api);
|
||||||
addTextAreaListener(customCSS, settings.customCSS);
|
addTextAreaListener(customCSS, settings.customCSS);
|
||||||
addInputListener(disableBackgroundThrottle, settings.disableBackgroundThrottle);
|
addInputListener(disableBackgroundThrottle, settings.disableBackgroundThrottle);
|
||||||
addInputListener(disableHardwareMediaKeys, settings.flags.disableHardwareMediaKeys);
|
addInputListener(disableHardwareMediaKeys, settings.flags.disableHardwareMediaKeys);
|
||||||
addInputListener(enableCustomHotkeys, settings.enableCustomHotkeys);
|
addInputListener(enableCustomHotkeys, settings.enableCustomHotkeys);
|
||||||
addInputListener(enableDiscord, settings.enableDiscord);
|
addInputListener(enableDiscord, settings.enableDiscord, switchesWithSettings.discord);
|
||||||
addInputListener(enableWaylandSupport, settings.flags.enableWaylandSupport);
|
addInputListener(enableWaylandSupport, settings.flags.enableWaylandSupport);
|
||||||
addInputListener(gpuRasterization, settings.flags.gpuRasterization);
|
addInputListener(gpuRasterization, settings.flags.gpuRasterization);
|
||||||
addInputListener(menuBar, settings.menuBar);
|
addInputListener(menuBar, settings.menuBar);
|
||||||
@@ -234,7 +273,13 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
addSelectListener(theme, settings.theme);
|
addSelectListener(theme, settings.theme);
|
||||||
addInputListener(trayIcon, settings.trayIcon);
|
addInputListener(trayIcon, settings.trayIcon);
|
||||||
addInputListener(updateFrequency, settings.updateFrequency);
|
addInputListener(updateFrequency, settings.updateFrequency);
|
||||||
addInputListener(enableListenBrainz, settings.ListenBrainz.enabled);
|
addInputListener(
|
||||||
|
enableListenBrainz,
|
||||||
|
settings.ListenBrainz.enabled,
|
||||||
|
switchesWithSettings.listenBrainz
|
||||||
|
);
|
||||||
addTextAreaListener(ListenBrainzAPI, settings.ListenBrainz.api);
|
addTextAreaListener(ListenBrainzAPI, settings.ListenBrainz.api);
|
||||||
addTextAreaListener(ListenBrainzToken, settings.ListenBrainz.token);
|
addTextAreaListener(ListenBrainzToken, settings.ListenBrainz.token);
|
||||||
|
addInputListener(discord_details_prefix, settings.discord.detailsPrefix);
|
||||||
|
addInputListener(discord_button_text, settings.discord.buttonText);
|
||||||
});
|
});
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
||||||
<link rel="stylesheet" href="./settings.css" />
|
<link rel="stylesheet" href="./settings.css" />
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="settings-window">
|
<body class="settings-window">
|
||||||
@@ -201,6 +202,9 @@
|
|||||||
<span class="switch__slider"></span>
|
<span class="switch__slider"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="group">
|
||||||
|
<p class="group__title">Discord</p>
|
||||||
<div class="group__option">
|
<div class="group__option">
|
||||||
<div class="group__description">
|
<div class="group__description">
|
||||||
<h4>Discord RPC</h4>
|
<h4>Discord RPC</h4>
|
||||||
@@ -211,6 +215,23 @@
|
|||||||
<span class="switch__slider"></span>
|
<span class="switch__slider"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="discord_options">
|
||||||
|
<div class="group__option" class="hidden">
|
||||||
|
<div class="group__description">
|
||||||
|
<h4>Details prefix</h4>
|
||||||
|
<p>Prefix for the "details" field of Discord's rich presence.</p>
|
||||||
|
<input id="discord_details_prefix" type="text" class="text-input" name="discord_details_prefix" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="group__option">
|
||||||
|
<div class="group__description">
|
||||||
|
<h4>Button text</h4>
|
||||||
|
<p>Text to display on the button below the song information.</p>
|
||||||
|
<input id="discord_button_text" type="text" class="text-input" name="discord_button_text" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="group">
|
<div class="group">
|
||||||
<p class="group__title">ListenBrainz</p>
|
<p class="group__title">ListenBrainz</p>
|
||||||
@@ -224,7 +245,7 @@
|
|||||||
<span class="switch__slider"></span>
|
<span class="switch__slider"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div id="listenbrainz__options" hidden="true">
|
<div id="listenbrainz__options" class="hidden">
|
||||||
<div class="group__option">
|
<div class="group__option">
|
||||||
<div class="group__description">
|
<div class="group__description">
|
||||||
<h4>ListenBrainz API Url</h4>
|
<h4>ListenBrainz API Url</h4>
|
||||||
@@ -250,7 +271,7 @@
|
|||||||
<div class="group__description">
|
<div class="group__description">
|
||||||
<h4>Update frequency</h4>
|
<h4>Update frequency</h4>
|
||||||
<p>
|
<p>
|
||||||
The amount of time, in milliseconds, that tidal-hifi will refresh its playback info by scraping the
|
The amount of time, in milliseconds, that TIDAL Hi-Fi will refresh its playback info by scraping the
|
||||||
website.
|
website.
|
||||||
The default of 500 seems to work in more cases but if you are fine with a bit more resource usage you
|
The default of 500 seems to work in more cases but if you are fine with a bit more resource usage you
|
||||||
can decrease it as well.
|
can decrease it as well.
|
||||||
@@ -300,7 +321,7 @@
|
|||||||
<div class="group__description">
|
<div class="group__description">
|
||||||
<h4>Wayland support</h4>
|
<h4>Wayland support</h4>
|
||||||
<p>
|
<p>
|
||||||
Adds a couple of Electron flags to help Tidal-hifi run smoothly on the Wayland window system.
|
Adds a couple of Electron flags to help TIDAL Hi-Fi run smoothly on the Wayland window system.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<label class="switch">
|
<label class="switch">
|
||||||
@@ -360,21 +381,24 @@
|
|||||||
|
|
||||||
<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">
|
<h4>TIDAL Hi-Fi</h4>
|
||||||
<a class="external-link" data-url="https://github.com/Mastermindzh/tidal-hifi">TIDAL Hi-Fi</a>
|
<div class="about-section__version">
|
||||||
is made by
|
<a href="">5.7.0</a>
|
||||||
<a class="external-link" data-url="https://www.rickvanlieshout.com">
|
</div>
|
||||||
Rick van Lieshout</a>. <br />It uses
|
<div class="about-section__links">
|
||||||
<a class="external-link" data-url="https://castlabs.com/">Castlabs'</a>
|
<a href="https://github.com/mastermindzh/tidal-hifi/" class="about-section__button">Github <i
|
||||||
version of Electron for widevine support.
|
class="fa fa-external-link"></i></a>
|
||||||
</p>
|
<a href="https://github.com/Mastermindzh/tidal-hifi/issues" class="about-section__button">Report an issue <i
|
||||||
|
class="fa fa-external-link"></i></a>
|
||||||
|
<a href="https://github.com/Mastermindzh/tidal-hifi/graphs/contributors"
|
||||||
|
class="about-section__button">Contributors <i class="fa fa-external-link"></i></a>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<p class="footer__note">
|
<p class="footer__note">
|
||||||
Some settings may require a restart of TIDAL Hi-Fi. To do so, click the button below:
|
<strong>Note</strong>: some settings may require a restart of TIDAL Hi-Fi.
|
||||||
</p>
|
</p>
|
||||||
<button class="footer__button" id="restart">Restart TIDAL Hi-Fi</button>
|
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
@@ -8,6 +8,7 @@ $tidal-grey: #72777f;
|
|||||||
$tidal-grey-darker: #404248;
|
$tidal-grey-darker: #404248;
|
||||||
$tidal-grey-darker-focus: #55585f;
|
$tidal-grey-darker-focus: #55585f;
|
||||||
$tidal-grey-darkest: #242528;
|
$tidal-grey-darkest: #242528;
|
||||||
|
$tidal-grey-darkest-focus: #2e2f33;
|
||||||
|
|
||||||
// --- Fonts ---
|
// --- Fonts ---
|
||||||
|
|
||||||
@@ -309,26 +310,75 @@ html {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.about-section {
|
.about-section {
|
||||||
padding-top: 120px;
|
padding-top: 40px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
&__icon {
|
&__icon {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 100px;
|
width: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__text {
|
&__text {
|
||||||
display: block;
|
display: block;
|
||||||
max-width: 350px;
|
max-width: 500px;
|
||||||
margin: 20px auto 0;
|
margin: -15px auto 0;
|
||||||
|
}
|
||||||
|
&__table {
|
||||||
|
width: 120px;
|
||||||
|
margin: 0 auto 0;
|
||||||
|
|
||||||
|
td {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&__version {
|
||||||
|
margin: -10px 0px 30px 0px;
|
||||||
|
a {
|
||||||
|
background-color: $tidal-grey-darker;
|
||||||
|
border: none;
|
||||||
|
color: $tidal-blue;
|
||||||
|
padding: 8px 20px;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 100px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__links {
|
||||||
|
width: 300px;
|
||||||
|
margin: 0 auto;
|
||||||
|
a {
|
||||||
|
border-radius: 10px;
|
||||||
|
border: none;
|
||||||
|
color: $white;
|
||||||
|
padding: 10px 10px 10px 20px;
|
||||||
|
margin: 8px;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 30px;
|
||||||
|
display: flex;
|
||||||
|
text-decoration: none;
|
||||||
|
justify-content: space-between;
|
||||||
|
background-color: $tidal-grey-darkest;
|
||||||
|
|
||||||
|
i {
|
||||||
|
color: $white;
|
||||||
|
line-height: 30px;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: $tidal-grey-darkest-focus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Footer ---
|
// --- Footer ---
|
||||||
}
|
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: calc(100% - 120px);
|
|
||||||
height: 100px;
|
height: 100px;
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -443,3 +493,7 @@ html {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
@@ -20,7 +20,7 @@ import { settingsStore } from "./scripts/settings";
|
|||||||
import { setTitle } from "./scripts/window-functions";
|
import { setTitle } from "./scripts/window-functions";
|
||||||
|
|
||||||
const notificationPath = `${app.getPath("userData")}/notification.jpg`;
|
const notificationPath = `${app.getPath("userData")}/notification.jpg`;
|
||||||
const appName = "Tidal Hifi";
|
const appName = "TIDAL Hi-Fi";
|
||||||
let currentSong = "";
|
let currentSong = "";
|
||||||
let player: Player;
|
let player: Player;
|
||||||
let currentPlayStatus = MediaStatus.paused;
|
let currentPlayStatus = MediaStatus.paused;
|
||||||
@@ -531,8 +531,8 @@ setInterval(function () {
|
|||||||
if (process.platform === "linux" && settingsStore.get(settings.mpris)) {
|
if (process.platform === "linux" && settingsStore.get(settings.mpris)) {
|
||||||
try {
|
try {
|
||||||
player = Player({
|
player = Player({
|
||||||
name: "tidal-hifi",
|
name: "TIDAL Hi-Fi",
|
||||||
identity: "tidal-hifi",
|
identity: "TIDAL Hi-Fi",
|
||||||
supportedUriSchemes: ["file"],
|
supportedUriSchemes: ["file"],
|
||||||
supportedMimeTypes: [
|
supportedMimeTypes: [
|
||||||
"audio/mpeg",
|
"audio/mpeg",
|
||||||
@@ -544,7 +544,6 @@ if (process.platform === "linux" && settingsStore.get(settings.mpris)) {
|
|||||||
supportedInterfaces: ["player"],
|
supportedInterfaces: ["player"],
|
||||||
desktopEntry: "tidal-hifi",
|
desktopEntry: "tidal-hifi",
|
||||||
});
|
});
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
const events = {
|
const events = {
|
||||||
next: "next",
|
next: "next",
|
||||||
|
@@ -1,8 +1,11 @@
|
|||||||
import { Client } from "discord-rpc";
|
import { Client } from "discord-rpc";
|
||||||
import { app, ipcMain } from "electron";
|
import { app, ipcMain } from "electron";
|
||||||
import { globalEvents } from "../constants/globalEvents";
|
import { globalEvents } from "../constants/globalEvents";
|
||||||
|
import { settings } from "../constants/settings";
|
||||||
|
import { Logger } from "../features/logger";
|
||||||
import { MediaStatus } from "../models/mediaStatus";
|
import { MediaStatus } from "../models/mediaStatus";
|
||||||
import { mediaInfo } from "./mediaInfo";
|
import { mediaInfo } from "./mediaInfo";
|
||||||
|
import { settingsStore } from "./settings";
|
||||||
|
|
||||||
const clientId = "833617820704440341";
|
const clientId = "833617820704440341";
|
||||||
|
|
||||||
@@ -15,7 +18,7 @@ function timeToSeconds(timeArray: string[]) {
|
|||||||
export let rpc: Client;
|
export let rpc: Client;
|
||||||
|
|
||||||
const observer = () => {
|
const observer = () => {
|
||||||
if (mediaInfo.status == MediaStatus.paused && rpc) {
|
if (mediaInfo.status === MediaStatus.paused && rpc) {
|
||||||
rpc.setActivity(idleStatus);
|
rpc.setActivity(idleStatus);
|
||||||
} else if (rpc) {
|
} else if (rpc) {
|
||||||
const currentSeconds = timeToSeconds(mediaInfo.current.split(":"));
|
const currentSeconds = timeToSeconds(mediaInfo.current.split(":"));
|
||||||
@@ -23,17 +26,21 @@ const observer = () => {
|
|||||||
const date = new Date();
|
const date = new Date();
|
||||||
const now = (date.getTime() / 1000) | 0;
|
const now = (date.getTime() / 1000) | 0;
|
||||||
const remaining = date.setSeconds(date.getSeconds() + (durationSeconds - currentSeconds));
|
const remaining = date.setSeconds(date.getSeconds() + (durationSeconds - currentSeconds));
|
||||||
|
const detailsPrefix =
|
||||||
|
settingsStore.get<string, string>(settings.discord.detailsPrefix) ?? "Listening to ";
|
||||||
|
const buttonText =
|
||||||
|
settingsStore.get<string, string>(settings.discord.buttonText) ?? "Play on TIDAL";
|
||||||
if (mediaInfo.url) {
|
if (mediaInfo.url) {
|
||||||
rpc.setActivity({
|
rpc.setActivity({
|
||||||
...idleStatus,
|
...idleStatus,
|
||||||
...{
|
...{
|
||||||
details: `Listening to ${mediaInfo.title}`,
|
details: `${detailsPrefix}${mediaInfo.title}`,
|
||||||
state: mediaInfo.artists ? mediaInfo.artists : "unknown artist(s)",
|
state: mediaInfo.artists ? mediaInfo.artists : "unknown artist(s)",
|
||||||
startTimestamp: now,
|
startTimestamp: now,
|
||||||
endTimestamp: remaining,
|
endTimestamp: remaining,
|
||||||
largeImageKey: mediaInfo.image,
|
largeImageKey: mediaInfo.image,
|
||||||
largeImageText: mediaInfo.album ? mediaInfo.album : `${idleStatus.largeImageText}`,
|
largeImageText: mediaInfo.album ? mediaInfo.album : `${idleStatus.largeImageText}`,
|
||||||
buttons: [{ label: "Play on Tidal", url: mediaInfo.url }],
|
buttons: [{ label: buttonText, url: mediaInfo.url }],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -53,7 +60,7 @@ const observer = () => {
|
|||||||
const idleStatus = {
|
const idleStatus = {
|
||||||
details: `Browsing Tidal`,
|
details: `Browsing Tidal`,
|
||||||
largeImageKey: "tidal-hifi-icon",
|
largeImageKey: "tidal-hifi-icon",
|
||||||
largeImageText: `Tidal HiFi ${app.getVersion()}`,
|
largeImageText: `TIDAL Hi-Fi ${app.getVersion()}`,
|
||||||
instance: false,
|
instance: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -70,7 +77,7 @@ export const initRPC = () => {
|
|||||||
ipcMain.on(globalEvents.updateInfo, observer);
|
ipcMain.on(globalEvents.updateInfo, observer);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
console.error("Can't connect to Discord, is it running?");
|
Logger.log("Can't connect to Discord, is it running?");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@@ -8,7 +8,7 @@ import { mediaInfo } from "./mediaInfo";
|
|||||||
import { settingsStore } from "./settings";
|
import { settingsStore } from "./settings";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to enable tidal-hifi's express api
|
* Function to enable TIDAL Hi-Fi's express api
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// expressModule.run = function (mainWindow)
|
// expressModule.run = function (mainWindow)
|
||||||
|
@@ -33,7 +33,6 @@ export const getMenu = function (mainWindow: BrowserWindow) {
|
|||||||
{
|
{
|
||||||
label: name,
|
label: name,
|
||||||
submenu: [
|
submenu: [
|
||||||
{ role: "about" },
|
|
||||||
settingsMenuEntry,
|
settingsMenuEntry,
|
||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
{ role: "services" },
|
{ role: "services" },
|
||||||
@@ -101,12 +100,6 @@ export const getMenu = function (mainWindow: BrowserWindow) {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
settingsMenuEntry,
|
settingsMenuEntry,
|
||||||
{
|
|
||||||
label: "About",
|
|
||||||
click() {
|
|
||||||
showSettingsWindow("about");
|
|
||||||
},
|
|
||||||
},
|
|
||||||
toggleWindow,
|
toggleWindow,
|
||||||
quitMenuEntry,
|
quitMenuEntry,
|
||||||
];
|
];
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import Store from "electron-store";
|
import Store from "electron-store";
|
||||||
|
|
||||||
import { settings } from "../constants/settings";
|
|
||||||
import path from "path";
|
|
||||||
import { BrowserWindow } from "electron";
|
import { BrowserWindow } from "electron";
|
||||||
|
import path from "path";
|
||||||
|
import { settings } from "../constants/settings";
|
||||||
|
|
||||||
let settingsWindow: BrowserWindow;
|
let settingsWindow: BrowserWindow;
|
||||||
|
|
||||||
@@ -18,6 +18,10 @@ export const settingsStore = new Store({
|
|||||||
disableHardwareMediaKeys: false,
|
disableHardwareMediaKeys: false,
|
||||||
enableCustomHotkeys: false,
|
enableCustomHotkeys: false,
|
||||||
enableDiscord: false,
|
enableDiscord: false,
|
||||||
|
discord: {
|
||||||
|
detailsPrefix: "Listening to ",
|
||||||
|
buttonText: "Play on Tidal",
|
||||||
|
},
|
||||||
ListenBrainz: {
|
ListenBrainz: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
api: "https://api.listenbrainz.org",
|
api: "https://api.listenbrainz.org",
|
||||||
@@ -59,8 +63,8 @@ const settingsModule = {
|
|||||||
|
|
||||||
export const createSettingsWindow = function () {
|
export const createSettingsWindow = function () {
|
||||||
settingsWindow = new BrowserWindow({
|
settingsWindow = new BrowserWindow({
|
||||||
width: 700,
|
width: 650,
|
||||||
height: 600,
|
height: 700,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
show: false,
|
show: false,
|
||||||
transparent: true,
|
transparent: true,
|
||||||
|