Compare commits

..

No commits in common. "5bd28913daf2d24826edc5e010c28fa6f59d0a61" and "98f75418ebe3309a7cba740d479da39ca7b86cea" have entirely different histories.

18 changed files with 2413 additions and 1314 deletions

View File

@ -5,9 +5,6 @@
"extends": [ "extends": [
"stylelint-config-standard-scss" "stylelint-config-standard-scss"
], ],
"ignoreFiles": [
"src/themes/**.scss"
],
"rules": { "rules": {
"prettier/prettier": true, "prettier/prettier": true,
"scss/at-extend-no-missing-placeholder": null, "scss/at-extend-no-missing-placeholder": null,

View File

@ -4,22 +4,6 @@ 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.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] ## [5.7.1]
- Fixed mpris not being set up correctly due to capitalization of the instance name. - Fixed mpris not being set up correctly due to capitalization of the instance name.

View File

@ -1,7 +1,7 @@
appId: com.rickvanlieshout.tidal-hifi appId: com.rickvanlieshout.tidal-hifi
electronVersion: 28.1.1 electronVersion: 24.1.2
electronDownload: electronDownload:
version: 28.1.1+wvcus version: 24.1.2+wvcus
mirror: https://github.com/castlabs/electron-releases/releases/download/v mirror: https://github.com/castlabs/electron-releases/releases/download/v
snap: snap:
plugs: plugs:

3562
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,12 @@
{ {
"name": "tidal-hifi", "name": "tidal-hifi",
"version": "5.8.0", "version": "5.7.1",
"description": "Tidal on Electron with widevine(hifi) support", "description": "Tidal on Electron with widevine(hifi) support",
"main": "ts-dist/main.js", "main": "ts-dist/main.js",
"scripts": { "scripts": {
"start": "electron --inspect=0.0.0.0:5858 .", "start": "electron --inspect=0.0.0.0:5858 .",
"watchStart": "nodemon dist -x \"npm run start\"", "watchStart": "nodemon dist -x \"npm run start\"",
"compile": "tsc && npm run sass-and-copy", "compile": "tsc && npm run sass-and-copy",
"deps": "npm run watch",
"watch": "tsc-watch --onSuccess \"npm run sass-and-copy\"", "watch": "tsc-watch --onSuccess \"npm run sass-and-copy\"",
"copy-files": "copyfiles -u 1 --exclude './src/**/*.ts' --exclude './src/**/*.scss' \"./src/**/*\" ts-dist", "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", "copy-themes-dev": "copyfiles -u 1 \"./themes/*\" node_modules/electron/dist/resources",
@ -39,38 +38,38 @@
"homepage": "https://github.com/Mastermindzh/tidal-hifi", "homepage": "https://github.com/Mastermindzh/tidal-hifi",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@electron/remote": "^2.1.1", "@electron/remote": "^2.1.0",
"axios": "^1.6.5", "axios": "^1.6.4",
"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.13.3", "hotkeys-js": "^3.12.1",
"mpris-service": "^2.1.2", "mpris-service": "^2.1.2",
"request": "^2.88.2", "request": "^2.88.2",
"sass": "^1.69.7" "sass": "^1.69.5"
}, },
"devDependencies": { "devDependencies": {
"@mastermindzh/prettier-config": "^1.0.0", "@mastermindzh/prettier-config": "^1.0.0",
"@types/discord-rpc": "^4.0.8", "@types/discord-rpc": "^4.0.5",
"@types/express": "^4.17.21", "@types/express": "^4.17.17",
"@types/node": "^20.10.6", "@types/node": "^20.4.4",
"@types/request": "^2.48.12", "@types/request": "^2.48.8",
"@typescript-eslint/eslint-plugin": "^6.18.0", "@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.18.0", "@typescript-eslint/parser": "^6.1.0",
"copyfiles": "^2.4.1", "copyfiles": "^2.4.1",
"electron": "git+https://github.com/castlabs/electron-releases#v28.1.1+wvcus", "electron": "git+https://github.com/castlabs/electron-releases.git#v24.1.2+wvcus",
"electron-builder": "^24.9.1", "electron-builder": "^24.4.0",
"eslint": "^8.56.0", "eslint": "^8.45.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"markdown-toc": "^1.2.0", "markdown-toc": "^1.2.0",
"nodemon": "^3.0.2", "nodemon": "^3.0.1",
"prettier": "^3.1.1", "prettier": "^3.0.0",
"stylelint": "^16.1.0", "stylelint": "^15.10.2",
"stylelint-config-standard": "^36.0.0", "stylelint-config-standard": "^34.0.0",
"stylelint-config-standard-scss": "^13.0.0", "stylelint-config-standard-scss": "^10.0.0",
"stylelint-prettier": "^5.0.0", "stylelint-prettier": "^4.0.0",
"tsc-watch": "^6.0.4", "tsc-watch": "^6.0.4",
"typescript": "^5.3.3" "typescript": "^5.1.6"
}, },
"prettier": "@mastermindzh/prettier-config" "prettier": "@mastermindzh/prettier-config"
} }

View File

@ -16,12 +16,11 @@
search: '[class^="searchField"]', search: '[class^="searchField"]',
shuffle: '*[data-test="shuffle"]', shuffle: '*[data-test="shuffle"]',
repeat: '*[data-test="repeat"]', repeat: '*[data-test="repeat"]',
account: '*[class^="profileOptions"]', account: '*[data-test^="profile-image-button"]',
settings: '*[data-test^="open-settings"]',
media: '*[data-test="current-media-imagery"]', media: '*[data-test="current-media-imagery"]',
image: "img", image: "img",
current: '*[data-test="current-time"]', current: '*[data-test="current-time"]',
duration: '*[class^=playbackControlsContainer] *[data-test="duration"]', duration: '*[data-test="duration"]',
bar: '*[data-test="progress-bar"]', bar: '*[data-test="progress-bar"]',
footer: "#footerPlayer", footer: "#footerPlayer",
mediaItem: "[data-type='mediaItem']", mediaItem: "[data-type='mediaItem']",
@ -30,7 +29,6 @@
album_name_cell: '[class^="album"]', album_name_cell: '[class^="album"]',
tracklist_row: '[data-test="tracklist-row"]', tracklist_row: '[data-test="tracklist-row"]',
volume: '*[data-test="volume"]', volume: '*[data-test="volume"]',
favorite: '*[data-test="footer-favorite-button"]',
}; };
let results = []; let results = [];

View File

@ -12,5 +12,4 @@ export const globalEvents = {
error: "error", error: "error",
whip: "whip", whip: "whip",
log: "log", log: "log",
toggleFavorite: "toggleFavorite",
}; };

View File

@ -23,7 +23,6 @@ export const settings = {
discord: { discord: {
detailsPrefix: "discord.detailsPrefix", detailsPrefix: "discord.detailsPrefix",
buttonText: "discord.buttonText", buttonText: "discord.buttonText",
includeTimestamps: "discord.includeTimestamps",
}, },
ListenBrainz: { ListenBrainz: {
root: "ListenBrainz", root: "ListenBrainz",

View File

@ -10,5 +10,4 @@ export interface MediaInfo {
current: string; current: string;
duration: string; duration: string;
image: string; image: string;
favorite: boolean;
} }

View File

@ -9,5 +9,4 @@ export interface Options {
"app-name": string; "app-name": string;
image: string; image: string;
icon: string; icon: string;
favorite: boolean;
} }

View File

@ -48,7 +48,6 @@ let adBlock: HTMLInputElement,
listenbrainz_delay: HTMLInputElement, listenbrainz_delay: HTMLInputElement,
enableWaylandSupport: HTMLInputElement, enableWaylandSupport: HTMLInputElement,
discord_details_prefix: HTMLInputElement, discord_details_prefix: HTMLInputElement,
discord_include_timestamps: HTMLInputElement,
discord_button_text: HTMLInputElement; discord_button_text: HTMLInputElement;
addCustomCss(app); addCustomCss(app);
@ -136,7 +135,6 @@ function refreshSettings() {
ListenBrainzToken.value = settingsStore.get(settings.ListenBrainz.token); ListenBrainzToken.value = settingsStore.get(settings.ListenBrainz.token);
listenbrainz_delay.value = settingsStore.get(settings.ListenBrainz.delay); listenbrainz_delay.value = settingsStore.get(settings.ListenBrainz.delay);
discord_details_prefix.value = settingsStore.get(settings.discord.detailsPrefix); 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); discord_button_text.value = settingsStore.get(settings.discord.buttonText);
// set state of all switches with additional settings // set state of all switches with additional settings
@ -248,7 +246,6 @@ window.addEventListener("DOMContentLoaded", () => {
ListenBrainzAPI = get("ListenBrainzAPI"); ListenBrainzAPI = get("ListenBrainzAPI");
ListenBrainzToken = get("ListenBrainzToken"); ListenBrainzToken = get("ListenBrainzToken");
discord_details_prefix = get("discord_details_prefix"); discord_details_prefix = get("discord_details_prefix");
discord_include_timestamps = get("discord_include_timestamps");
listenbrainz_delay = get("listenbrainz_delay"); listenbrainz_delay = get("listenbrainz_delay");
discord_button_text = get("discord_button_text"); discord_button_text = get("discord_button_text");
@ -283,6 +280,5 @@ window.addEventListener("DOMContentLoaded", () => {
addInputListener(ListenBrainzToken, settings.ListenBrainz.token); addInputListener(ListenBrainzToken, settings.ListenBrainz.token);
addInputListener(listenbrainz_delay, settings.ListenBrainz.delay); addInputListener(listenbrainz_delay, settings.ListenBrainz.delay);
addInputListener(discord_details_prefix, settings.discord.detailsPrefix); addInputListener(discord_details_prefix, settings.discord.detailsPrefix);
addInputListener(discord_include_timestamps, settings.discord.includeTimestamps);
addInputListener(discord_button_text, settings.discord.buttonText); addInputListener(discord_button_text, settings.discord.buttonText);
}); });

View File

@ -216,17 +216,6 @@
</label> </label>
</div> </div>
<div id="discord_options"> <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__option" class="hidden">
<div class="group__description"> <div class="group__description">
<h4>Details prefix</h4> <h4>Details prefix</h4>
@ -400,7 +389,7 @@
<img alt="tidal icon" class="about-section__icon" src="./icon.png" /> <img alt="tidal icon" class="about-section__icon" src="./icon.png" />
<h4>TIDAL Hi-Fi</h4> <h4>TIDAL Hi-Fi</h4>
<div class="about-section__version"> <div class="about-section__version">
<a href="https://github.com/Mastermindzh/tidal-hifi/releases/tag/5.8.0">5.8.0</a> <a href="">5.7.1</a>
</div> </div>
<div class="about-section__links"> <div class="about-section__links">
<a href="https://github.com/mastermindzh/tidal-hifi/" class="about-section__button">Github <i <a href="https://github.com/mastermindzh/tidal-hifi/" class="about-section__button">Github <i
@ -422,4 +411,4 @@
</div> </div>
</body> </body>
</html> </html>

View File

@ -323,19 +323,16 @@ html {
max-width: 500px; max-width: 500px;
margin: -15px auto 0; margin: -15px auto 0;
} }
&__table { &__table {
width: 120px; width: 120px;
margin: 0 auto; margin: 0 auto 0;
td { td {
text-align: left; text-align: left;
} }
} }
&__version { &__version {
margin: -10px 0 30px; margin: -10px 0px 30px 0px;
a { a {
background-color: $tidal-grey-darker; background-color: $tidal-grey-darker;
border: none; border: none;
@ -352,7 +349,6 @@ html {
&__links { &__links {
width: 300px; width: 300px;
margin: 0 auto; margin: 0 auto;
a { a {
border-radius: 10px; border-radius: 10px;
border: none; border: none;
@ -422,11 +418,10 @@ html {
align-items: center; align-items: center;
width: 100%; width: 100%;
max-width: 100%; max-width: 100%;
padding: 25px 0; padding: 25px 0 25px 0px;
border: 1px dashed $tidal-grey; border: 1px dashed $tidal-grey;
border-radius: 3px; border-radius: 3px;
transition: 0.2s; transition: 0.2s;
&.is-active { &.is-active {
background-color: $black; background-color: $black;
} }
@ -464,7 +459,6 @@ html {
width: 100%; width: 100%;
cursor: pointer; cursor: pointer;
opacity: 0; opacity: 0;
&:focus { &:focus {
outline: none; outline: none;
} }

View File

@ -45,7 +45,7 @@ const elements = {
media: '*[data-test="current-media-imagery"]', media: '*[data-test="current-media-imagery"]',
image: "img", image: "img",
current: '*[data-test="current-time"]', current: '*[data-test="current-time"]',
duration: '*[class^=playbackControlsContainer] *[data-test="duration"]', duration: '*[data-test="duration"]',
bar: '*[data-test="progress-bar"]', bar: '*[data-test="progress-bar"]',
footer: "#footerPlayer", footer: "#footerPlayer",
mediaItem: "[data-type='mediaItem']", mediaItem: "[data-type='mediaItem']",
@ -54,7 +54,6 @@ const elements = {
album_name_cell: '[class^="album"]', album_name_cell: '[class^="album"]',
tracklist_row: '[data-test="tracklist-row"]', tracklist_row: '[data-test="tracklist-row"]',
volume: '*[data-test="volume"]', volume: '*[data-test="volume"]',
favorite: '*[data-test="footer-favorite-button"]',
/** /**
* Get an element from the dom * Get an element from the dom
* @param {*} key key in elements object to fetch * @param {*} key key in elements object to fetch
@ -132,10 +131,6 @@ const elements = {
return this.get("volume").getAttribute("aria-checked") === "false"; // it's muted if aria-checked is false 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 * Shorthand function to get the text of a dom element
* @param {*} key key in elements object to fetch * @param {*} key key in elements object to fetch
@ -213,10 +208,6 @@ function addHotKeys() {
handleLogout(); handleLogout();
}); });
addHotkey("Control+a", function () {
elements.click("favorite");
});
addHotkey("Control+h", function () { addHotkey("Control+h", function () {
elements.click("home"); elements.click("home");
}); });
@ -315,9 +306,6 @@ function addIPCEventListeners() {
case globalEvents.pause: case globalEvents.pause:
elements.click("pause"); elements.click("pause");
break; break;
case globalEvents.toggleFavorite:
elements.click("favorite");
break;
default: default:
break; break;
} }
@ -528,7 +516,6 @@ setInterval(function () {
"app-name": appName, "app-name": appName,
image: "", image: "",
icon: "", icon: "",
favorite: elements.isFavorite(),
}; };
const titleOrArtistsChanged = currentSong !== songDashArtistTitle; const titleOrArtistsChanged = currentSong !== songDashArtistTitle;

View File

@ -30,38 +30,30 @@ const observer = () => {
settingsStore.get<string, string>(settings.discord.detailsPrefix) ?? "Listening to "; settingsStore.get<string, string>(settings.discord.detailsPrefix) ?? "Listening to ";
const buttonText = const buttonText =
settingsStore.get<string, string>(settings.discord.buttonText) ?? "Play on TIDAL"; 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) { if (mediaInfo.url) {
activity = { rpc.setActivity({
...activity, ...idleStatus,
...{ ...{
details: `${detailsPrefix}${mediaInfo.title}`, details: `${detailsPrefix}${mediaInfo.title}`,
state: mediaInfo.artists ? mediaInfo.artists : "unknown artist(s)", state: mediaInfo.artists ? mediaInfo.artists : "unknown artist(s)",
startTimestamp: now,
endTimestamp: remaining,
largeImageKey: mediaInfo.image, largeImageKey: mediaInfo.image,
largeImageText: mediaInfo.album ? mediaInfo.album : `${idleStatus.largeImageText}`, largeImageText: mediaInfo.album ? mediaInfo.album : `${idleStatus.largeImageText}`,
buttons: [{ label: buttonText, url: mediaInfo.url }], buttons: [{ label: buttonText, url: mediaInfo.url }],
}, },
}; });
} else { } else {
activity = { rpc.setActivity({
...activity, ...idleStatus,
...{ ...{
details: `Watching ${mediaInfo.title}`, details: `Watching ${mediaInfo.title}`,
state: mediaInfo.artists, state: mediaInfo.artists,
startTimestamp: now,
endTimestamp: remaining,
}, },
}; });
} }
rpc.setActivity(activity);
} }
}; };

View File

@ -40,9 +40,6 @@ export const startExpress = (mainWindow: BrowserWindow) => {
if (settingsStore.get(settings.playBackControl)) { if (settingsStore.get(settings.playBackControl)) {
expressApp.get("/play", (req, res) => handleGlobalEvent(res, globalEvents.play)); 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("/pause", (req, res) => handleGlobalEvent(res, globalEvents.pause));
expressApp.get("/next", (req, res) => handleGlobalEvent(res, globalEvents.next)); expressApp.get("/next", (req, res) => handleGlobalEvent(res, globalEvents.next));
expressApp.get("/previous", (req, res) => handleGlobalEvent(res, globalEvents.previous)); expressApp.get("/previous", (req, res) => handleGlobalEvent(res, globalEvents.previous));

View File

@ -11,7 +11,6 @@ export const mediaInfo = {
current: "", current: "",
duration: "", duration: "",
image: "tidal-hifi-icon", image: "tidal-hifi-icon",
favorite: false,
}; };
export const updateMediaInfo = (arg: MediaInfo) => { export const updateMediaInfo = (arg: MediaInfo) => {
@ -24,7 +23,6 @@ export const updateMediaInfo = (arg: MediaInfo) => {
mediaInfo.current = propOrDefault(arg.current); mediaInfo.current = propOrDefault(arg.current);
mediaInfo.duration = propOrDefault(arg.duration); mediaInfo.duration = propOrDefault(arg.duration);
mediaInfo.image = propOrDefault(arg.image); mediaInfo.image = propOrDefault(arg.image);
mediaInfo.favorite = arg.favorite;
}; };
/** /**

View File

@ -21,7 +21,6 @@ export const settingsStore = new Store({
discord: { discord: {
detailsPrefix: "Listening to ", detailsPrefix: "Listening to ",
buttonText: "Play on Tidal", buttonText: "Play on Tidal",
includeTimestamps: true,
}, },
ListenBrainz: { ListenBrainz: {
enabled: false, enabled: false,
@ -62,13 +61,6 @@ export const settingsStore = new Store({
migrationStore.get(settings.ListenBrainz.delay) ?? 5000 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
);
},
}, },
}); });