Merge branch 'master' of github.com:th-ch/youtube-music into snyk-upgrade

* 'master' of github.com:th-ch/youtube-music:
  Bump plist from 3.0.2 to 3.0.5
  use spread syntax instead of Array.from
  Fix lyrics genius missing parts
  feat: option to force show like buttons
  Fix lyrics genius missing parts
  [precise-volume] fix expand-volume-slider not updating its value
  fix: upgrade ytdl-core from 4.10.1 to 4.11.0
  add always-on-top option
  fix volumeHud position in miniplayer
  fix: upgrade @cliqz/adblocker-electron from 1.23.4 to 1.23.5
This commit is contained in:
TC
2022-04-08 15:41:14 +02:00
9 changed files with 117 additions and 80 deletions

View File

@ -165,6 +165,10 @@ function createMainWindow() {
win.maximize(); win.maximize();
} }
if(config.get("options.alwaysOnTop")){
win.setAlwaysOnTop(true);
}
const urlToLoad = config.get("options.resumeOnStart") const urlToLoad = config.get("options.resumeOnStart")
? config.get("url") ? config.get("url")
: config.defaultConfig.url; : config.defaultConfig.url;

34
menu.js
View File

@ -80,12 +80,25 @@ const mainMenuTemplate = (win) => {
}, },
}, },
{ {
label: "Remove upgrade button", label: "Visual Tweaks",
type: "checkbox", submenu: [
checked: config.get("options.removeUpgradeButton"), {
click: (item) => { label: "Remove upgrade button",
config.setMenuOption("options.removeUpgradeButton", item.checked); type: "checkbox",
}, checked: config.get("options.removeUpgradeButton"),
click: (item) => {
config.setMenuOption("options.removeUpgradeButton", item.checked);
},
},
{
label: "Force show like buttons",
type: "checkbox",
checked: config.get("options.ForceShowLikeButtons"),
click: (item) => {
config.set("options.ForceShowLikeButtons", item.checked);
},
},
],
}, },
{ {
label: "Single instance lock", label: "Single instance lock",
@ -100,6 +113,15 @@ const mainMenuTemplate = (win) => {
} }
}, },
}, },
{
label: "Always on top",
type: "checkbox",
checked: config.get("options.alwaysOnTop"),
click: (item) => {
config.setMenuOption("options.alwaysOnTop", item.checked);
win.setAlwaysOnTop(item.checked);
},
},
...(is.windows() || is.linux() ...(is.windows() || is.linux()
? [ ? [
{ {

View File

@ -92,7 +92,7 @@
"npm": "Please use yarn and not npm" "npm": "Please use yarn and not npm"
}, },
"dependencies": { "dependencies": {
"@cliqz/adblocker-electron": "^1.23.4", "@cliqz/adblocker-electron": "^1.23.5",
"@electron/remote": "^2.0.4", "@electron/remote": "^2.0.4",
"@ffmpeg/core": "^0.10.0", "@ffmpeg/core": "^0.10.0",
"@ffmpeg/ffmpeg": "^0.10.1", "@ffmpeg/ffmpeg": "^0.10.1",
@ -115,7 +115,7 @@
"mpris-service": "^2.1.2", "mpris-service": "^2.1.2",
"node-fetch": "^2.6.7", "node-fetch": "^2.6.7",
"node-notifier": "^10.0.1", "node-notifier": "^10.0.1",
"ytdl-core": "^4.10.1", "ytdl-core": "^4.11.0",
"ytpl": "^2.3.0" "ytpl": "^2.3.0"
}, },
"devDependencies": { "devDependencies": {

View File

@ -36,15 +36,10 @@ module.exports = () => {
const wrapper = document.createElement("div"); const wrapper = document.createElement("div");
wrapper.innerHTML = html; wrapper.innerHTML = html;
const lyricsSelector1 = wrapper.querySelector(".lyrics");
const lyricsSelector2 = wrapper.querySelector( const lyrics = [...wrapper.querySelectorAll('[class^="Lyrics__Container"]')].map(d => d.innerHTML).join('<br>')
'[class^="Lyrics__Container"]' || wrapper.querySelector(".lyrics")?.innerHTML;
);
const lyrics = lyricsSelector1
? lyricsSelector1.innerHTML
: lyricsSelector2
? lyricsSelector2.innerHTML
: null;
if (!lyrics) { if (!lyrics) {
return; return;
} }

View File

@ -1,9 +1,15 @@
const { injectCSS } = require("../utils");
const path = require("path");
/* /*
This is used to determine if plugin is actually active This is used to determine if plugin is actually active
(not if its only enabled in options) (not if its only enabled in options)
*/ */
let enabled = false; let enabled = false;
module.exports = () => enabled = true; module.exports = (win) => {
enabled = true;
injectCSS(win.webContents, path.join(__dirname, "volume-hud.css"));
}
module.exports.enabled = () => enabled; module.exports.enabled = () => enabled;

View File

@ -45,23 +45,21 @@ function firstRun(options) {
// Change options from renderer to keep sync // Change options from renderer to keep sync
ipcRenderer.on("setOptions", (_event, newOptions = {}) => { ipcRenderer.on("setOptions", (_event, newOptions = {}) => {
for (option in newOptions) { Object.assign(options, newOptions)
options[option] = newOptions[option];
}
setMenuOptions("precise-volume", options); setMenuOptions("precise-volume", options);
}); });
} }
function injectVolumeHud(noVid) { function injectVolumeHud(noVid) {
if (noVid) { if (noVid) {
const position = "top: 18px; right: 60px; z-index: 999; position: absolute;"; const position = "top: 18px; right: 60px;";
const mainStyle = "font-size: xx-large; padding: 10px; transition: opacity 1s; pointer-events: none;"; const mainStyle = "font-size: xx-large;";
$(".center-content.ytmusic-nav-bar").insertAdjacentHTML("beforeend", $(".center-content.ytmusic-nav-bar").insertAdjacentHTML("beforeend",
`<span id="volumeHud" style="${position + mainStyle}"></span>`) `<span id="volumeHud" style="${position + mainStyle}"></span>`)
} else { } else {
const position = `top: 10px; left: 10px; z-index: 999; position: absolute;`; const position = `top: 10px; left: 10px;`;
const mainStyle = "font-size: xxx-large; padding: 10px; transition: opacity 0.6s; webkit-text-stroke: 1px black; font-weight: 600; pointer-events: none;"; const mainStyle = "font-size: xxx-large; webkit-text-stroke: 1px black; font-weight: 600;";
$("#song-video").insertAdjacentHTML('afterend', $("#song-video").insertAdjacentHTML('afterend',
`<span id="volumeHud" style="${position + mainStyle}"></span>`) `<span id="volumeHud" style="${position + mainStyle}"></span>`)
@ -189,8 +187,12 @@ function changeVolume(toIncrease, options) {
function updateVolumeSlider(options) { function updateVolumeSlider(options) {
// Slider value automatically rounds to multiples of 5 // Slider value automatically rounds to multiples of 5
$("#volume-slider").value = options.savedVolume > 0 && options.savedVolume < 5 ? for (const slider of ["#volume-slider", "#expand-volume-slider"]) {
5 : options.savedVolume; $(slider).value =
options.savedVolume > 0 && options.savedVolume < 5
? 5
: options.savedVolume;
}
} }
let volumeHoverTimeoutID; let volumeHoverTimeoutID;

View File

@ -0,0 +1,11 @@
#volumeHud {
z-index: 999;
position: absolute;
transition: opacity 0.6s;
pointer-events: none;
padding: 10px;
}
ytmusic-player[player-ui-state_="MINIPLAYER"] #volumeHud {
top: 0 !important;
}

View File

@ -83,9 +83,17 @@ function onApiLoaded() {
// Remove upgrade button // Remove upgrade button
if (config.get("options.removeUpgradeButton")) { if (config.get("options.removeUpgradeButton")) {
const upgradeButtton = document.querySelector('ytmusic-pivot-bar-item-renderer[tab-id="SPunlimited"]') const upgradeButton = document.querySelector('ytmusic-pivot-bar-item-renderer[tab-id="SPunlimited"]')
if (upgradeButtton) { if (upgradeButton) {
upgradeButtton.style.display = "none"; upgradeButton.style.display = "none";
}
}
// Force show like buttons
if (config.get("options.ForceShowLikeButtons")) {
const likeButtons = document.querySelector('ytmusic-like-button-renderer')
if (likeButtons) {
likeButtons.style.display = 'inherit';
} }
} }
} }

View File

@ -650,45 +650,45 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@cliqz/adblocker-content@^1.23.4": "@cliqz/adblocker-content@^1.23.6":
version "1.23.4" version "1.23.6"
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-content/-/adblocker-content-1.23.4.tgz#d7803ab5f3c998247100b3b29b89ce5b3442314e" resolved "https://registry.yarnpkg.com/@cliqz/adblocker-content/-/adblocker-content-1.23.6.tgz#649c32143b3338d1d2206540bb0ea307aa073d90"
integrity sha512-Ib8c8E8rnrDygUfO02hAkwD9qUmW+t0cq1MuKg9iEVGOJVZwZU27SpJDoWhHz9bninzcxthzJYlLGgBZzcqq0Q== integrity sha512-rzFAtp8nGc6bbQoSjN6Xo0l1OHzqS9Z86nlyFD3yLsd9g2d/CLnx0WFDVsk6iE+N9yu2UpHbgWT+siShF0rHqw==
dependencies: dependencies:
"@cliqz/adblocker-extended-selectors" "^1.23.4" "@cliqz/adblocker-extended-selectors" "^1.23.6"
"@cliqz/adblocker-electron-preload@^1.23.4": "@cliqz/adblocker-electron-preload@^1.23.6":
version "1.23.4" version "1.23.6"
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-electron-preload/-/adblocker-electron-preload-1.23.4.tgz#41946642c52e1a51d0514cf5513dd9a11a020fae" resolved "https://registry.yarnpkg.com/@cliqz/adblocker-electron-preload/-/adblocker-electron-preload-1.23.6.tgz#7f8db3df95afb385917df00ec5300847448437d1"
integrity sha512-i1NMv5EeAB7T393zhBVwo+74qd082pCIIySRGDLrOqm8BAosCjXzXifq6p+14d68k1K+C8nDahHm/XvpgWMTCw== integrity sha512-xVBrIqfvcuh2Y07ZkEogzgkyqJuZvOqhRoFnuTyW2q97AmWAGLT6IjEGjl/vX7vMP0Y1b8wubdjI3VHnKvNKDg==
dependencies: dependencies:
"@cliqz/adblocker-content" "^1.23.4" "@cliqz/adblocker-content" "^1.23.6"
"@cliqz/adblocker-electron@^1.23.4": "@cliqz/adblocker-electron@^1.23.5":
version "1.23.4" version "1.23.6"
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-electron/-/adblocker-electron-1.23.4.tgz#6144199209aa9f1f73de5ee9d8b73c61deaf5945" resolved "https://registry.yarnpkg.com/@cliqz/adblocker-electron/-/adblocker-electron-1.23.6.tgz#e550f2ffa2b5d0404d0090c3870d0a849d3cd5d8"
integrity sha512-ld/2jdf8rIzNEHAG/ZFfapDISityA++Kxql1DqfsIUi0xcRlQdz6ijWQ0+xVOW4ZhTifGjlUvaq60MVn+R3OUQ== integrity sha512-wzkCfBCo5RvRanzsVOu65xHW9GAUDqsg+tP8GYld6/hgMMb96KJZJVpvrvwvsneAm9T55QE4ef1utZbIIwltqA==
dependencies: dependencies:
"@cliqz/adblocker" "^1.23.4" "@cliqz/adblocker" "^1.23.6"
"@cliqz/adblocker-electron-preload" "^1.23.4" "@cliqz/adblocker-electron-preload" "^1.23.6"
tldts-experimental "^5.6.21" tldts-experimental "^5.6.21"
"@cliqz/adblocker-extended-selectors@^1.23.4": "@cliqz/adblocker-extended-selectors@^1.23.6":
version "1.23.4" version "1.23.6"
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-extended-selectors/-/adblocker-extended-selectors-1.23.4.tgz#76e310ff6598ec76eacf402bd4733e7b8ab0ee98" resolved "https://registry.yarnpkg.com/@cliqz/adblocker-extended-selectors/-/adblocker-extended-selectors-1.23.6.tgz#fed9c3973553751f1ecae2397ceff60d364a6e11"
integrity sha512-qDfeOwe1UK4fGQFFafQMftdPy7uLm5JwKiM8zcGiYzJqRxTvnquRTGzYLkQLri9L1Q4R9Tvtg1wZtWMIrQnO6Q== integrity sha512-qnn2LrE/0YswjL4399M1ldKityLxDT9r/b9MUOPboz+4EiE/ew6hTl35yNg2g8nZU3tXSzrnvAYcqLw607kSYg==
"@cliqz/adblocker@^1.23.4": "@cliqz/adblocker@^1.23.6":
version "1.23.4" version "1.23.6"
resolved "https://registry.yarnpkg.com/@cliqz/adblocker/-/adblocker-1.23.4.tgz#dbf2282e223ca1bf963bc34d9a5d2b7f506513b5" resolved "https://registry.yarnpkg.com/@cliqz/adblocker/-/adblocker-1.23.6.tgz#741ee9a1fde2e75920204c120200704252932e02"
integrity sha512-IVP6L2on4SFCAk13hhH87MDbfXxvWv86LScKPoD7rOg+5f51HWp4meW+yFtv/VbLdpkKgORWXNA1KttVW0IuKA== integrity sha512-+Ojm25XwIkiD0THvf+WHZ3+zq65DuES7B6XlsMpbYC0JD8J9crpswLHsAmj97o0KVN+vmK2fYrqa2DgOUnFzYg==
dependencies: dependencies:
"@cliqz/adblocker-content" "^1.23.4" "@cliqz/adblocker-content" "^1.23.6"
"@cliqz/adblocker-extended-selectors" "^1.23.4" "@cliqz/adblocker-extended-selectors" "^1.23.6"
"@remusao/guess-url-type" "^1.1.2" "@remusao/guess-url-type" "^1.1.2"
"@remusao/small" "^1.1.2" "@remusao/small" "^1.1.2"
"@remusao/smaz" "^1.7.1" "@remusao/smaz" "^1.7.1"
"@types/chrome" "^0.0.176" "@types/chrome" "^0.0.178"
"@types/firefox-webext-browser" "^94.0.0" "@types/firefox-webext-browser" "^94.0.0"
tldts-experimental "^5.6.21" tldts-experimental "^5.6.21"
@ -1419,10 +1419,10 @@
dependencies: dependencies:
"@babel/types" "^7.3.0" "@babel/types" "^7.3.0"
"@types/chrome@^0.0.176": "@types/chrome@^0.0.178":
version "0.0.176" version "0.0.178"
resolved "https://registry.yarnpkg.com/@types/chrome/-/chrome-0.0.176.tgz#617fcbe41ea1d9c5d50c9e7fb8ebfe2d9aef853a" resolved "https://registry.yarnpkg.com/@types/chrome/-/chrome-0.0.178.tgz#fba7969208cef79ae752dc1138ff05de39f5ffde"
integrity sha512-LOveFOMIUhMJjvRzZv5whGBpncP/gdJ4hcxeAqg94wGi6CyKaCmLgFSofgItf85GuLTl/0BQ6J/Y1e8BqZWfEg== integrity sha512-U+G5YG2pH0qvLrYVJ9aT5VbPXYR3fAFyCuRBRAA14Pv7GrkFzDJuXPspgdeLYaKzGEp4rymUkuqUOuFz18LI1g==
dependencies: dependencies:
"@types/filesystem" "*" "@types/filesystem" "*"
"@types/har-format" "*" "@types/har-format" "*"
@ -6037,11 +6037,6 @@ min-indent@^1.0.1:
resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869"
integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==
miniget@^4.0.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/miniget/-/miniget-4.2.0.tgz#0004e95536b192d95a7d09f4435d67b9285481d0"
integrity sha512-IzTOaNgBw/qEpzkPTE7X2cUVXQfSKbG8w52Emi93zb+Zya2ZFrbmavpixzebuDJD9Ku4ecbaFlC7Y1cEESzQtQ==
miniget@^4.2.2: miniget@^4.2.2:
version "4.2.2" version "4.2.2"
resolved "https://registry.yarnpkg.com/miniget/-/miniget-4.2.2.tgz#db20320f265efdc4c1826a0be431d56753074475" resolved "https://registry.yarnpkg.com/miniget/-/miniget-4.2.2.tgz#db20320f265efdc4c1826a0be431d56753074475"
@ -6710,13 +6705,12 @@ playwright@^1.17.1:
playwright-core "=1.17.1" playwright-core "=1.17.1"
plist@^3.0.1: plist@^3.0.1:
version "3.0.2" version "3.0.5"
resolved "https://registry.yarnpkg.com/plist/-/plist-3.0.2.tgz#74bbf011124b90421c22d15779cee60060ba95bc" resolved "https://registry.yarnpkg.com/plist/-/plist-3.0.5.tgz#2cbeb52d10e3cdccccf0c11a63a85d830970a987"
integrity sha512-MSrkwZBdQ6YapHy87/8hDU8MnIcyxBKjeF+McXnr5A9MtffPewTs7G3hlpodT5TacyfIyFTaJEhh3GGcmasTgQ== integrity sha512-83vX4eYdQp3vP9SxuYgEM/G/pJQqLUz/V/xzPrzruLs7fz7jxGQ1msZ/mg1nwZxUSuOp4sb+/bEIbRrbzZRxDA==
dependencies: dependencies:
base64-js "^1.5.1" base64-js "^1.5.1"
xmlbuilder "^9.0.7" xmlbuilder "^9.0.7"
xmldom "^0.5.0"
plur@^4.0.0: plur@^4.0.0:
version "4.0.0" version "4.0.0"
@ -8316,11 +8310,6 @@ xmlchars@^2.2.0:
resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb"
integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==
xmldom@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/xmldom/-/xmldom-0.5.0.tgz#193cb96b84aa3486127ea6272c4596354cb4962e"
integrity sha512-Foaj5FXVzgn7xFzsKeNIde9g6aFBxTPi37iwsno8QvApmtg7KYrr+OPyRHcJF7dud2a5nGRBXK3n0dL62Gf7PA==
xo@^0.45.0: xo@^0.45.0:
version "0.45.0" version "0.45.0"
resolved "https://registry.yarnpkg.com/xo/-/xo-0.45.0.tgz#a953ff5da208f1e4829866f89382f92fb382906b" resolved "https://registry.yarnpkg.com/xo/-/xo-0.45.0.tgz#a953ff5da208f1e4829866f89382f92fb382906b"
@ -8472,13 +8461,13 @@ yocto-queue@^1.0.0:
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.0.0.tgz#7f816433fb2cbc511ec8bf7d263c3b58a1a3c251" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.0.0.tgz#7f816433fb2cbc511ec8bf7d263c3b58a1a3c251"
integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g== integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==
ytdl-core@^4.10.1: ytdl-core@^4.11.0:
version "4.10.1" version "4.11.0"
resolved "https://registry.yarnpkg.com/ytdl-core/-/ytdl-core-4.10.1.tgz#6648d65faca787919181b2cee1be470b2ef9fdcb" resolved "https://registry.yarnpkg.com/ytdl-core/-/ytdl-core-4.11.0.tgz#79a3ea94d9d662b4b3acecdb1372ed3f1a9ea9db"
integrity sha512-idBhW+e7HCzs5fR5cqp7Ci+mJhEch41YAaWabYlneQFCL6IGf6Hycv99yVx01Zl1Ci0t/70faOelMSrXaQTE/A== integrity sha512-Q3hCLiUA9AOGQXzPvno14GN+HgF9wsO1ZBHlj0COTcyxjIyFpWvMfii0UC4/cAbVaIjEdbWB71GdcGuc4J1Lmw==
dependencies: dependencies:
m3u8stream "^0.8.6" m3u8stream "^0.8.6"
miniget "^4.0.0" miniget "^4.2.2"
sax "^1.1.3" sax "^1.1.3"
ytpl@^2.3.0: ytpl@^2.3.0: