Merge branch 'local-upstream/master' into use-ToastXML

This commit is contained in:
Araxeus
2023-02-17 18:02:30 +02:00
17 changed files with 287 additions and 151 deletions

View File

@ -46,6 +46,7 @@ const defaultConfig = {
}, },
discord: { discord: {
enabled: false, enabled: false,
autoReconnect: true, // if enabled, will try to reconnect to discord every 5 seconds after disconnecting or failing to connect
activityTimoutEnabled: true, // if enabled, the discord rich presence gets cleared when music paused after the time specified below activityTimoutEnabled: true, // if enabled, the discord rich presence gets cleared when music paused after the time specified below
activityTimoutTime: 10 * 60 * 1000, // 10 minutes activityTimoutTime: 10 * 60 * 1000, // 10 minutes
listenAlong: true, // add a "listen along" button to rich presence listenAlong: true, // add a "listen along" button to rich presence

View File

@ -492,13 +492,12 @@ function removeContentSecurityPolicy(
// Custom listener to tweak the content security policy // Custom listener to tweak the content security policy
session.webRequest.onHeadersReceived(function (details, callback) { session.webRequest.onHeadersReceived(function (details, callback) {
if ( details.responseHeaders ??= {}
!details.responseHeaders["content-security-policy-report-only"] &&
!details.responseHeaders["content-security-policy"] // Remove the content security policy
)
return callback({ cancel: false });
delete details.responseHeaders["content-security-policy-report-only"]; delete details.responseHeaders["content-security-policy-report-only"];
delete details.responseHeaders["content-security-policy"]; delete details.responseHeaders["content-security-policy"];
callback({ cancel: false, responseHeaders: details.responseHeaders }); callback({ cancel: false, responseHeaders: details.responseHeaders });
}); });

View File

@ -35,8 +35,20 @@
"!plugins/touchbar${/*}" "!plugins/touchbar${/*}"
], ],
"target": [ "target": [
"nsis", {
"portable" "target": "nsis",
"arch": [
"x64",
"arm64"
]
},
{
"target": "portable",
"arch": [
"x64",
"arm64"
]
}
] ]
}, },
"nsis": { "nsis": {
@ -91,13 +103,14 @@
}, },
"engines": { "engines": {
"node": ">=16.0.0", "node": ">=16.0.0",
"npm": "Please use yarn and not npm" "npm": "Please use yarn instead"
}, },
"dependencies": { "dependencies": {
"@cliqz/adblocker-electron": "^1.25.2", "@cliqz/adblocker-electron": "^1.25.2",
"@ffmpeg/core": "^0.11.0", "@ffmpeg/core": "^0.11.0",
"@ffmpeg/ffmpeg": "^0.11.6", "@ffmpeg/ffmpeg": "^0.11.6",
"@foobar404/wave": "^2.0.4", "@foobar404/wave": "^2.0.4",
"@xhayper/discord-rpc": "^1.0.15",
"async-mutex": "^0.4.0", "async-mutex": "^0.4.0",
"browser-id3-writer": "^4.4.0", "browser-id3-writer": "^4.4.0",
"butterchurn": "^2.6.7", "butterchurn": "^2.6.7",
@ -105,7 +118,6 @@
"chokidar": "^3.5.3", "chokidar": "^3.5.3",
"custom-electron-prompt": "^1.5.1", "custom-electron-prompt": "^1.5.1",
"custom-electron-titlebar": "^4.1.5", "custom-electron-titlebar": "^4.1.5",
"discord-rpc": "^4.0.1",
"electron-better-web-request": "^1.0.1", "electron-better-web-request": "^1.0.1",
"electron-debug": "^3.2.0", "electron-debug": "^3.2.0",
"electron-is": "^3.0.0", "electron-is": "^3.0.0",
@ -116,6 +128,8 @@
"filenamify": "^4.3.0", "filenamify": "^4.3.0",
"howler": "^2.2.3", "howler": "^2.2.3",
"html-to-text": "^9.0.3", "html-to-text": "^9.0.3",
"keyboardevent-from-electron-accelerator": "^2.0.0",
"keyboardevents-areequal": "^0.2.2",
"md5": "^2.3.0", "md5": "^2.3.0",
"mpris-service": "^2.1.2", "mpris-service": "^2.1.2",
"node-fetch": "^2.6.8", "node-fetch": "^2.6.8",
@ -137,11 +151,6 @@
"playwright": "^1.29.2", "playwright": "^1.29.2",
"xo": "^0.53.1" "xo": "^0.53.1"
}, },
"resolutions": {
"glob-parent": "5.1.2",
"minimist": "1.2.7",
"yargs-parser": "21.1.1"
},
"auto-changelog": { "auto-changelog": {
"hideCredit": true, "hideCredit": true,
"package": true, "package": true,

View File

@ -1,4 +1,4 @@
module.exports = () => { module.exports = () => {
// Preload adblocker to inject scripts/styles // Preload adblocker to inject scripts/styles
require("@cliqz/adblocker-electron-preload/dist/preload.cjs"); require("@cliqz/adblocker-electron-preload");
}; };

View File

@ -6,7 +6,7 @@ require("./fader");
let transitionAudio; // Howler audio used to fade out the current music let transitionAudio; // Howler audio used to fade out the current music
let firstVideo = true; let firstVideo = true;
let transitioning = false; let waitForTransition;
// Crossfade options that can be overridden in plugin options // Crossfade options that can be overridden in plugin options
let crossfadeOptions = { let crossfadeOptions = {
@ -109,10 +109,9 @@ const syncVideoWithTransitionAudio = async () => {
const onApiLoaded = () => { const onApiLoaded = () => {
watchVideoIDChanges(async (videoID) => { watchVideoIDChanges(async (videoID) => {
if (!transitioning) { await waitForTransition;
const url = await getStreamURL(videoID); const url = await getStreamURL(videoID);
await createAudioForCrossfade(url); await createAudioForCrossfade(url);
}
}); });
}; };
@ -121,7 +120,11 @@ const crossfade = (cb) => {
cb(); cb();
return; return;
} }
transitioning = true;
let resolveTransition;
waitForTransition = new Promise(function (resolve, reject) {
resolveTransition = resolve;
});
const video = document.querySelector("video"); const video = document.querySelector("video");
@ -134,7 +137,7 @@ const crossfade = (cb) => {
// Fade out the music // Fade out the music
video.volume = 0; video.volume = 0;
fader.fadeOut(() => { fader.fadeOut(() => {
transitioning = false; resolveTransition();
cb(); cb();
}); });
}; };

View File

@ -1,4 +1,5 @@
const Discord = require("discord-rpc"); "use strict";
const Discord = require("@xhayper/discord-rpc");
const { dev } = require("electron-is"); const { dev } = require("electron-is");
const { dialog, app } = require("electron"); const { dialog, app } = require("electron");
@ -9,58 +10,81 @@ const clientId = "1043858434585526382";
/** /**
* @typedef {Object} Info * @typedef {Object} Info
* @property {import('discord-rpc').Client} rpc * @property {import('@xhayper/discord-rpc').Client} rpc
* @property {boolean} ready * @property {boolean} ready
* @property {boolean} autoReconnect
* @property {import('../../providers/song-info').SongInfo} lastSongInfo * @property {import('../../providers/song-info').SongInfo} lastSongInfo
*/ */
/** /**
* @type {Info} * @type {Info}
*/ */
const info = { const info = {
rpc: null, rpc: new Discord.Client({
clientId
}),
ready: false, ready: false,
autoReconnect: true,
lastSongInfo: null, lastSongInfo: null,
}; };
/** /**
* @type {(() => void)[]} * @type {(() => void)[]}
*/ */
const refreshCallbacks = []; const refreshCallbacks = [];
const resetInfo = () => { const resetInfo = () => {
info.rpc = null;
info.ready = false; info.ready = false;
clearTimeout(clearActivity); clearTimeout(clearActivity);
if (dev()) console.log("discord disconnected"); if (dev()) console.log("discord disconnected");
refreshCallbacks.forEach(cb => cb()); refreshCallbacks.forEach(cb => cb());
}; };
info.rpc.on("connected", () => {
if (dev()) console.log("discord connected");
refreshCallbacks.forEach(cb => cb());
});
info.rpc.on("ready", () => {
info.ready = true;
if (info.lastSongInfo) updateActivity(info.lastSongInfo)
});
info.rpc.on("disconnected", () => {
resetInfo();
if (info.autoReconnect) {
connectTimeout();
}
});
const connectTimeout = () => new Promise((resolve, reject) => setTimeout(() => {
if (!info.autoReconnect || info.rpc.isConnected) return;
info.rpc.login().then(resolve).catch(reject);
}, 5000));
const connectRecursive = () => {
if (!info.autoReconnect || info.rpc.isConnected) return;
connectTimeout().catch(connectRecursive);
}
let window; let window;
const connect = (showErr = false) => { const connect = (showErr = false) => {
if (info.rpc) { if (info.rpc.isConnected) {
if (dev()) if (dev())
console.log('Attempted to connect with active RPC object'); console.log('Attempted to connect with active connection');
return; return;
} }
info.rpc = new Discord.Client({
transport: "ipc",
});
info.ready = false; info.ready = false;
info.rpc.once("connected", () => {
if (dev()) console.log("discord connected");
refreshCallbacks.forEach(cb => cb());
});
info.rpc.once("ready", () => {
info.ready = true;
if (info.lastSongInfo) updateActivity(info.lastSongInfo)
});
info.rpc.once("disconnected", resetInfo);
// Startup the rpc client // Startup the rpc client
info.rpc.login({ clientId }).catch(err => { info.rpc.login({ clientId }).catch(err => {
resetInfo(); resetInfo();
if (dev()) console.error(err); if (dev()) console.error(err);
if (showErr) dialog.showMessageBox(window, { title: 'Connection failed', message: err.message || String(err), type: 'error' }); if (info.autoReconnect) {
connectRecursive();
}
else if (showErr) dialog.showMessageBox(window, { title: 'Connection failed', message: err.message || String(err), type: 'error' });
}); });
}; };
@ -70,7 +94,9 @@ let clearActivity;
*/ */
let updateActivity; let updateActivity;
module.exports = (win, { activityTimoutEnabled, activityTimoutTime, listenAlong, hideDurationLeft }) => { module.exports = (win, { autoReconnect, activityTimoutEnabled, activityTimoutTime, listenAlong, hideDurationLeft }) => {
info.autoReconnect = autoReconnect;
window = win; window = win;
// We get multiple events // We get multiple events
// Next song: PAUSE(n), PAUSE(n+1), PLAY(n+1) // Next song: PAUSE(n), PAUSE(n+1), PLAY(n+1)
@ -92,7 +118,7 @@ module.exports = (win, { activityTimoutEnabled, activityTimoutTime, listenAlong,
// clear directly if timeout is 0 // clear directly if timeout is 0
if (songInfo.isPaused && activityTimoutEnabled && activityTimoutTime === 0) { if (songInfo.isPaused && activityTimoutEnabled && activityTimoutTime === 0) {
info.rpc.clearActivity().catch(console.error); info.rpc.user?.clearActivity().catch(console.error);
return; return;
} }
@ -100,7 +126,6 @@ module.exports = (win, { activityTimoutEnabled, activityTimoutTime, listenAlong,
// @see https://discord.com/developers/docs/topics/gateway#activity-object // @see https://discord.com/developers/docs/topics/gateway#activity-object
// not all options are transfered through https://github.com/discordjs/RPC/blob/6f83d8d812c87cb7ae22064acd132600407d7d05/src/client.js#L518-530 // not all options are transfered through https://github.com/discordjs/RPC/blob/6f83d8d812c87cb7ae22064acd132600407d7d05/src/client.js#L518-530
const activityInfo = { const activityInfo = {
type: 2, // Listening, addressed in https://github.com/discordjs/RPC/pull/149
details: songInfo.title, details: songInfo.title,
state: songInfo.artist, state: songInfo.artist,
largeImageKey: songInfo.imageSrc, largeImageKey: songInfo.imageSrc,
@ -116,7 +141,7 @@ module.exports = (win, { activityTimoutEnabled, activityTimoutTime, listenAlong,
activityInfo.smallImageText = "Paused"; activityInfo.smallImageText = "Paused";
// Set start the timer so the activity gets cleared after a while if enabled // Set start the timer so the activity gets cleared after a while if enabled
if (activityTimoutEnabled) if (activityTimoutEnabled)
clearActivity = setTimeout(() => info.rpc.clearActivity().catch(console.error), activityTimoutTime ?? 10000); clearActivity = setTimeout(() => info.rpc.user?.clearActivity().catch(console.error), activityTimoutTime ?? 10000);
} else if (!hideDurationLeft) { } else if (!hideDurationLeft) {
// Add the start and end time of the song // Add the start and end time of the song
const songStartTime = Date.now() - songInfo.elapsedSeconds * 1000; const songStartTime = Date.now() - songInfo.elapsedSeconds * 1000;
@ -125,7 +150,7 @@ module.exports = (win, { activityTimoutEnabled, activityTimoutTime, listenAlong,
songStartTime + songInfo.songDuration * 1000; songStartTime + songInfo.songDuration * 1000;
} }
info.rpc.setActivity(activityInfo).catch(console.error); info.rpc.user?.setActivity(activityInfo).catch(console.error);
}; };
// If the page is ready, register the callback // If the page is ready, register the callback
@ -137,9 +162,10 @@ module.exports = (win, { activityTimoutEnabled, activityTimoutTime, listenAlong,
}; };
module.exports.clear = () => { module.exports.clear = () => {
if (info.rpc) info.rpc.clearActivity(); if (info.rpc) info.rpc.user?.clearActivity();
clearTimeout(clearActivity); clearTimeout(clearActivity);
}; };
module.exports.connect = connect; module.exports.connect = connect;
module.exports.registerRefresh = (cb) => refreshCallbacks.push(cb); module.exports.registerRefresh = (cb) => refreshCallbacks.push(cb);
module.exports.isConnected = () => info.rpc !== null; module.exports.isConnected = () => info.rpc !== null;

View File

@ -18,6 +18,15 @@ module.exports = (win, options, refreshMenu) => {
enabled: !isConnected(), enabled: !isConnected(),
click: connect, click: connect,
}, },
{
label: "Auto reconnect",
type: "checkbox",
checked: options.autoReconnect,
click: (item) => {
options.autoReconnect = item.checked;
setMenuOptions('discord', options);
},
},
{ {
label: "Clear activity", label: "Clear activity",
click: clear, click: clear,

View File

@ -82,7 +82,7 @@ const downloadVideoToMP3 = async (
sendFeedback("Download: " + progress + "%", ratio); sendFeedback("Download: " + progress + "%", ratio);
}) })
.on("info", (info, format) => { .on("info", (info, format) => {
videoName = info.videoDetails.title.replace("|", "").toString("ascii"); videoName = info.videoDetails.title.replaceAll("|", "").toString("ascii");
if (is.dev()) { if (is.dev()) {
console.log( console.log(
"Downloading video - name:", "Downloading video - name:",

View File

@ -43,9 +43,18 @@ module.exports = (options) => {
setNavbarMargin(); setNavbarMargin();
const playPageObserver = new MutationObserver(setNavbarMargin); const playPageObserver = new MutationObserver(setNavbarMargin);
playPageObserver.observe($('ytmusic-app-layout'), { attributeFilter: ['player-page-open_', 'playerPageOpen_'] }) playPageObserver.observe($('ytmusic-app-layout'), { attributeFilter: ['player-page-open_', 'playerPageOpen_'] })
setupSearchOpenObserver();
}, { once: true, passive: true }) }, { once: true, passive: true })
}; };
function setupSearchOpenObserver() {
const searchOpenObserver = new MutationObserver(mutations => {
$('#nav-bar-background').style.webkitAppRegion =
mutations[0].target.opened ? 'no-drag' : 'drag';
});
searchOpenObserver.observe($('ytmusic-search-box'), { attributeFilter: ["opened"] })
}
function setNavbarMargin() { function setNavbarMargin() {
$('#nav-bar-background').style.right = $('#nav-bar-background').style.right =
$('ytmusic-app-layout').playerPageOpen_ ? $('ytmusic-app-layout').playerPageOpen_ ?

View File

@ -79,3 +79,15 @@ yt-page-navigation-progress,
.cet-menubar-menu-container .cet-action-item { .cet-menubar-menu-container .cet-action-item {
background-color: inherit background-color: inherit
} }
#nav-bar-background {
-webkit-app-region: drag;
}
ytmusic-nav-bar input,
ytmusic-nav-bar span,
ytmusic-nav-bar [role="button"],
ytmusic-nav-bar yt-icon,
tp-yt-iron-dropdown {
-webkit-app-region: no-drag;
}

View File

@ -1,37 +0,0 @@
const { Menu, app } = require("electron");
const { setApplicationMenu } = require("../../../menu");
module.exports = (win, options, setOptions, togglePip, isInPip) => {
if (isInPip) {
Menu.setApplicationMenu(Menu.buildFromTemplate([
{
label: "App",
submenu: [
{
label: "Exit Picture in Picture",
click: togglePip,
},
{
label: "Always on top",
type: "checkbox",
checked: options.alwaysOnTop,
click: (item) => {
setOptions({ alwaysOnTop: item.checked });
win.setAlwaysOnTop(item.checked);
},
},
{
label: "Restart",
click: () => {
app.relaunch();
app.quit();
},
},
{ role: "quit" },
],
},
]));
} else {
setApplicationMenu(win);
}
};

View File

@ -3,7 +3,7 @@ const path = require("path");
const { app, ipcMain } = require("electron"); const { app, ipcMain } = require("electron");
const electronLocalshortcut = require("electron-localshortcut"); const electronLocalshortcut = require("electron-localshortcut");
const { setOptions, isEnabled } = require("../../config/plugins"); const { setOptions } = require("../../config/plugins");
const { injectCSS } = require("../utils"); const { injectCSS } = require("../utils");
let isInPiP = false; let isInPiP = false;
@ -23,15 +23,6 @@ const setLocalOptions = (_options) => {
setOptions("picture-in-picture", _options); setOptions("picture-in-picture", _options);
} }
const adaptors = [];
const runAdaptors = () => adaptors.forEach(a => a());
if (isEnabled("in-app-menu")) {
let adaptor = require("./adaptors/in-app-menu");
adaptors.push(() => adaptor(win, options, setLocalOptions, togglePiP, isInPiP));
}
const togglePiP = async () => { const togglePiP = async () => {
isInPiP = !isInPiP; isInPiP = !isInPiP;
setLocalOptions({ isInPiP }); setLocalOptions({ isInPiP });
@ -50,7 +41,6 @@ const togglePiP = async () => {
win.setMaximizable(false); win.setMaximizable(false);
win.setFullScreenable(false); win.setFullScreenable(false);
runAdaptors();
win.webContents.send("pip-toggle", true); win.webContents.send("pip-toggle", true);
app.dock?.hide(); app.dock?.hide();
@ -66,7 +56,6 @@ const togglePiP = async () => {
win.setMaximizable(true); win.setMaximizable(true);
win.setFullScreenable(true); win.setFullScreenable(true);
runAdaptors();
win.webContents.send("pip-toggle", false); win.webContents.send("pip-toggle", false);
win.setVisibleOnAllWorkspaces(false); win.setVisibleOnAllWorkspaces(false);
@ -103,9 +92,6 @@ module.exports = (_win, _options) => {
ipcMain.on("picture-in-picture", async () => { ipcMain.on("picture-in-picture", async () => {
await togglePiP(); await togglePiP();
}); });
if (options.hotkey) {
electronLocalshortcut.register(win, options.hotkey, togglePiP);
}
}; };
module.exports.setOptions = setLocalOptions; module.exports.setOptions = setLocalOptions;

View File

@ -1,10 +1,14 @@
const { ipcRenderer } = require("electron"); const { ipcRenderer } = require("electron");
const { toKeyEvent } = require("keyboardevent-from-electron-accelerator");
const keyEventAreEqual = require("keyboardevents-areequal");
const { getSongMenu } = require("../../providers/dom-elements"); const { getSongMenu } = require("../../providers/dom-elements");
const { ElementFromFile, templatePath } = require("../utils"); const { ElementFromFile, templatePath } = require("../utils");
function $(selector) { return document.querySelector(selector); } function $(selector) { return document.querySelector(selector); }
let useNativePiP = false;
let menu = null; let menu = null;
const pipButton = ElementFromFile( const pipButton = ElementFromFile(
templatePath(__dirname, "picture-in-picture.html") templatePath(__dirname, "picture-in-picture.html")
@ -39,8 +43,24 @@ const observer = new MutationObserver(() => {
menu.prepend(pipButton); menu.prepend(pipButton);
}); });
global.togglePictureInPicture = () => { global.togglePictureInPicture = async () => {
if (useNativePiP) {
const isInPiP = document.pictureInPictureElement !== null;
const video = $("video");
const togglePiP = () =>
isInPiP
? document.exitPictureInPicture.call(document)
: video.requestPictureInPicture.call(video);
try {
await togglePiP();
$("#icon").click(); // Close the menu
return true;
} catch {}
}
ipcRenderer.send("picture-in-picture"); ipcRenderer.send("picture-in-picture");
return false;
}; };
const listenForToggle = () => { const listenForToggle = () => {
@ -54,9 +74,12 @@ const listenForToggle = () => {
const player = $('#player'); const player = $('#player');
const onPlayerDblClick = player.onDoubleClick_; const onPlayerDblClick = player.onDoubleClick_;
ipcRenderer.on('pip-toggle', (_, isPip) => { const titlebar = $(".cet-titlebar");
ipcRenderer.on("pip-toggle", (_, isPip) => {
if (isPip) { if (isPip) {
replaceButton(".exit-fullscreen-button", originalExitButton).onclick = () => togglePictureInPicture(); replaceButton(".exit-fullscreen-button", originalExitButton).onclick =
() => togglePictureInPicture();
player.onDoubleClick_ = () => {}; player.onDoubleClick_ = () => {};
expandMenu.onmouseleave = () => middleControls.click(); expandMenu.onmouseleave = () => middleControls.click();
if (!playerPage.playerPageOpen_) { if (!playerPage.playerPageOpen_) {
@ -64,25 +87,28 @@ const listenForToggle = () => {
} }
fullScreenButton.click(); fullScreenButton.click();
appLayout.classList.add("pip"); appLayout.classList.add("pip");
if (titlebar) titlebar.style.display = "none";
} else { } else {
$(".exit-fullscreen-button").replaceWith(originalExitButton); $(".exit-fullscreen-button").replaceWith(originalExitButton);
player.onDoubleClick_ = onPlayerDblClick; player.onDoubleClick_ = onPlayerDblClick;
expandMenu.onmouseleave = undefined; expandMenu.onmouseleave = undefined;
originalExitButton.click(); originalExitButton.click();
appLayout.classList.remove("pip"); appLayout.classList.remove("pip");
if (titlebar) titlebar.style.display = "flex";
} }
}); });
} }
function observeMenu(options) { function observeMenu(options) {
useNativePiP = options.useNativePiP;
document.addEventListener( document.addEventListener(
"apiLoaded", "apiLoaded",
() => { () => {
listenForToggle(); listenForToggle();
// remove native listeners
cloneButton(".player-minimize-button").onclick = () => { cloneButton(".player-minimize-button").onclick = async () => {
global.togglePictureInPicture(); await global.togglePictureInPicture();
setTimeout(() => $('#player').click()); setTimeout(() => $("#player").click());
}; };
// allows easily closing the menu by programmatically clicking outside of it // allows easily closing the menu by programmatically clicking outside of it
@ -97,4 +123,18 @@ function observeMenu(options) {
); );
} }
module.exports = observeMenu; module.exports = (options) => {
observeMenu(options);
if (options.hotkey) {
const hotkeyEvent = toKeyEvent(options.hotkey);
window.addEventListener("keydown", (event) => {
if (
keyEventAreEqual(event, hotkeyEvent) &&
!$("ytmusic-search-box").opened
) {
togglePictureInPicture();
}
});
}
};

View File

@ -56,5 +56,13 @@ module.exports = (win, options) => [
item.checked = !item.checked; item.checked = !item.checked;
} }
}, },
},
{
label: "Use native PiP",
type: "checkbox",
checked: options.useNativePiP,
click: (item) => {
setOptions({ useNativePiP: item.checked });
},
} }
]; ];

View File

@ -3,9 +3,9 @@ ytmusic-app-layout.pip ytmusic-player-bar svg,
ytmusic-app-layout.pip ytmusic-player-bar .time-info, ytmusic-app-layout.pip ytmusic-player-bar .time-info,
ytmusic-app-layout.pip ytmusic-player-bar yt-formatted-string, ytmusic-app-layout.pip ytmusic-player-bar yt-formatted-string,
ytmusic-app-layout.pip ytmusic-player-bar .yt-formatted-string { ytmusic-app-layout.pip ytmusic-player-bar .yt-formatted-string {
filter: drop-shadow(2px 4px 6px black); filter: drop-shadow(2px 4px 6px black);
color: white !important; color: white !important;
fill: white !important; fill: white !important;
} }
/* improve the style of the player bar expanding menu */ /* improve the style of the player bar expanding menu */
@ -20,6 +20,23 @@ ytmusic-app-layout.pip ytmusic-player-expanding-menu {
top: 22px !important; top: 22px !important;
} }
/* make player-bar not draggable if in-app-menu is enabled */
.cet-container ytmusic-app-layout.pip ytmusic-player-bar {
-webkit-app-region: no-drag !important;
}
/* make player draggable if in-app-menu is enabled */
.cet-container ytmusic-app-layout.pip #player {
-webkit-app-region: drag !important;
}
/* remove info, thumbnail and menu from player-bar */
ytmusic-app-layout.pip ytmusic-player-bar .content-info-wrapper,
ytmusic-app-layout.pip ytmusic-player-bar .thumbnail-image-wrapper,
ytmusic-app-layout.pip ytmusic-player-bar ytmusic-menu-renderer {
display: none !important;
}
/* disable the video-toggle button when in PiP mode */ /* disable the video-toggle button when in PiP mode */
ytmusic-app-layout.pip .video-switch-button { ytmusic-app-layout.pip .video-switch-button {
display: none !important; display: none !important;

121
yarn.lock
View File

@ -1190,6 +1190,17 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@xhayper/discord-rpc@npm:^1.0.15":
version: 1.0.15
resolution: "@xhayper/discord-rpc@npm:1.0.15"
dependencies:
axios: ^1.2.1
discord-api-types: ^0.37.24
ws: ^8.11.0
checksum: a592f20e524ab6ef9b58f5125cd5b30cfd040e5f74f78f935afd88c3bd251523dcf5f599586f5bb24cf7e157fe370711d6109dbfb47fc312bd8890cef6b6d4ea
languageName: node
linkType: hard
"abbrev@npm:^1.0.0": "abbrev@npm:^1.0.0":
version: 1.1.1 version: 1.1.1
resolution: "abbrev@npm:1.1.1" resolution: "abbrev@npm:1.1.1"
@ -1634,6 +1645,17 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"axios@npm:^1.2.1":
version: 1.3.2
resolution: "axios@npm:1.3.2"
dependencies:
follow-redirects: ^1.15.0
form-data: ^4.0.0
proxy-from-env: ^1.1.0
checksum: 9791af75a6df137b15ef45d13ad11eb357b3860d2496347ee18778db9d0abc2320362a4452f1e070e3160f1dbcc518fcefdc9e005be097e7db39acb22cf608e5
languageName: node
linkType: hard
"babel-runtime@npm:^6.26.0": "babel-runtime@npm:^6.26.0":
version: 6.26.0 version: 6.26.0
resolution: "babel-runtime@npm:6.26.0" resolution: "babel-runtime@npm:6.26.0"
@ -1674,7 +1696,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"bindings@npm:^1.2.1, bindings@npm:^1.3.0": "bindings@npm:^1.2.1":
version: 1.5.0 version: 1.5.0
resolution: "bindings@npm:1.5.0" resolution: "bindings@npm:1.5.0"
dependencies: dependencies:
@ -2683,17 +2705,10 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"discord-rpc@npm:^4.0.1": "discord-api-types@npm:^0.37.24":
version: 4.0.1 version: 0.37.33
resolution: "discord-rpc@npm:4.0.1" resolution: "discord-api-types@npm:0.37.33"
dependencies: checksum: d1e31106081ef79d3ea721b8991c5de155879e6d01c47a025b2c41e0496b551608e72e383caf23680938219099b6c3bd43cbacf48edeb7fc9a3c1730c1811ba8
node-fetch: ^2.6.1
register-scheme: "github:devsnek/node-register-scheme"
ws: ^7.3.1
dependenciesMeta:
register-scheme:
optional: true
checksum: f96e4e32751402c9a689b24eccfa319315995f8906bb86e167c6a94bc6466f3641b41f8a082ac5b4e92baa7cefdb3456e7c4d86ccd2d9373281c9a93b7335c56
languageName: node languageName: node
linkType: hard linkType: hard
@ -3978,6 +3993,16 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"follow-redirects@npm:^1.15.0":
version: 1.15.2
resolution: "follow-redirects@npm:1.15.2"
peerDependenciesMeta:
debug:
optional: true
checksum: faa66059b66358ba65c234c2f2a37fcec029dc22775f35d9ad6abac56003268baf41e55f9ee645957b32c7d9f62baf1f0b906e68267276f54ec4b4c597c2b190
languageName: node
linkType: hard
"for-each@npm:^0.3.3": "for-each@npm:^0.3.3":
version: 0.3.3 version: 0.3.3
resolution: "for-each@npm:0.3.3" resolution: "for-each@npm:0.3.3"
@ -4229,7 +4254,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"glob-parent@npm:5.1.2": "glob-parent@npm:^5.1.2, glob-parent@npm:~5.1.2":
version: 5.1.2 version: 5.1.2
resolution: "glob-parent@npm:5.1.2" resolution: "glob-parent@npm:5.1.2"
dependencies: dependencies:
@ -4238,6 +4263,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"glob-parent@npm:^6.0.2":
version: 6.0.2
resolution: "glob-parent@npm:6.0.2"
dependencies:
is-glob: ^4.0.3
checksum: c13ee97978bef4f55106b71e66428eb1512e71a7466ba49025fc2aec59a5bfb0954d5abd58fc5ee6c9b076eef4e1f6d3375c2e964b88466ca390da4419a786a8
languageName: node
linkType: hard
"glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.1.6": "glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.1.6":
version: 7.2.3 version: 7.2.3
resolution: "glob@npm:7.2.3" resolution: "glob@npm:7.2.3"
@ -5511,7 +5545,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"keyboardevents-areequal@npm:^0.2.1": "keyboardevents-areequal@npm:^0.2.1, keyboardevents-areequal@npm:^0.2.2":
version: 0.2.2 version: 0.2.2
resolution: "keyboardevents-areequal@npm:0.2.2" resolution: "keyboardevents-areequal@npm:0.2.2"
checksum: 05d846f75170238bbb9ed45d13ca9c6cd3e68ea8ba6b7727971790fa55b44c3386ec8b9c321ae72dae0d0944678d0dc2b922148fe67d3f9720bf30a23999dd65 checksum: 05d846f75170238bbb9ed45d13ca9c6cd3e68ea8ba6b7727971790fa55b44c3386ec8b9c321ae72dae0d0944678d0dc2b922148fe67d3f9720bf30a23999dd65
@ -6055,10 +6089,10 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"minimist@npm:1.2.7": "minimist@npm:^1.2.0, minimist@npm:^1.2.5, minimist@npm:^1.2.6":
version: 1.2.7 version: 1.2.8
resolution: "minimist@npm:1.2.7" resolution: "minimist@npm:1.2.8"
checksum: 7346574a1038ca23c32e02252f603801f09384dd1d78b69a943a4e8c2c28730b80e96193882d3d3b22a063445f460e48316b29b8a25addca2d7e5e8f75478bec checksum: 75a6d645fb122dad29c06a7597bddea977258957ed88d7a6df59b5cd3fe4a527e253e9bbf2e783e4b73657f9098b96a5fe96ab8a113655d4109108577ecf85b0
languageName: node languageName: node
linkType: hard linkType: hard
@ -6235,7 +6269,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"node-addon-api@npm:^1.3.0, node-addon-api@npm:^1.6.3": "node-addon-api@npm:^1.6.3":
version: 1.7.2 version: 1.7.2
resolution: "node-addon-api@npm:1.7.2" resolution: "node-addon-api@npm:1.7.2"
dependencies: dependencies:
@ -7034,6 +7068,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"proxy-from-env@npm:^1.1.0":
version: 1.1.0
resolution: "proxy-from-env@npm:1.1.0"
checksum: ed7fcc2ba0a33404958e34d95d18638249a68c430e30fcb6c478497d72739ba64ce9810a24f53a7d921d0c065e5b78e3822759800698167256b04659366ca4d4
languageName: node
linkType: hard
"psl@npm:^1.1.28": "psl@npm:^1.1.28":
version: 1.9.0 version: 1.9.0
resolution: "psl@npm:1.9.0" resolution: "psl@npm:1.9.0"
@ -7284,16 +7325,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"register-scheme@github:devsnek/node-register-scheme":
version: 0.0.2
resolution: "register-scheme@https://github.com/devsnek/node-register-scheme.git#commit=e7cc9a63a1f512565da44cb57316d9fb10750e17"
dependencies:
bindings: ^1.3.0
node-addon-api: ^1.3.0
checksum: e3281b9b81f5718ebc05c27988f6ef33bcd452048a414ad5862f29348d14513b988ec117cc73ef46955c40f78185aaec1430361dc1d1fe0a662eec864a2bf058
languageName: node
linkType: hard
"request-progress@npm:^2.0.1": "request-progress@npm:^2.0.1":
version: 2.0.1 version: 2.0.1
resolution: "request-progress@npm:2.0.1" resolution: "request-progress@npm:2.0.1"
@ -8705,18 +8736,18 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"ws@npm:^7.3.1": "ws@npm:^8.11.0":
version: 7.5.9 version: 8.12.0
resolution: "ws@npm:7.5.9" resolution: "ws@npm:8.12.0"
peerDependencies: peerDependencies:
bufferutil: ^4.0.1 bufferutil: ^4.0.1
utf-8-validate: ^5.0.2 utf-8-validate: ">=5.0.2"
peerDependenciesMeta: peerDependenciesMeta:
bufferutil: bufferutil:
optional: true optional: true
utf-8-validate: utf-8-validate:
optional: true optional: true
checksum: c3c100a181b731f40b7f2fddf004aa023f79d64f489706a28bc23ff88e87f6a64b3c6651fbec3a84a53960b75159574d7a7385709847a62ddb7ad6af76f49138 checksum: 818ff3f8749c172a95a114cceb8b89cedd27e43a82d65c7ad0f7882b1e96a2ee6709e3746a903c3fa88beec0c8bae9a9fcd75f20858b32a166dfb7519316a5d7
languageName: node languageName: node
linkType: hard linkType: hard
@ -8851,13 +8882,29 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"yargs-parser@npm:21.1.1": "yargs-parser@npm:^20.2.9":
version: 20.2.9
resolution: "yargs-parser@npm:20.2.9"
checksum: 8bb69015f2b0ff9e17b2c8e6bfe224ab463dd00ca211eece72a4cd8a906224d2703fb8a326d36fdd0e68701e201b2a60ed7cf81ce0fd9b3799f9fe7745977ae3
languageName: node
linkType: hard
"yargs-parser@npm:^21.1.1":
version: 21.1.1 version: 21.1.1
resolution: "yargs-parser@npm:21.1.1" resolution: "yargs-parser@npm:21.1.1"
checksum: ed2d96a616a9e3e1cc7d204c62ecc61f7aaab633dcbfab2c6df50f7f87b393993fe6640d017759fe112d0cb1e0119f2b4150a87305cc873fd90831c6a58ccf1c checksum: ed2d96a616a9e3e1cc7d204c62ecc61f7aaab633dcbfab2c6df50f7f87b393993fe6640d017759fe112d0cb1e0119f2b4150a87305cc873fd90831c6a58ccf1c
languageName: node languageName: node
linkType: hard linkType: hard
"yargs-parser@npm:^4.2.0":
version: 4.2.1
resolution: "yargs-parser@npm:4.2.1"
dependencies:
camelcase: ^3.0.0
checksum: 955f7cd7fa25ee559ea4f3a4bfc5961ae38b340b32ff58834d043b4145c03f8d6a8891b31d258d55f63fb3c81415943e13f1dd45cef9bba05d2303e25e811030
languageName: node
linkType: hard
"yargs@npm:^17.5.1": "yargs@npm:^17.5.1":
version: 17.6.2 version: 17.6.2
resolution: "yargs@npm:17.6.2" resolution: "yargs@npm:17.6.2"
@ -8927,6 +8974,7 @@ __metadata:
"@ffmpeg/ffmpeg": ^0.11.6 "@ffmpeg/ffmpeg": ^0.11.6
"@foobar404/wave": ^2.0.4 "@foobar404/wave": ^2.0.4
"@playwright/test": ^1.29.2 "@playwright/test": ^1.29.2
"@xhayper/discord-rpc": ^1.0.15
async-mutex: ^0.4.0 async-mutex: ^0.4.0
auto-changelog: ^2.4.0 auto-changelog: ^2.4.0
browser-id3-writer: ^4.4.0 browser-id3-writer: ^4.4.0
@ -8936,7 +8984,6 @@ __metadata:
custom-electron-prompt: ^1.5.1 custom-electron-prompt: ^1.5.1
custom-electron-titlebar: ^4.1.5 custom-electron-titlebar: ^4.1.5
del-cli: ^5.0.0 del-cli: ^5.0.0
discord-rpc: ^4.0.1
electron: ^22.0.2 electron: ^22.0.2
electron-better-web-request: ^1.0.1 electron-better-web-request: ^1.0.1
electron-builder: ^23.6.0 electron-builder: ^23.6.0
@ -8951,6 +8998,8 @@ __metadata:
filenamify: ^4.3.0 filenamify: ^4.3.0
howler: ^2.2.3 howler: ^2.2.3
html-to-text: ^9.0.3 html-to-text: ^9.0.3
keyboardevent-from-electron-accelerator: ^2.0.0
keyboardevents-areequal: ^0.2.2
md5: ^2.3.0 md5: ^2.3.0
mpris-service: ^2.1.2 mpris-service: ^2.1.2
node-fetch: ^2.6.8 node-fetch: ^2.6.8

View File

@ -39,3 +39,8 @@ img {
ytmusic-cast-button { ytmusic-cast-button {
display: none !important; display: none !important;
} }
/* Remove useless inaccessible button on top-right corner of the video player */
.ytp-chrome-top-buttons {
display: none !important;
}