Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "youtube-music-desktop-app",
"productName": "YouTube Music Desktop App",
"version": "2.0.10",
"version": "2.0.11",
"description": "YouTube Music Desktop App",
"main": ".vite/main/index.js",
"private": true,
Expand All @@ -25,48 +25,48 @@
},
"license": "GPL-3.0-only",
"devDependencies": {
"@electron-forge/cli": "~7.8.3",
"@electron-forge/maker-deb": "~7.8.3",
"@electron-forge/maker-rpm": "~7.8.3",
"@electron-forge/maker-squirrel": "~7.8.3",
"@electron-forge/maker-zip": "~7.8.3",
"@electron-forge/plugin-auto-unpack-natives": "~7.8.3",
"@electron-forge/plugin-fuses": "~7.8.3",
"@electron-forge/plugin-vite": "~7.8.3",
"@electron-forge/publisher-github": "~7.8.3",
"@electron/fuses": "^1.8.0",
"@electron-forge/cli": "~7.11.1",
"@electron-forge/maker-deb": "~7.11.1",
"@electron-forge/maker-rpm": "~7.11.1",
"@electron-forge/maker-squirrel": "~7.11.1",
"@electron-forge/maker-zip": "~7.11.1",
"@electron-forge/plugin-auto-unpack-natives": "~7.11.1",
"@electron-forge/plugin-fuses": "~7.11.1",
"@electron-forge/plugin-vite": "~7.11.1",
"@electron-forge/publisher-github": "~7.11.1",
"@electron/fuses": "^2.0.0",
"@types/electron-squirrel-startup": "^1.0.2",
"@types/node": "^22.15.30",
"@typescript-eslint/eslint-plugin": "^8.33.1",
"@typescript-eslint/parser": "^8.33.1",
"@types/node": "^22.19.11",
"@typescript-eslint/eslint-plugin": "^8.55.0",
"@typescript-eslint/parser": "^8.55.0",
"@vitejs/plugin-vue": "^5.2.4",
"electron": "^38.0.0",
"electron": "^40.4.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-config-prettier": "^9.1.2",
"eslint-import-resolver-typescript": "^3.10.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-vue": "^9.33.0",
"husky": "^9.1.7",
"lint-staged": "^15.5.2",
"prettier": "3.5.3",
"prettier": "3.8.1",
"ts-node": "^10.9.2",
"typescript": "~5.8.3",
"typescript": "~5.9.3",
"vite": "^5.4.21"
},
"dependencies": {
"@fastify/cors": "^11.0.1",
"@fastify/cors": "^11.2.0",
"@fastify/error": "^4.2.0",
"@fastify/rate-limit": "^10.3.0",
"@fastify/type-provider-typebox": "^5.1.0",
"@sinclair/typebox": "^0.34.33",
"@fastify/type-provider-typebox": "^5.2.0",
"@sinclair/typebox": "^0.34.48",
"conf": "^10.2.0",
"electron-log": "5.4.0",
"electron-log": "5.4.3",
"electron-squirrel-startup": "^1.0.1",
"fastify": "^5.3.3",
"fastify": "^5.7.4",
"fastify-socket.io": "^5.1.0",
"material-symbols": "^0.12.0",
"socket.io": "^4.8.1",
"vue": "^3.5.16"
"socket.io": "^4.8.3",
"vue": "^3.5.28"
},
"lint-staged": {
"*.{ts,tsx,vue}": [
Expand Down
12 changes: 6 additions & 6 deletions src/main/integrations/discord-presence/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,30 +73,30 @@ export default class DiscordPresence implements IIntegration {
this.discordClient.clearActivity();
return;
}
const { title, author, album, id, thumbnails, durationSeconds } = this.videoDetails;
const { title, author, album, id, thumbnails, durationSeconds, channelId, albumId } = this.videoDetails;
const thumbnail = getHighestResThumbnail(thumbnails);
this.discordClient.setActivity({
type: DiscordActivityType.Listening,
status_display_type: 1,
details: stringLimit(title, 128, 2),
details_url: `https://music.youtube.com/watch?v=${id}`,
state: stringLimit(author, 128, 2),
state_url: `https://music.youtube.com/channel/${channelId}`,
timestamps: {
start: this.videoState === VideoState.Playing ? Date.now() - this.progress * 1000 : undefined,
end: this.videoState === VideoState.Playing ? Date.now() + (durationSeconds - this.progress) * 1000 : undefined
},
assets: {
large_image: (thumbnail?.length ?? 0) <= 256 ? thumbnail : "ytmd-logo",
large_text: album ? stringLimit(album, 128, 2) : undefined,
large_url: albumId ? `https://music.youtube.com/browse/${albumId}` : undefined,
small_image: getSmallImageKey(this.videoState),
small_text: getSmallImageText(this.videoState)
},
instance: false,
buttons: [
{
label: "Play on YouTube Music",
url: `https://music.youtube.com/watch?v=${id}`
},
{
label: "Play on YouTube Music Desktop",
label: "Play on YTMDesktop",
url: `ytmd://play/${id}`
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,30 @@ export enum DiscordActivityType {
Competing = 5
}

export enum DiscordActivityStatusDisplayType {
Name = 0,
State = 1,
Details = 2
}

export type DiscordActivity = {
type?: DiscordActivityType;
status_display_type: DiscordActivityStatusDisplayType;
state?: string;
state_url?: string;
details?: string;
details_url?: string;
timestamps?: {
start?: number;
end?: number;
};
assets?: {
large_image?: string;
large_text?: string;
large_url?: string;
small_image?: string;
small_text?: string;
small_url?: string;
};
instance?: boolean;
buttons?: {
Expand Down
2 changes: 1 addition & 1 deletion src/main/player-state-store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function transformPlaylistPanelVideoRenderer(
counterpart?: YTMPlayerQueueItemCounterpart[]
): PlayerQueueItem {
return {
thumbnails: playlistPanelVideoRenderer.thumbnail.thumbnails.map(mapYTMThumbnails),
thumbnails: playlistPanelVideoRenderer.thumbnail ? playlistPanelVideoRenderer.thumbnail.thumbnails.map(mapYTMThumbnails) : [],
title: getYTMTextRun(playlistPanelVideoRenderer.title?.runs ?? [{ text: "" }]),
author: getYTMTextRun(playlistPanelVideoRenderer.shortBylineText?.runs ?? [{ text: "" }]),
duration: getYTMTextRun(playlistPanelVideoRenderer.lengthText?.runs ?? [{ text: "" }]),
Expand Down
61 changes: 18 additions & 43 deletions src/renderer/ytmview/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,28 +192,25 @@ function getYTMTextRun(runs: { text: string }[]) {
(
await webFrame.executeJavaScript(`
(function() {
let ytmdHookedObjects = [];

let decorate = null;
Object.defineProperty(Reflect, "decorate", {
set: (value) => {
decorate = value;
},
get: () => {
return (...args) => {
if (!window.__YTMD_HOOK__) {
let obj = args[1];
if (typeof obj === "object") {
ytmdHookedObjects.push(obj);
}
let fakeBaseClass = function() {
try {
if (!window.__YTMD_HOOK__) {
if (this.store && !!this.store.getState && !!this.store.dispatch && !!this.store.subscribe) {
let ytmdHook = {
ytmStore: this.store
};
Object.freeze(ytmdHook);
window.__YTMD_HOOK__ = ytmdHook;
}

return decorate(...args);
}
} catch {}
}
Object.defineProperty(window, "PolymerFakeBaseClassWithoutHtml", {
set: (value) => {},
get: () => {
return fakeBaseClass
}
});

window.__YTMD_HOOK_OBJS__ = ytmdHookedObjects;
})
})
`)
)();
Expand All @@ -232,30 +229,8 @@ window.addEventListener("load", async () => {
const hooked = (
await webFrame.executeJavaScript(`
(function() {
for (const hookedObj of window.__YTMD_HOOK_OBJS__) {
if (hookedObj.is) {
if (hookedObj.is === "ytmusic-app") {
if (hookedObj.provide) {
for (const provider of hookedObj.provide) {
if (provider.useValue) {
if (provider.useValue.store) {
let ytmdHook = {
ytmStore: provider.useValue.store
};
Object.freeze(ytmdHook);
window.__YTMD_HOOK__ = ytmdHook;
break;
}
}
}
}

if (window.__YTMD_HOOK__) {
delete window.__YTMD_HOOK_OBJS__;
return true;
}
}
}
if (window.__YTMD_HOOK__) {
return true;
}

return false;
Expand Down
72 changes: 19 additions & 53 deletions src/renderer/ytmview/scripts/playerbarcontrols.script.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
}

const ytmStore = window.__YTMD_HOOK__.ytmStore;
const wizButtonShapeEnabled = true; // TODO: Remove this - 9/3/2025 YTM did a UI update and the experiment flag associated with this is gone as its now default enabled

let ytmdControlButtons = {};

Expand Down Expand Up @@ -66,15 +65,10 @@
toggleable: true,
type: "text"
};
if (wizButtonShapeEnabled) {
libraryButton.rawProps = {
iconName: "yt-sys-icons:library_add",
data: libraryButtonData
};
} else {
libraryButton.set("iconName", "yt-sys-icons:library_add");
libraryButton.set("data", libraryButtonData);
}
libraryButton.rawProps = {
iconName: "yt-sys-icons:library_add",
data: libraryButtonData
};
document
.querySelector("ytmusic-app-layout>ytmusic-player-bar")
.querySelector("ytmusic-like-button-renderer")
Expand Down Expand Up @@ -155,15 +149,10 @@
toggled: false,
type: "text"
};
if (wizButtonShapeEnabled) {
playlistButton.rawProps = {
iconName: "yt-sys-icons:playlist_add",
data: playlistButtonData
};
} else {
playlistButton.set("iconName", "yt-sys-icons:playlist_add");
playlistButton.set("data", playlistButtonData);
}
playlistButton.rawProps = {
iconName: "yt-sys-icons:playlist_add",
data: playlistButtonData
};
libraryButton.insertAdjacentElement("afterend", playlistButton);

document.querySelector("ytmusic-app-layout>ytmusic-player-bar").playerApi.addEventListener("onVideoDataChange", event => {
Expand Down Expand Up @@ -518,8 +507,8 @@
const item = currentMenu.items[i];
if (item.toggleMenuServiceItemRenderer) {
if (
item.toggleMenuServiceItemRenderer.defaultIcon.iconType === "LIBRARY_SAVED" ||
item.toggleMenuServiceItemRenderer.defaultIcon.iconType === "LIBRARY_ADD"
item.toggleMenuServiceItemRenderer.defaultIcon.iconType === "BOOKMARK_BORDER" ||
item.toggleMenuServiceItemRenderer.defaultIcon.iconType === "BOOKMARK"
) {
foundLibraryButton = true;
libraryFeedbackDefaultToken = item.toggleMenuServiceItemRenderer.defaultServiceEndpoint.feedbackEndpoint.feedbackToken;
Expand All @@ -530,49 +519,26 @@
state.toggleStates.feedbackToggleStates[libraryFeedbackDefaultToken] !== null
) {
libraryButtonData.toggled = state.toggleStates.feedbackToggleStates[libraryFeedbackDefaultToken];
if (wizButtonShapeEnabled) {
libraryButton.setters.data(libraryButtonData);
} else {
libraryButton.set("data.toggled", libraryButtonData.toggled);
}
libraryButton.setters.data(libraryButtonData);
} else {
libraryButtonData.toggled = false;
if (wizButtonShapeEnabled) {
libraryButton.setters.data(libraryButtonData);
} else {
libraryButton.set("data.toggled", libraryButtonData.toggled);
}
libraryButton.setters.data(libraryButtonData);
}

if (item.toggleMenuServiceItemRenderer.defaultIcon.iconType === "LIBRARY_SAVED") {
// Dev note 2/12/26: I think this if check got reversed the comments are probably outdated. Didn't bother investigating further to update comments
if (item.toggleMenuServiceItemRenderer.defaultIcon.iconType === "BOOKMARK_BORDER") {
// Default value is saved to library (false == remove from library, true == add to library)
if (libraryButtonData.toggled) {
if (wizButtonShapeEnabled) {
libraryButton.setters.iconName("yt-sys-icons:library_add");
} else {
libraryButton.set("iconName", "yt-sys-icons:library_add");
}
libraryButton.setters.iconName("yt-sys-icons:library_saved");
} else {
if (wizButtonShapeEnabled) {
libraryButton.setters.iconName("yt-sys-icons:library_saved");
} else {
libraryButton.set("iconName", "yt-sys-icons:library_saved");
}
libraryButton.setters.iconName("yt-sys-icons:library_add");
}
} else if (item.toggleMenuServiceItemRenderer.defaultIcon.iconType === "LIBRARY_ADD") {
} else if (item.toggleMenuServiceItemRenderer.defaultIcon.iconType === "BOOKMARK") {
// Default value is add to library (false == add to library, true == remove from library)
if (libraryButtonData.toggled) {
if (wizButtonShapeEnabled) {
libraryButton.setters.iconName("yt-sys-icons:library_saved");
} else {
libraryButton.set("iconName", "yt-sys-icons:library_saved");
}
libraryButton.setters.iconName("yt-sys-icons:library_add");
} else {
if (wizButtonShapeEnabled) {
libraryButton.setters.iconName("yt-sys-icons:library_add");
} else {
libraryButton.set("iconName", "yt-sys-icons:library_add");
}
libraryButton.setters.iconName("yt-sys-icons:library_saved");
}
}
break;
Expand Down
Loading