Skip to content

Commit 94f2cba

Browse files
committed
Merge branch 'local-upstream/master' into option-to-load-captions-selector-on-every-song
2 parents b45c628 + 4364d3b commit 94f2cba

File tree

21 files changed

+763
-712
lines changed

21 files changed

+763
-712
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
name: Build YouTube Music
22

33
on:
4-
- push
4+
push:
5+
branches: [ master ]
6+
pull_request:
57

68
env:
79
NODE_VERSION: "16.x"

config/dynamic.js

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,30 @@ const { ipcRenderer, ipcMain } = require("electron");
33
const defaultConfig = require("./defaults");
44
const { getOptions, setOptions, setMenuOptions } = require("./plugins");
55

6+
const activePlugins = {};
7+
/**
8+
* [!IMPORTANT!]
9+
* The method is **sync** in the main process and **async** in the renderer process.
10+
*/
11+
module.exports.getActivePlugins =
12+
process.type === "renderer"
13+
? async () => ipcRenderer.invoke("get-active-plugins")
14+
: () => activePlugins;
15+
16+
if (process.type === "browser") {
17+
ipcMain.handle("get-active-plugins", this.getActivePlugins);
18+
}
19+
20+
/**
21+
* [!IMPORTANT!]
22+
* The method is **sync** in the main process and **async** in the renderer process.
23+
*/
24+
module.exports.isActive =
25+
process.type === "renderer"
26+
? async (plugin) =>
27+
plugin in (await ipcRenderer.invoke("get-active-plugins"))
28+
: (plugin) => plugin in activePlugins;
29+
630
/**
731
* This class is used to create a dynamic synced config for plugins.
832
*
@@ -17,9 +41,9 @@ const { getOptions, setOptions, setMenuOptions } = require("./plugins");
1741
* const { PluginConfig } = require("../../config/dynamic");
1842
* const config = new PluginConfig("plugin-name", { enableFront: true });
1943
* module.exports = { ...config };
20-
*
44+
*
2145
* // or
22-
*
46+
*
2347
* module.exports = (win, options) => {
2448
* const config = new PluginConfig("plugin-name", {
2549
* enableFront: true,
@@ -46,6 +70,8 @@ module.exports.PluginConfig = class PluginConfig {
4670
if (this.#enableFront) {
4771
this.#setupFront();
4872
}
73+
74+
activePlugins[name] = this;
4975
}
5076

5177
get = (option) => {
@@ -85,6 +111,7 @@ module.exports.PluginConfig = class PluginConfig {
85111
setMenuOptions(this.#name, this.#config);
86112
};
87113

114+
/** Called only from back */
88115
#save() {
89116
setOptions(this.#name, this.#config);
90117
}

config/store.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ const migrations = {
1919
...pluginOptions,
2020
});
2121
}
22+
23+
if (store.get("options.ForceShowLikeButtons")) {
24+
store.delete("options.ForceShowLikeButtons");
25+
store.set("options.likeButtons", 'force');
26+
}
2227
},
2328
">=1.17.0": (store) => {
2429
setDefaultPluginOptions(store, "picture-in-picture");

index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ autoUpdater.autoDownload = false;
3434
const gotTheLock = app.requestSingleInstanceLock();
3535
if (!gotTheLock) app.exit();
3636

37-
app.commandLine.appendSwitch(
38-
"js-flags",
39-
// WebAssembly flags
40-
"--experimental-wasm-threads"
41-
);
4237
app.commandLine.appendSwitch("enable-features", "SharedArrayBuffer"); // Required for downloader
4338
app.allowRendererProcessReuse = true; // https://github.com/electron/electron/issues/18397
4439
if (config.get("options.disableHardwareAcceleration")) {

menu.js

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,33 @@ const mainMenuTemplate = (win) => {
9393
},
9494
},
9595
{
96-
label: "Force show like buttons",
97-
type: "checkbox",
98-
checked: config.get("options.ForceShowLikeButtons"),
99-
click: (item) => {
100-
config.set("options.ForceShowLikeButtons", item.checked);
101-
},
96+
label: "Like buttons",
97+
submenu: [
98+
{
99+
label: "Default",
100+
type: "radio",
101+
checked: !config.get("options.likeButtons"),
102+
click: () => {
103+
config.set("options.likeButtons", '');
104+
},
105+
},
106+
{
107+
label: "Force show",
108+
type: "radio",
109+
checked: config.get("options.likeButtons") === 'force',
110+
click: () => {
111+
config.set("options.likeButtons", 'force');
112+
}
113+
},
114+
{
115+
label: "Hide",
116+
type: "radio",
117+
checked: config.get("options.likeButtons") === 'hide',
118+
click: () => {
119+
config.set("options.likeButtons", 'hide');
120+
}
121+
},
122+
],
102123
},
103124
{
104125
label: "Theme",
@@ -131,7 +152,7 @@ const mainMenuTemplate = (win) => {
131152
],
132153
},
133154
{
134-
label: "Release single instance lock",
155+
label: "Single instance lock",
135156
type: "checkbox",
136157
checked: false,
137158
click: (item) => {

package.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@
8787
"generate:package": "node utils/generate-package-json.js",
8888
"postinstall": "yarn run icon && yarn run plugins",
8989
"clean": "del-cli dist",
90-
"build": "yarn run clean && electron-builder --win --mac --linux",
91-
"build:linux": "yarn run clean && electron-builder --linux",
92-
"build:mac": "yarn run clean && electron-builder --mac dmg:x64",
93-
"build:mac:arm64": "yarn run clean && electron-builder --mac dmg:arm64",
94-
"build:win": "yarn run clean && electron-builder --win",
90+
"build": "yarn run clean && electron-builder --win --mac --linux -p never",
91+
"build:linux": "yarn run clean && electron-builder --linux -p never",
92+
"build:mac": "yarn run clean && electron-builder --mac dmg:x64 -p never",
93+
"build:mac:arm64": "yarn run clean && electron-builder --mac dmg:arm64 -p never",
94+
"build:win": "yarn run clean && electron-builder --win -p never",
9595
"lint": "xo",
9696
"changelog": "auto-changelog",
9797
"plugins": "yarn run plugin:adblocker && yarn run plugin:bypass-age-restrictions",
@@ -106,7 +106,7 @@
106106
"npm": "Please use yarn instead"
107107
},
108108
"dependencies": {
109-
"@cliqz/adblocker-electron": "^1.25.2",
109+
"@cliqz/adblocker-electron": "^1.26.0",
110110
"@ffmpeg/core": "^0.11.0",
111111
"@ffmpeg/ffmpeg": "^0.11.6",
112112
"@foobar404/wave": "^2.0.4",
@@ -115,7 +115,6 @@
115115
"browser-id3-writer": "^4.4.0",
116116
"butterchurn": "^2.6.7",
117117
"butterchurn-presets": "^2.4.7",
118-
"chokidar": "^3.5.3",
119118
"custom-electron-prompt": "^1.5.4",
120119
"custom-electron-titlebar": "^4.1.6",
121120
"electron-better-web-request": "^1.0.1",
@@ -135,8 +134,7 @@
135134
"node-fetch": "^2.6.8",
136135
"simple-youtube-age-restriction-bypass": "https://gitpkg.now.sh/api/pkg.tgz?url=zerodytrash/Simple-YouTube-Age-Restriction-Bypass&commit=v2.5.4",
137136
"vudio": "^2.1.1",
138-
"youtubei.js": "^2.9.0",
139-
"ytdl-core": "^4.11.1",
137+
"youtubei.js": "^3.1.1",
140138
"ytpl": "^2.3.0"
141139
},
142140
"devDependencies": {

plugins/downloader/actions.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)