mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2025-09-13 23:29:28 +02:00
Compare commits
51 Commits
81b81580c6
...
5.8.0
Author | SHA1 | Date | |
---|---|---|---|
5bd28913da | |||
5240f1eeeb | |||
5e82c18d8a | |||
1d19857977 | |||
98f75418eb | |||
|
0d1a533f71 | ||
000bade444 | |||
69f2e26ca9 | |||
|
60d7da4652 | ||
|
6ef6bc0d40 | ||
89592bcf4d | |||
f5185c6627 | |||
|
a01fcd0791 | ||
|
69eef58f8e | ||
ff060a31e5 | |||
cbc7fc4a4e | |||
173c502143 | |||
|
5111af6a71 | ||
|
f094139794 | ||
b3d9b187c1 | |||
|
276632ea9d | ||
|
c298b73773 | ||
d14dbad9ea | |||
9e8f6a61f3 | |||
387a544b0f | |||
|
76fa8de96c | ||
|
fc2d5d20ca | ||
|
9ba2d0fe26 | ||
d94d42e2bd | |||
|
00db9f753e | ||
696a2730be | |||
6a5814c446 | |||
|
2326c6dd6a | ||
0dadce4596 | |||
9e2cbaed38 | |||
33070c157a | |||
eb91b66ac6 | |||
68f76a9e63 | |||
cbb22ba688 | |||
3df82b93db | |||
|
789ba83936 | ||
a962029b0b | |||
|
b3fffc78ec | ||
d8e4a493b9 | |||
3d0b38361a | |||
1c7385fa50 | |||
510812f384 | |||
5144f67fbc | |||
|
1610e3cc05 | ||
|
e50e7de12e | ||
|
42be522b8e |
@@ -5,6 +5,9 @@
|
||||
"extends": [
|
||||
"stylelint-config-standard-scss"
|
||||
],
|
||||
"ignoreFiles": [
|
||||
"src/themes/**.scss"
|
||||
],
|
||||
"rules": {
|
||||
"prettier/prettier": true,
|
||||
"scss/at-extend-no-missing-placeholder": null,
|
||||
|
8
.vscode/settings.json
vendored
8
.vscode/settings.json
vendored
@@ -6,8 +6,10 @@
|
||||
"Flatpak",
|
||||
"geqnfr",
|
||||
"hifi",
|
||||
"libnotify",
|
||||
"listenbrainz",
|
||||
"playpause",
|
||||
"prs",
|
||||
"rescrobbler",
|
||||
"scrobble",
|
||||
"scrobbling",
|
||||
@@ -16,5 +18,9 @@
|
||||
"tracklist",
|
||||
"widevine",
|
||||
"xesam"
|
||||
]
|
||||
],
|
||||
"sonarlint.connectedMode.project": {
|
||||
"connectionId": "public-sonarcloud",
|
||||
"projectKey": "Mastermindzh_tidal-hifi"
|
||||
}
|
||||
}
|
||||
|
29
CHANGELOG.md
29
CHANGELOG.md
@@ -4,16 +4,43 @@ 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.8.0]
|
||||
|
||||
- Updated Electron to 28.1.1 (fixes [325](https://github.com/Mastermindzh/tidal-hifi/issues/325))
|
||||
- Updated dependencies to latest
|
||||
- added theme files to stylelint ignore
|
||||
- fixed other stylelint errors
|
||||
|
||||
- Added functionality to favorite a song (fixes [#323](https://github.com/Mastermindzh/tidal-hifi/issues/323))
|
||||
- Added a hotkey to favorite ("Add to collection") songs: Control+a
|
||||
- Added the "favorite" field in the `mediaInfo` and the API `/current` endpoint
|
||||
- Added an endpoint to toggle favoriting a song: `http://localhost:47836/favorite/toggle`
|
||||
|
||||
- Fixed wrong "end time stamp" for currently playing song (fixes [#282](https://github.com/Mastermindzh/tidal-hifi/issues/282))
|
||||
- Affected the API + all integrations
|
||||
- As requested we also added toggle to sync the timestamps to Discord (default = true)
|
||||
|
||||
## [5.7.1]
|
||||
|
||||
- Fixed mpris not being set up correctly due to capitalization of the instance name.
|
||||
|
||||
## [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
|
||||

|
||||
- The ListenBrainz integration has been extended with a configurable (5 seconds by default) delay in song reporting so that it doesn't spam the API when you are cycling through songs.
|
||||
- Custom CSS now also applies to settings window
|
||||

|
||||
|
||||
## [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)
|
||||
- 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)
|
||||
- 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
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# TIDAL Hi-Fi (Max quality) <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)
|
||||
|
||||
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.
|
||||
|
||||

|
||||
|
||||
@@ -10,7 +10,7 @@ The web version of [listen.tidal.com](https://listen.tidal.com) running in elect
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [TIDAL Hi-Fi (Max quality) ](#tidal-hi-fi-max-quality-)
|
||||
- [TIDAL Hi-Fi (Max quality)](#tidal-hi-fi-max-quality)
|
||||
- [Table of Contents](#table-of-contents)
|
||||
- [Features](#features)
|
||||
- [Contributions](#contributions)
|
||||
@@ -51,10 +51,11 @@ The web version of [listen.tidal.com](https://listen.tidal.com) running in elect
|
||||
- Songwhip.com integration (hotkey `ctrl + w`)
|
||||
- Discord RPC integration (showing "now listening", "Browsing", etc)
|
||||
- MPRIS integration
|
||||
- UI + Json config (`~/.config/tidal-hifi/`, or `~/.var/app/com.mastermindzh.tidal-hifi/` for Flatpak)
|
||||
|
||||
## Contributions
|
||||
|
||||
To contribute you can use the standard GitHub features (issues, prs, etc) or join the discord server to talk with like-minded individuals.
|
||||
To contribute you can use the standard GitHub features (issues, prs, etc.) or join the discord server to talk with like-minded individuals.
|
||||
|
||||
-  [Join the Discord server](https://discord.gg/yhNwf4v4He)
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
appId: com.rickvanlieshout.tidal-hifi
|
||||
electronVersion: 24.1.2
|
||||
electronVersion: 28.1.1
|
||||
electronDownload:
|
||||
version: 24.1.2+wvcus
|
||||
version: 28.1.1+wvcus
|
||||
mirror: https://github.com/castlabs/electron-releases/releases/download/v
|
||||
snap:
|
||||
plugs:
|
||||
|
BIN
docs/images/customcss-menu.png
Normal file
BIN
docs/images/customcss-menu.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 262 KiB |
Binary file not shown.
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 63 KiB |
BIN
docs/images/new-about.png
Normal file
BIN
docs/images/new-about.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
3572
package-lock.json
generated
3572
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
47
package.json
47
package.json
@@ -1,12 +1,13 @@
|
||||
{
|
||||
"name": "tidal-hifi",
|
||||
"version": "5.6.0",
|
||||
"version": "5.8.0",
|
||||
"description": "Tidal on Electron with widevine(hifi) support",
|
||||
"main": "ts-dist/main.js",
|
||||
"scripts": {
|
||||
"start": "electron --inspect=0.0.0.0:5858 .",
|
||||
"watchStart": "nodemon dist -x \"npm run start\"",
|
||||
"compile": "tsc && npm run sass-and-copy",
|
||||
"deps": "npm run watch",
|
||||
"watch": "tsc-watch --onSuccess \"npm run sass-and-copy\"",
|
||||
"copy-files": "copyfiles -u 1 --exclude './src/**/*.ts' --exclude './src/**/*.scss' \"./src/**/*\" ts-dist",
|
||||
"copy-themes-dev": "copyfiles -u 1 \"./themes/*\" node_modules/electron/dist/resources",
|
||||
@@ -35,41 +36,41 @@
|
||||
"castlabs"
|
||||
],
|
||||
"author": "Rick van Lieshout <info@rickvanlieshout.com> (http://rickvanlieshout.com)",
|
||||
"homepage": "https://github.com/Mastermindzh/TIDAL Hi-Fi",
|
||||
"homepage": "https://github.com/Mastermindzh/tidal-hifi",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@electron/remote": "^2.0.10",
|
||||
"axios": "^1.4.0",
|
||||
"@electron/remote": "^2.1.1",
|
||||
"axios": "^1.6.5",
|
||||
"discord-rpc": "^4.0.1",
|
||||
"electron-store": "^8.1.0",
|
||||
"express": "^4.18.2",
|
||||
"hotkeys-js": "^3.11.2",
|
||||
"hotkeys-js": "^3.13.3",
|
||||
"mpris-service": "^2.1.2",
|
||||
"request": "^2.88.2",
|
||||
"sass": "^1.64.1"
|
||||
"sass": "^1.69.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@mastermindzh/prettier-config": "^1.0.0",
|
||||
"@types/discord-rpc": "^4.0.5",
|
||||
"@types/express": "^4.17.17",
|
||||
"@types/node": "^20.4.4",
|
||||
"@types/request": "^2.48.8",
|
||||
"@typescript-eslint/eslint-plugin": "^6.1.0",
|
||||
"@typescript-eslint/parser": "^6.1.0",
|
||||
"@types/discord-rpc": "^4.0.8",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/node": "^20.10.6",
|
||||
"@types/request": "^2.48.12",
|
||||
"@typescript-eslint/eslint-plugin": "^6.18.0",
|
||||
"@typescript-eslint/parser": "^6.18.0",
|
||||
"copyfiles": "^2.4.1",
|
||||
"electron": "git+https://github.com/castlabs/electron-releases.git#v24.1.2+wvcus",
|
||||
"electron-builder": "^24.4.0",
|
||||
"eslint": "^8.45.0",
|
||||
"electron": "git+https://github.com/castlabs/electron-releases#v28.1.1+wvcus",
|
||||
"electron-builder": "^24.9.1",
|
||||
"eslint": "^8.56.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"markdown-toc": "^1.2.0",
|
||||
"nodemon": "^3.0.1",
|
||||
"prettier": "^3.0.0",
|
||||
"stylelint": "^15.10.2",
|
||||
"stylelint-config-standard": "^34.0.0",
|
||||
"stylelint-config-standard-scss": "^10.0.0",
|
||||
"stylelint-prettier": "^4.0.0",
|
||||
"nodemon": "^3.0.2",
|
||||
"prettier": "^3.1.1",
|
||||
"stylelint": "^16.1.0",
|
||||
"stylelint-config-standard": "^36.0.0",
|
||||
"stylelint-config-standard-scss": "^13.0.0",
|
||||
"stylelint-prettier": "^5.0.0",
|
||||
"tsc-watch": "^6.0.4",
|
||||
"typescript": "^5.1.6"
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"prettier": "@mastermindzh/prettier-config"
|
||||
}
|
||||
}
|
@@ -16,11 +16,12 @@
|
||||
search: '[class^="searchField"]',
|
||||
shuffle: '*[data-test="shuffle"]',
|
||||
repeat: '*[data-test="repeat"]',
|
||||
account: '*[data-test^="profile-image-button"]',
|
||||
account: '*[class^="profileOptions"]',
|
||||
settings: '*[data-test^="open-settings"]',
|
||||
media: '*[data-test="current-media-imagery"]',
|
||||
image: "img",
|
||||
current: '*[data-test="current-time"]',
|
||||
duration: '*[data-test="duration"]',
|
||||
duration: '*[class^=playbackControlsContainer] *[data-test="duration"]',
|
||||
bar: '*[data-test="progress-bar"]',
|
||||
footer: "#footerPlayer",
|
||||
mediaItem: "[data-type='mediaItem']",
|
||||
@@ -29,6 +30,7 @@
|
||||
album_name_cell: '[class^="album"]',
|
||||
tracklist_row: '[data-test="tracklist-row"]',
|
||||
volume: '*[data-test="volume"]',
|
||||
favorite: '*[data-test="footer-favorite-button"]',
|
||||
};
|
||||
|
||||
let results = [];
|
||||
|
@@ -12,4 +12,5 @@ export const globalEvents = {
|
||||
error: "error",
|
||||
whip: "whip",
|
||||
log: "log",
|
||||
toggleFavorite: "toggleFavorite",
|
||||
};
|
||||
|
@@ -20,11 +20,17 @@ export const settings = {
|
||||
disableHardwareMediaKeys: "disableHardwareMediaKeys",
|
||||
enableCustomHotkeys: "enableCustomHotkeys",
|
||||
enableDiscord: "enableDiscord",
|
||||
discord: {
|
||||
detailsPrefix: "discord.detailsPrefix",
|
||||
buttonText: "discord.buttonText",
|
||||
includeTimestamps: "discord.includeTimestamps",
|
||||
},
|
||||
ListenBrainz: {
|
||||
root: "ListenBrainz",
|
||||
enabled: "ListenBrainz.enabled",
|
||||
api: "ListenBrainz.api",
|
||||
token: "ListenBrainz.token",
|
||||
delay: "ListenBrainz.delay",
|
||||
},
|
||||
flags: {
|
||||
root: "flags",
|
||||
|
31
src/features/theming/theming.ts
Normal file
31
src/features/theming/theming.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import fs from "fs";
|
||||
import { settings } from "../../constants/settings";
|
||||
import { settingsStore } from "../../scripts/settings";
|
||||
import { Logger } from "../logger";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export function addCustomCss(app: any) {
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
const selectedTheme = settingsStore.get<string, string>(settings.theme);
|
||||
if (selectedTheme !== "none") {
|
||||
const userThemePath = `${app.getPath("userData")}/themes/${selectedTheme}`;
|
||||
const resourcesThemePath = `${process.resourcesPath}/${selectedTheme}`;
|
||||
const themeFile = fs.existsSync(userThemePath) ? userThemePath : resourcesThemePath;
|
||||
fs.readFile(themeFile, "utf-8", (err, data) => {
|
||||
if (err) {
|
||||
Logger.alert("An error ocurred reading the theme file.", err, alert);
|
||||
return;
|
||||
}
|
||||
|
||||
const themeStyle = document.createElement("style");
|
||||
themeStyle.innerHTML = data;
|
||||
document.head.appendChild(themeStyle);
|
||||
});
|
||||
}
|
||||
|
||||
// read customCSS (it will override the theme)
|
||||
const style = document.createElement("style");
|
||||
style.innerHTML = settingsStore.get<string, string[]>(settings.customCSS).join("\n");
|
||||
document.head.appendChild(style);
|
||||
});
|
||||
}
|
@@ -10,4 +10,5 @@ export interface MediaInfo {
|
||||
current: string;
|
||||
duration: string;
|
||||
image: string;
|
||||
favorite: boolean;
|
||||
}
|
||||
|
@@ -9,4 +9,5 @@ export interface Options {
|
||||
"app-name": string;
|
||||
image: string;
|
||||
icon: string;
|
||||
favorite: boolean;
|
||||
}
|
||||
|
@@ -4,9 +4,24 @@ import fs from "fs";
|
||||
import { globalEvents } from "../../constants/globalEvents";
|
||||
import { settings } from "../../constants/settings";
|
||||
import { Logger } from "../../features/logger";
|
||||
import { addCustomCss } from "../../features/theming/theming";
|
||||
import { settingsStore } from "./../../scripts/settings";
|
||||
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,
|
||||
api: HTMLInputElement,
|
||||
customCSS: HTMLInputElement,
|
||||
@@ -30,7 +45,13 @@ let adBlock: HTMLInputElement,
|
||||
enableListenBrainz: HTMLInputElement,
|
||||
ListenBrainzAPI: HTMLInputElement,
|
||||
ListenBrainzToken: HTMLInputElement,
|
||||
enableWaylandSupport: HTMLInputElement;
|
||||
listenbrainz_delay: HTMLInputElement,
|
||||
enableWaylandSupport: HTMLInputElement,
|
||||
discord_details_prefix: HTMLInputElement,
|
||||
discord_include_timestamps: HTMLInputElement,
|
||||
discord_button_text: HTMLInputElement;
|
||||
|
||||
addCustomCss(app);
|
||||
|
||||
function getThemeFiles() {
|
||||
const selectElement = document.getElementById("themesList") as HTMLSelectElement;
|
||||
@@ -59,6 +80,7 @@ function handleFileUploads() {
|
||||
const fileMessage = document.getElementById("file-message");
|
||||
fileMessage.innerText = "or drag and drop files here";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
document.getElementById("theme-files").addEventListener("change", function (e: any) {
|
||||
Array.from(e.target.files).forEach((file: File) => {
|
||||
const destination = `${app.getPath("userData")}/themes/${file.name}`;
|
||||
@@ -69,6 +91,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
|
||||
*/
|
||||
@@ -98,6 +134,15 @@ function refreshSettings() {
|
||||
enableListenBrainz.checked = settingsStore.get(settings.ListenBrainz.enabled);
|
||||
ListenBrainzAPI.value = settingsStore.get(settings.ListenBrainz.api);
|
||||
ListenBrainzToken.value = settingsStore.get(settings.ListenBrainz.token);
|
||||
listenbrainz_delay.value = settingsStore.get(settings.ListenBrainz.delay);
|
||||
discord_details_prefix.value = settingsStore.get(settings.discord.detailsPrefix);
|
||||
discord_include_timestamps.checked = settingsStore.get(settings.discord.includeTimestamps);
|
||||
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) {
|
||||
Logger.log("Refreshing settings failed.", error);
|
||||
}
|
||||
@@ -117,14 +162,6 @@ function hide() {
|
||||
ipcRenderer.send(globalEvents.hideSettings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restart TIDAL Hi-Fi after changes
|
||||
*/
|
||||
function restart() {
|
||||
app.relaunch();
|
||||
app.exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind UI components to functions after DOMContentLoaded
|
||||
*/
|
||||
@@ -137,25 +174,28 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
handleFileUploads();
|
||||
|
||||
document.getElementById("close").addEventListener("click", hide);
|
||||
document.getElementById("restart").addEventListener("click", restart);
|
||||
document.querySelectorAll(".external-link").forEach((elem) =>
|
||||
elem.addEventListener("click", function (event) {
|
||||
openExternal((event.target as HTMLElement).getAttribute("data-url"));
|
||||
})
|
||||
);
|
||||
|
||||
function addInputListener(source: HTMLInputElement, key: string) {
|
||||
function addInputListener(
|
||||
source: HTMLInputElement,
|
||||
key: string,
|
||||
toggleOptions?: { switch: string; classToHide: string }
|
||||
) {
|
||||
source.addEventListener("input", () => {
|
||||
if (source.value === "on") {
|
||||
settingsStore.set(key, source.checked);
|
||||
} else {
|
||||
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") {
|
||||
source.checked
|
||||
? document.getElementById("listenbrainz__options").removeAttribute("hidden")
|
||||
: document.getElementById("listenbrainz__options").setAttribute("hidden", "true");
|
||||
|
||||
if (toggleOptions) {
|
||||
if (source.value === "on" && source.id === toggleOptions.switch) {
|
||||
setElementHidden(source.checked, toggleOptions);
|
||||
}
|
||||
}
|
||||
ipcRenderer.send(globalEvents.storeChanged);
|
||||
});
|
||||
@@ -207,19 +247,19 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
enableListenBrainz = get("enableListenBrainz");
|
||||
ListenBrainzAPI = get("ListenBrainzAPI");
|
||||
ListenBrainzToken = get("ListenBrainzToken");
|
||||
discord_details_prefix = get("discord_details_prefix");
|
||||
discord_include_timestamps = get("discord_include_timestamps");
|
||||
listenbrainz_delay = get("listenbrainz_delay");
|
||||
discord_button_text = get("discord_button_text");
|
||||
|
||||
refreshSettings();
|
||||
enableListenBrainz.checked
|
||||
? document.getElementById("listenbrainz__options").removeAttribute("hidden")
|
||||
: document.getElementById("listenbrainz__options").setAttribute("hidden", "true");
|
||||
|
||||
addInputListener(adBlock, settings.adBlock);
|
||||
addInputListener(api, settings.api);
|
||||
addTextAreaListener(customCSS, settings.customCSS);
|
||||
addInputListener(disableBackgroundThrottle, settings.disableBackgroundThrottle);
|
||||
addInputListener(disableHardwareMediaKeys, settings.flags.disableHardwareMediaKeys);
|
||||
addInputListener(enableCustomHotkeys, settings.enableCustomHotkeys);
|
||||
addInputListener(enableDiscord, settings.enableDiscord);
|
||||
addInputListener(enableDiscord, settings.enableDiscord, switchesWithSettings.discord);
|
||||
addInputListener(enableWaylandSupport, settings.flags.enableWaylandSupport);
|
||||
addInputListener(gpuRasterization, settings.flags.gpuRasterization);
|
||||
addInputListener(menuBar, settings.menuBar);
|
||||
@@ -234,7 +274,15 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
addSelectListener(theme, settings.theme);
|
||||
addInputListener(trayIcon, settings.trayIcon);
|
||||
addInputListener(updateFrequency, settings.updateFrequency);
|
||||
addInputListener(enableListenBrainz, settings.ListenBrainz.enabled);
|
||||
addTextAreaListener(ListenBrainzAPI, settings.ListenBrainz.api);
|
||||
addTextAreaListener(ListenBrainzToken, settings.ListenBrainz.token);
|
||||
addInputListener(
|
||||
enableListenBrainz,
|
||||
settings.ListenBrainz.enabled,
|
||||
switchesWithSettings.listenBrainz
|
||||
);
|
||||
addInputListener(ListenBrainzAPI, settings.ListenBrainz.api);
|
||||
addInputListener(ListenBrainzToken, settings.ListenBrainz.token);
|
||||
addInputListener(listenbrainz_delay, settings.ListenBrainz.delay);
|
||||
addInputListener(discord_details_prefix, settings.discord.detailsPrefix);
|
||||
addInputListener(discord_include_timestamps, settings.discord.includeTimestamps);
|
||||
addInputListener(discord_button_text, settings.discord.buttonText);
|
||||
});
|
||||
|
@@ -7,6 +7,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
||||
<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>
|
||||
|
||||
<body class="settings-window">
|
||||
@@ -201,6 +202,9 @@
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="group">
|
||||
<p class="group__title">Discord</p>
|
||||
<div class="group__option">
|
||||
<div class="group__description">
|
||||
<h4>Discord RPC</h4>
|
||||
@@ -211,6 +215,34 @@
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div id="discord_options">
|
||||
<div class="group__option" class="hidden">
|
||||
<div class="group__description">
|
||||
<h4>Include timestamps</h4>
|
||||
<p>Show current/end playtime in the Discord client</p>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input id="discord_include_timestamps" type="checkbox" />
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<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 class="group">
|
||||
<p class="group__title">ListenBrainz</p>
|
||||
@@ -224,21 +256,27 @@
|
||||
<span class="switch__slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div id="listenbrainz__options" hidden="true">
|
||||
<div id="listenbrainz__options" class="hidden">
|
||||
<div class="group__option">
|
||||
<div class="group__description">
|
||||
<h4>ListenBrainz API Url</h4>
|
||||
<p>There are multiple instances for ListenBrainz you can set the corresponding API url below.</p>
|
||||
<input id="ListenBrainzAPI" type="text" class="text-input" name="ListenBrainzAPI" />
|
||||
</div>
|
||||
</div>
|
||||
<textarea id="ListenBrainzAPI" class="textarea" cols="1" rows="1" spellcheck="false"></textarea>
|
||||
<div class="group__option">
|
||||
<div class="group__description">
|
||||
<h4>ListenBrainz User Token</h4>
|
||||
<p>Provide the user token you can get from the settings page.</p>
|
||||
<input id="ListenBrainzToken" type="text" class="text-input" name="ListenBrainzToken" />
|
||||
</div>
|
||||
</div>
|
||||
<textarea id="ListenBrainzToken" class="textarea" cols="1" rows="1" spellcheck="false"></textarea>
|
||||
</div>
|
||||
<div class="group__description">
|
||||
<h4>ScrobbleDelay</h4>
|
||||
<p>The delay (in ms) to send a song to ListenBrainz. Prevents spamming the API when you fast forward
|
||||
immediately</p>
|
||||
<input id="listenbrainz_delay" type="number" class="text-input" name="listenbrainz_delay" />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -360,21 +398,24 @@
|
||||
|
||||
<section id="about-section" class="tabs__section about-section">
|
||||
<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>
|
||||
version of Electron for widevine support.
|
||||
</p>
|
||||
<h4>TIDAL Hi-Fi</h4>
|
||||
<div class="about-section__version">
|
||||
<a href="https://github.com/Mastermindzh/tidal-hifi/releases/tag/5.8.0">5.8.0</a>
|
||||
</div>
|
||||
<div class="about-section__links">
|
||||
<a href="https://github.com/mastermindzh/tidal-hifi/" class="about-section__button">Github <i
|
||||
class="fa fa-external-link"></i></a>
|
||||
<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>
|
||||
|
||||
<footer class="footer">
|
||||
<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>
|
||||
<button class="footer__button" id="restart">Restart TIDAL Hi-Fi</button>
|
||||
</footer>
|
||||
</div>
|
||||
</main>
|
||||
|
@@ -8,6 +8,7 @@ $tidal-grey: #72777f;
|
||||
$tidal-grey-darker: #404248;
|
||||
$tidal-grey-darker-focus: #55585f;
|
||||
$tidal-grey-darkest: #242528;
|
||||
$tidal-grey-darkest-focus: #2e2f33;
|
||||
|
||||
// --- Fonts ---
|
||||
|
||||
@@ -309,26 +310,79 @@ html {
|
||||
}
|
||||
|
||||
.about-section {
|
||||
padding-top: 120px;
|
||||
padding-top: 40px;
|
||||
text-align: center;
|
||||
|
||||
&__icon {
|
||||
display: inline-block;
|
||||
width: 100px;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
&__text {
|
||||
display: block;
|
||||
max-width: 350px;
|
||||
margin: 20px auto 0;
|
||||
max-width: 500px;
|
||||
margin: -15px auto 0;
|
||||
}
|
||||
|
||||
// --- Footer ---
|
||||
&__table {
|
||||
width: 120px;
|
||||
margin: 0 auto;
|
||||
|
||||
td {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
&__version {
|
||||
margin: -10px 0 30px;
|
||||
|
||||
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 {
|
||||
position: sticky;
|
||||
top: calc(100% - 120px);
|
||||
height: 100px;
|
||||
padding-top: 20px;
|
||||
text-align: center;
|
||||
@@ -368,10 +422,11 @@ html {
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
padding: 25px 0 25px 0px;
|
||||
padding: 25px 0;
|
||||
border: 1px dashed $tidal-grey;
|
||||
border-radius: 3px;
|
||||
transition: 0.2s;
|
||||
|
||||
&.is-active {
|
||||
background-color: $black;
|
||||
}
|
||||
@@ -409,6 +464,7 @@ html {
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
@@ -443,3 +499,7 @@ html {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
180
src/preload.ts
180
src/preload.ts
@@ -1,6 +1,5 @@
|
||||
import { app, dialog, Notification } from "@electron/remote";
|
||||
import { clipboard, ipcRenderer } from "electron";
|
||||
import fs from "fs";
|
||||
import Player from "mpris-service";
|
||||
import { globalEvents } from "./constants/globalEvents";
|
||||
import { settings } from "./constants/settings";
|
||||
@@ -12,6 +11,7 @@ import {
|
||||
import { StoreData } from "./features/listenbrainz/models/storeData";
|
||||
import { Logger } from "./features/logger";
|
||||
import { Songwhip } from "./features/songwhip/songwhip";
|
||||
import { addCustomCss } from "./features/theming/theming";
|
||||
import { MediaStatus } from "./models/mediaStatus";
|
||||
import { Options } from "./models/options";
|
||||
import { downloadFile } from "./scripts/download";
|
||||
@@ -24,6 +24,8 @@ const appName = "TIDAL Hi-Fi";
|
||||
let currentSong = "";
|
||||
let player: Player;
|
||||
let currentPlayStatus = MediaStatus.paused;
|
||||
let currentListenBrainzDelayId: ReturnType<typeof setTimeout>;
|
||||
let scrobbleWaitingForDelay = false;
|
||||
|
||||
const elements = {
|
||||
play: '*[data-test="play"]',
|
||||
@@ -43,7 +45,7 @@ const elements = {
|
||||
media: '*[data-test="current-media-imagery"]',
|
||||
image: "img",
|
||||
current: '*[data-test="current-time"]',
|
||||
duration: '*[data-test="duration"]',
|
||||
duration: '*[class^=playbackControlsContainer] *[data-test="duration"]',
|
||||
bar: '*[data-test="progress-bar"]',
|
||||
footer: "#footerPlayer",
|
||||
mediaItem: "[data-type='mediaItem']",
|
||||
@@ -52,6 +54,7 @@ const elements = {
|
||||
album_name_cell: '[class^="album"]',
|
||||
tracklist_row: '[data-test="tracklist-row"]',
|
||||
volume: '*[data-test="volume"]',
|
||||
favorite: '*[data-test="footer-favorite-button"]',
|
||||
/**
|
||||
* Get an element from the dom
|
||||
* @param {*} key key in elements object to fetch
|
||||
@@ -129,6 +132,10 @@ const elements = {
|
||||
return this.get("volume").getAttribute("aria-checked") === "false"; // it's muted if aria-checked is false
|
||||
},
|
||||
|
||||
isFavorite: function () {
|
||||
return this.get("favorite").getAttribute("aria-checked") === "true";
|
||||
},
|
||||
|
||||
/**
|
||||
* Shorthand function to get the text of a dom element
|
||||
* @param {*} key key in elements object to fetch
|
||||
@@ -156,32 +163,6 @@ const elements = {
|
||||
},
|
||||
};
|
||||
|
||||
function addCustomCss() {
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
const selectedTheme = settingsStore.get<string, string>(settings.theme);
|
||||
if (selectedTheme !== "none") {
|
||||
const userThemePath = `${app.getPath("userData")}/themes/${selectedTheme}`;
|
||||
const resourcesThemePath = `${process.resourcesPath}/${selectedTheme}`;
|
||||
const themeFile = fs.existsSync(userThemePath) ? userThemePath : resourcesThemePath;
|
||||
fs.readFile(themeFile, "utf-8", (err, data) => {
|
||||
if (err) {
|
||||
Logger.alert("An error ocurred reading the theme file.", err, alert);
|
||||
return;
|
||||
}
|
||||
|
||||
const themeStyle = document.createElement("style");
|
||||
themeStyle.innerHTML = data;
|
||||
document.head.appendChild(themeStyle);
|
||||
});
|
||||
}
|
||||
|
||||
// read customCSS (it will override the theme)
|
||||
const style = document.createElement("style");
|
||||
style.innerHTML = settingsStore.get<string, string[]>(settings.customCSS).join("\n");
|
||||
document.head.appendChild(style);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the update frequency from the store
|
||||
* make sure it returns a number, if not use the default
|
||||
@@ -232,6 +213,10 @@ function addHotKeys() {
|
||||
handleLogout();
|
||||
});
|
||||
|
||||
addHotkey("Control+a", function () {
|
||||
elements.click("favorite");
|
||||
});
|
||||
|
||||
addHotkey("Control+h", function () {
|
||||
elements.click("home");
|
||||
});
|
||||
@@ -330,6 +315,9 @@ function addIPCEventListeners() {
|
||||
case globalEvents.pause:
|
||||
elements.click("pause");
|
||||
break;
|
||||
case globalEvents.toggleFavorite:
|
||||
elements.click("favorite");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -378,6 +366,60 @@ function updateMediaInfo(options: Options, notify: boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
function addMPRIS() {
|
||||
if (process.platform === "linux" && settingsStore.get(settings.mpris)) {
|
||||
try {
|
||||
player = Player({
|
||||
name: "tidal-hifi",
|
||||
identity: "tidal-hifi",
|
||||
supportedUriSchemes: ["file"],
|
||||
supportedMimeTypes: [
|
||||
"audio/mpeg",
|
||||
"audio/flac",
|
||||
"audio/x-flac",
|
||||
"application/ogg",
|
||||
"audio/wav",
|
||||
],
|
||||
supportedInterfaces: ["player"],
|
||||
desktopEntry: "tidal-hifi",
|
||||
});
|
||||
// Events
|
||||
const events = {
|
||||
next: "next",
|
||||
previous: "previous",
|
||||
pause: "pause",
|
||||
playpause: "playpause",
|
||||
stop: "stop",
|
||||
play: "play",
|
||||
loopStatus: "repeat",
|
||||
shuffle: "shuffle",
|
||||
seek: "seek",
|
||||
} as { [key: string]: string };
|
||||
Object.keys(events).forEach(function (eventName) {
|
||||
player.on(eventName, function () {
|
||||
const eventValue = events[eventName];
|
||||
switch (events[eventValue]) {
|
||||
case events.playpause:
|
||||
playPause();
|
||||
break;
|
||||
default:
|
||||
elements.click(eventValue);
|
||||
}
|
||||
});
|
||||
});
|
||||
// Override get position function
|
||||
player.getPosition = function () {
|
||||
return convertDuration(elements.getText("current")) * 1000 * 1000;
|
||||
};
|
||||
player.on("quit", function () {
|
||||
app.quit();
|
||||
});
|
||||
} catch (exception) {
|
||||
Logger.log("MPRIS player api not working", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateMpris(options: Options) {
|
||||
if (player) {
|
||||
player.metadata = {
|
||||
@@ -395,6 +437,9 @@ function updateMpris(options: Options) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the listenbrainz service with new data based on a few conditions
|
||||
*/
|
||||
function updateListenBrainz(options: Options) {
|
||||
if (settingsStore.get(settings.ListenBrainz.enabled)) {
|
||||
const oldData = ListenBrainzStore.get(ListenBrainzConstants.oldData) as StoreData;
|
||||
@@ -402,12 +447,22 @@ function updateListenBrainz(options: Options) {
|
||||
(!oldData && options.status === MediaStatus.playing) ||
|
||||
(oldData && oldData.title !== options.title)
|
||||
) {
|
||||
ListenBrainz.scrobble(
|
||||
options.title,
|
||||
options.artists,
|
||||
options.status,
|
||||
convertDuration(options.duration)
|
||||
);
|
||||
if (!scrobbleWaitingForDelay) {
|
||||
scrobbleWaitingForDelay = true;
|
||||
clearTimeout(currentListenBrainzDelayId);
|
||||
currentListenBrainzDelayId = setTimeout(
|
||||
() => {
|
||||
ListenBrainz.scrobble(
|
||||
options.title,
|
||||
options.artists,
|
||||
options.status,
|
||||
convertDuration(options.duration)
|
||||
);
|
||||
scrobbleWaitingForDelay = false;
|
||||
},
|
||||
settingsStore.get(settings.ListenBrainz.delay) ?? 0
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -473,6 +528,7 @@ setInterval(function () {
|
||||
"app-name": appName,
|
||||
image: "",
|
||||
icon: "",
|
||||
favorite: elements.isFavorite(),
|
||||
};
|
||||
|
||||
const titleOrArtistsChanged = currentSong !== songDashArtistTitle;
|
||||
@@ -528,60 +584,8 @@ setInterval(function () {
|
||||
}
|
||||
}, getUpdateFrequency());
|
||||
|
||||
if (process.platform === "linux" && settingsStore.get(settings.mpris)) {
|
||||
try {
|
||||
player = Player({
|
||||
name: "TIDAL Hi-Fi",
|
||||
identity: "TIDAL Hi-Fi",
|
||||
supportedUriSchemes: ["file"],
|
||||
supportedMimeTypes: [
|
||||
"audio/mpeg",
|
||||
"audio/flac",
|
||||
"audio/x-flac",
|
||||
"application/ogg",
|
||||
"audio/wav",
|
||||
],
|
||||
supportedInterfaces: ["player"],
|
||||
desktopEntry: "tidal-hifi",
|
||||
});
|
||||
// Events
|
||||
const events = {
|
||||
next: "next",
|
||||
previous: "previous",
|
||||
pause: "pause",
|
||||
playpause: "playpause",
|
||||
stop: "stop",
|
||||
play: "play",
|
||||
loopStatus: "repeat",
|
||||
shuffle: "shuffle",
|
||||
seek: "seek",
|
||||
} as { [key: string]: string };
|
||||
Object.keys(events).forEach(function (eventName) {
|
||||
player.on(eventName, function () {
|
||||
const eventValue = events[eventName];
|
||||
switch (events[eventValue]) {
|
||||
case events.playpause:
|
||||
playPause();
|
||||
break;
|
||||
|
||||
default:
|
||||
elements.click(eventValue);
|
||||
}
|
||||
});
|
||||
});
|
||||
// Override get position function
|
||||
player.getPosition = function () {
|
||||
return convertDuration(elements.getText("current")) * 1000 * 1000;
|
||||
};
|
||||
|
||||
player.on("quit", function () {
|
||||
app.quit();
|
||||
});
|
||||
} catch (exception) {
|
||||
console.log("player api not working");
|
||||
}
|
||||
}
|
||||
addCustomCss();
|
||||
addMPRIS();
|
||||
addCustomCss(app);
|
||||
addHotKeys();
|
||||
addIPCEventListeners();
|
||||
addFullScreenListeners();
|
||||
|
@@ -1,8 +1,11 @@
|
||||
import { Client } from "discord-rpc";
|
||||
import { app, ipcMain } from "electron";
|
||||
import { globalEvents } from "../constants/globalEvents";
|
||||
import { settings } from "../constants/settings";
|
||||
import { Logger } from "../features/logger";
|
||||
import { MediaStatus } from "../models/mediaStatus";
|
||||
import { mediaInfo } from "./mediaInfo";
|
||||
import { settingsStore } from "./settings";
|
||||
|
||||
const clientId = "833617820704440341";
|
||||
|
||||
@@ -15,7 +18,7 @@ function timeToSeconds(timeArray: string[]) {
|
||||
export let rpc: Client;
|
||||
|
||||
const observer = () => {
|
||||
if (mediaInfo.status == MediaStatus.paused && rpc) {
|
||||
if (mediaInfo.status === MediaStatus.paused && rpc) {
|
||||
rpc.setActivity(idleStatus);
|
||||
} else if (rpc) {
|
||||
const currentSeconds = timeToSeconds(mediaInfo.current.split(":"));
|
||||
@@ -23,30 +26,42 @@ const observer = () => {
|
||||
const date = new Date();
|
||||
const now = (date.getTime() / 1000) | 0;
|
||||
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";
|
||||
const includeTimestamps =
|
||||
settingsStore.get<string, boolean>(settings.discord.includeTimestamps) ?? true;
|
||||
|
||||
let activity = {
|
||||
...idleStatus,
|
||||
...{
|
||||
startTimestamp: includeTimestamps ? now : undefined,
|
||||
endTimestamp: includeTimestamps ? remaining : undefined,
|
||||
},
|
||||
};
|
||||
if (mediaInfo.url) {
|
||||
rpc.setActivity({
|
||||
...idleStatus,
|
||||
activity = {
|
||||
...activity,
|
||||
...{
|
||||
details: `Listening to ${mediaInfo.title}`,
|
||||
details: `${detailsPrefix}${mediaInfo.title}`,
|
||||
state: mediaInfo.artists ? mediaInfo.artists : "unknown artist(s)",
|
||||
startTimestamp: now,
|
||||
endTimestamp: remaining,
|
||||
largeImageKey: mediaInfo.image,
|
||||
largeImageText: mediaInfo.album ? mediaInfo.album : `${idleStatus.largeImageText}`,
|
||||
buttons: [{ label: "Play on Tidal", url: mediaInfo.url }],
|
||||
buttons: [{ label: buttonText, url: mediaInfo.url }],
|
||||
},
|
||||
});
|
||||
};
|
||||
} else {
|
||||
rpc.setActivity({
|
||||
...idleStatus,
|
||||
activity = {
|
||||
...activity,
|
||||
...{
|
||||
details: `Watching ${mediaInfo.title}`,
|
||||
state: mediaInfo.artists,
|
||||
startTimestamp: now,
|
||||
endTimestamp: remaining,
|
||||
},
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
rpc.setActivity(activity);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -70,7 +85,7 @@ export const initRPC = () => {
|
||||
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?");
|
||||
}
|
||||
);
|
||||
};
|
||||
|
@@ -40,6 +40,9 @@ export const startExpress = (mainWindow: BrowserWindow) => {
|
||||
|
||||
if (settingsStore.get(settings.playBackControl)) {
|
||||
expressApp.get("/play", (req, res) => handleGlobalEvent(res, globalEvents.play));
|
||||
expressApp.post("/favorite/toggle", (req, res) =>
|
||||
handleGlobalEvent(res, globalEvents.toggleFavorite)
|
||||
);
|
||||
expressApp.get("/pause", (req, res) => handleGlobalEvent(res, globalEvents.pause));
|
||||
expressApp.get("/next", (req, res) => handleGlobalEvent(res, globalEvents.next));
|
||||
expressApp.get("/previous", (req, res) => handleGlobalEvent(res, globalEvents.previous));
|
||||
|
@@ -11,6 +11,7 @@ export const mediaInfo = {
|
||||
current: "",
|
||||
duration: "",
|
||||
image: "tidal-hifi-icon",
|
||||
favorite: false,
|
||||
};
|
||||
|
||||
export const updateMediaInfo = (arg: MediaInfo) => {
|
||||
@@ -23,6 +24,7 @@ export const updateMediaInfo = (arg: MediaInfo) => {
|
||||
mediaInfo.current = propOrDefault(arg.current);
|
||||
mediaInfo.duration = propOrDefault(arg.duration);
|
||||
mediaInfo.image = propOrDefault(arg.image);
|
||||
mediaInfo.favorite = arg.favorite;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import Store from "electron-store";
|
||||
|
||||
import { settings } from "../constants/settings";
|
||||
import path from "path";
|
||||
import { BrowserWindow } from "electron";
|
||||
import path from "path";
|
||||
import { settings } from "../constants/settings";
|
||||
|
||||
let settingsWindow: BrowserWindow;
|
||||
|
||||
@@ -18,10 +18,16 @@ export const settingsStore = new Store({
|
||||
disableHardwareMediaKeys: false,
|
||||
enableCustomHotkeys: false,
|
||||
enableDiscord: false,
|
||||
discord: {
|
||||
detailsPrefix: "Listening to ",
|
||||
buttonText: "Play on Tidal",
|
||||
includeTimestamps: true,
|
||||
},
|
||||
ListenBrainz: {
|
||||
enabled: false,
|
||||
api: "https://api.listenbrainz.org",
|
||||
token: "",
|
||||
delay: 5000,
|
||||
},
|
||||
flags: {
|
||||
disableHardwareMediaKeys: false,
|
||||
@@ -49,6 +55,20 @@ export const settingsStore = new Store({
|
||||
migrationStore.get("disableHardwareMediaKeys") ?? false
|
||||
);
|
||||
},
|
||||
"5.7.0": (migrationStore) => {
|
||||
console.log("running migrations for 5.7.0");
|
||||
migrationStore.set(
|
||||
settings.ListenBrainz.delay,
|
||||
migrationStore.get(settings.ListenBrainz.delay) ?? 5000
|
||||
);
|
||||
},
|
||||
"5.8.0": (migrationStore) => {
|
||||
console.log("running migrations for 5.8.0");
|
||||
migrationStore.set(
|
||||
settings.discord.includeTimestamps,
|
||||
migrationStore.get(settings.discord.includeTimestamps) ?? true
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -59,8 +79,8 @@ const settingsModule = {
|
||||
|
||||
export const createSettingsWindow = function () {
|
||||
settingsWindow = new BrowserWindow({
|
||||
width: 700,
|
||||
height: 600,
|
||||
width: 650,
|
||||
height: 700,
|
||||
resizable: true,
|
||||
show: false,
|
||||
transparent: true,
|
||||
|
@@ -74,7 +74,7 @@ button.feedBell--kvAbD {
|
||||
.container--PFTHk {
|
||||
background-color: var(--right-queue-background);
|
||||
}
|
||||
.container--cl4MJ{
|
||||
.container--cl4MJ {
|
||||
background-color: var(--search-background);
|
||||
}
|
||||
.searchFieldHighlighted--Fitvs {
|
||||
@@ -83,3 +83,122 @@ button.feedBell--kvAbD {
|
||||
.searchField--EGBSq {
|
||||
background-color: var(--search-background);
|
||||
}
|
||||
|
||||
// Settings window styling
|
||||
|
||||
.settings-window {
|
||||
color: var(--sidebar-menu-playlist-text);
|
||||
}
|
||||
.settings-window__wrapper {
|
||||
background: var(--main-background);
|
||||
box-shadow: inset 0 0 2px 0 var(--main-feed-button-background);
|
||||
}
|
||||
|
||||
.settings-window__close-button:hover {
|
||||
background: var(--main-feed-button-background);
|
||||
}
|
||||
|
||||
.settings input:checked + label {
|
||||
border-bottom: 2px solid var(--player-control-active-button);
|
||||
color: var(--player-control-active-button);
|
||||
}
|
||||
|
||||
.tabs::-webkit-scrollbar-thumb {
|
||||
background-color: #404248;
|
||||
box-shadow: inset 0 0 10px 2px var(--search-background);
|
||||
}
|
||||
|
||||
.group {
|
||||
border-bottom: 1px solid #333;
|
||||
}
|
||||
|
||||
.group__description p {
|
||||
color: var(--sidebar-menu-top-text);
|
||||
}
|
||||
.group__description .text-input {
|
||||
border-bottom: solid 1px #333;
|
||||
color: var(--sidebar-menu-top-text);
|
||||
}
|
||||
.group__description .text-input:focus {
|
||||
border-color: var(--player-control-active-button);
|
||||
color: var(--sidebar-menu-playlist-text);
|
||||
}
|
||||
|
||||
.switch input:checked + .switch__slider {
|
||||
background-color: var(--player-control-active-button);
|
||||
}
|
||||
.switch input:checked + .switch__slider::before {
|
||||
background-color: var(--sidebar-menu-playlist-text);
|
||||
}
|
||||
.switch input:focus + .switch__slider {
|
||||
box-shadow: inset 0 0 0 1px var(--player-control-active-button);
|
||||
}
|
||||
.switch__slider {
|
||||
background-color: var(--search-background);
|
||||
}
|
||||
.switch__slider::before {
|
||||
background-color: var(--sidebar-menu-playlist-text);
|
||||
}
|
||||
|
||||
.textarea {
|
||||
background: var(--search-background);
|
||||
color: var(--sidebar-menu-top-text);
|
||||
}
|
||||
.textarea:focus {
|
||||
border-color: var(--player-control-active-button);
|
||||
color: var(--sidebar-menu-playlist-text);
|
||||
}
|
||||
|
||||
.about-section__version a {
|
||||
background-color: #404248;
|
||||
color: var(--player-control-active-button);
|
||||
}
|
||||
.about-section__links a {
|
||||
color: var(--sidebar-menu-playlist-text);
|
||||
|
||||
background-color: var(--search-background);
|
||||
}
|
||||
.about-section__links a i {
|
||||
color: var(--sidebar-menu-playlist-text);
|
||||
}
|
||||
.about-section__links a:hover {
|
||||
background-color: var(--player-control-favorite);
|
||||
}
|
||||
|
||||
.footer__note {
|
||||
color: var(--sidebar-menu-top-text);
|
||||
}
|
||||
.footer__button {
|
||||
background: #404248;
|
||||
color: var(--sidebar-menu-playlist-text);
|
||||
}
|
||||
.footer__button:hover {
|
||||
background: #55585f;
|
||||
}
|
||||
|
||||
.file-drop-area {
|
||||
border: 1px dashed var(--sidebar-menu-top-text);
|
||||
}
|
||||
.file-drop-area.is-active {
|
||||
background-color: #17171a;
|
||||
}
|
||||
|
||||
.file-btn {
|
||||
background-color: #17171a;
|
||||
border: 1px solid var(--sidebar-menu-top-text);
|
||||
}
|
||||
|
||||
.select-input {
|
||||
border-bottom: solid 1px #333;
|
||||
color: var(--sidebar-menu-top-text);
|
||||
}
|
||||
.select-input:focus {
|
||||
border-color: var(--player-control-active-button);
|
||||
color: var(--sidebar-menu-playlist-text);
|
||||
}
|
||||
.select-input option {
|
||||
background-color: var(--search-background);
|
||||
}
|
||||
.select-input option:disabled {
|
||||
color: var(--sidebar-menu-playlist-text);
|
||||
}
|
||||
|
Reference in New Issue
Block a user