mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 19:31:46 +00:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4299ba7865 | |||
| 855d8007a7 | |||
| f239ec3232 | |||
| 5f0dcbb3fc | |||
| 97dce5ad41 | |||
| 1b3e4df1b2 | |||
| 8d74a0a9b5 | |||
| fbce109554 | |||
| f4641acdbb | |||
| 02ae9f8187 | |||
| 9f428415bb | |||
| c7d3741b97 | |||
| 6404ec0919 | |||
| 4cd2d10cad | |||
| 57f5d302d5 | |||
| 168524ba50 | |||
| 149362f2a7 | |||
| 6c330046b7 | |||
| 884a2cc226 | |||
| 3882118121 | |||
| 0fd2e7f51c | |||
| 408aa9bb59 |
7
index.js
7
index.js
@ -12,6 +12,7 @@ const {
|
|||||||
isAppVisible,
|
isAppVisible,
|
||||||
isTrayEnabled,
|
isTrayEnabled,
|
||||||
store,
|
store,
|
||||||
|
startAtLogin,
|
||||||
} = require("./store");
|
} = require("./store");
|
||||||
const { fileExists, injectCSS } = require("./plugins/utils");
|
const { fileExists, injectCSS } = require("./plugins/utils");
|
||||||
const { isTesting } = require("./utils/testing");
|
const { isTesting } = require("./utils/testing");
|
||||||
@ -54,6 +55,7 @@ function createMainWindow() {
|
|||||||
nodeIntegration: isTesting(), // Only necessary when testing with Spectron
|
nodeIntegration: isTesting(), // Only necessary when testing with Spectron
|
||||||
preload: path.join(__dirname, "preload.js"),
|
preload: path.join(__dirname, "preload.js"),
|
||||||
nativeWindowOpen: true, // window.open return Window object(like in regular browsers), not BrowserWindowProxy
|
nativeWindowOpen: true, // window.open return Window object(like in regular browsers), not BrowserWindowProxy
|
||||||
|
enableRemoteModule: true,
|
||||||
affinity: "main-window", // main window, and addition windows should work in one process
|
affinity: "main-window", // main window, and addition windows should work in one process
|
||||||
},
|
},
|
||||||
frame: !is.macOS(),
|
frame: !is.macOS(),
|
||||||
@ -170,6 +172,11 @@ app.on("ready", () => {
|
|||||||
mainWindow = createMainWindow();
|
mainWindow = createMainWindow();
|
||||||
setUpTray(app, mainWindow);
|
setUpTray(app, mainWindow);
|
||||||
|
|
||||||
|
// Autostart at login
|
||||||
|
app.setLoginItemSettings({
|
||||||
|
openAtLogin: startAtLogin(),
|
||||||
|
});
|
||||||
|
|
||||||
if (!is.dev() && autoUpdate()) {
|
if (!is.dev() && autoUpdate()) {
|
||||||
autoUpdater.checkForUpdatesAndNotify();
|
autoUpdater.checkForUpdatesAndNotify();
|
||||||
autoUpdater.on("update-available", () => {
|
autoUpdater.on("update-available", () => {
|
||||||
|
|||||||
16
menu.js
16
menu.js
@ -1,4 +1,5 @@
|
|||||||
const { app, Menu } = require("electron");
|
const { app, Menu } = require("electron");
|
||||||
|
const is = require("electron-is");
|
||||||
|
|
||||||
const { getAllPlugins } = require("./plugins/utils");
|
const { getAllPlugins } = require("./plugins/utils");
|
||||||
const {
|
const {
|
||||||
@ -9,6 +10,7 @@ const {
|
|||||||
isAppVisible,
|
isAppVisible,
|
||||||
isTrayEnabled,
|
isTrayEnabled,
|
||||||
setOptions,
|
setOptions,
|
||||||
|
startAtLogin,
|
||||||
} = require("./store");
|
} = require("./store");
|
||||||
|
|
||||||
const mainMenuTemplate = [
|
const mainMenuTemplate = [
|
||||||
@ -40,6 +42,20 @@ const mainMenuTemplate = [
|
|||||||
setOptions({ autoUpdates: item.checked });
|
setOptions({ autoUpdates: item.checked });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
...(is.windows() || is.macOS()
|
||||||
|
? // Only works on Win/Mac
|
||||||
|
// https://www.electronjs.org/docs/api/app#appsetloginitemsettingssettings-macos-windows
|
||||||
|
[
|
||||||
|
{
|
||||||
|
label: "Start at login",
|
||||||
|
type: "checkbox",
|
||||||
|
checked: startAtLogin(),
|
||||||
|
click: (item) => {
|
||||||
|
setOptions({ startAtLogin: item.checked });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
{
|
{
|
||||||
label: "Tray",
|
label: "Tray",
|
||||||
submenu: [
|
submenu: [
|
||||||
|
|||||||
28
package.json
28
package.json
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "youtube-music",
|
"name": "youtube-music",
|
||||||
"productName": "YouTube Music",
|
"productName": "YouTube Music",
|
||||||
"version": "1.3.3",
|
"version": "1.5.0",
|
||||||
"description": "YouTube Music Desktop App - including custom plugins",
|
"description": "YouTube Music Desktop App - including custom plugins",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": "th-ch/youtube-music",
|
"repository": "th-ch/youtube-music",
|
||||||
@ -46,26 +46,28 @@
|
|||||||
"npm": "Please use yarn and not npm"
|
"npm": "Please use yarn and not npm"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cliqz/adblocker-electron": "^1.15.0",
|
"@cliqz/adblocker-electron": "^1.18.3",
|
||||||
"YoutubeNonStop": "git://github.com/lawfx/YoutubeNonStop.git#v0.7.1",
|
"YoutubeNonStop": "git://github.com/lawfx/YoutubeNonStop.git#v0.7.1",
|
||||||
"electron-debug": "^3.1.0",
|
"electron-debug": "^3.1.0",
|
||||||
"electron-is": "^3.0.0",
|
"electron-is": "^3.0.0",
|
||||||
"electron-localshortcut": "^3.2.1",
|
"electron-localshortcut": "^3.2.1",
|
||||||
"electron-store": "^5.2.0",
|
"electron-store": "^6.0.0",
|
||||||
"electron-updater": "^4.3.2",
|
"electron-updater": "^4.3.5",
|
||||||
"node-fetch": "^2.6.0"
|
"node-fetch": "^2.6.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"devtron": "^1.4.0",
|
"electron": "^10.1.3",
|
||||||
"electron": "^8.2.4",
|
"electron-builder": "^22.8.1",
|
||||||
"electron-builder": "^22.4.1",
|
"electron-devtools-installer": "^3.1.1",
|
||||||
"electron-devtools-installer": "^3.0.0",
|
"electron-icon-maker": "0.0.5",
|
||||||
"electron-icon-maker": "0.0.4",
|
|
||||||
"get-port": "^5.1.1",
|
"get-port": "^5.1.1",
|
||||||
"jest": "^25.5.1",
|
"jest": "^26.4.2",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"spectron": "^10.0.1",
|
"spectron": "^12.0.0",
|
||||||
"xo": "^0.29.0"
|
"xo": "^0.33.1"
|
||||||
|
},
|
||||||
|
"resolutions": {
|
||||||
|
"yargs-parser": "18.1.3"
|
||||||
},
|
},
|
||||||
"xo": {
|
"xo": {
|
||||||
"envs": [
|
"envs": [
|
||||||
|
|||||||
6
plugins/hide-video-player/back.js
Normal file
6
plugins/hide-video-player/back.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
const { injectCSS } = require("../utils");
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
module.exports = win => {
|
||||||
|
injectCSS(win.webContents, path.join(__dirname, "style.css"));
|
||||||
|
};
|
||||||
11
plugins/hide-video-player/style.css
Normal file
11
plugins/hide-video-player/style.css
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/* Hide the video player */
|
||||||
|
#main-panel {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make the side-panel full width */
|
||||||
|
.side-panel.ytmusic-player-page {
|
||||||
|
max-width: 100% !important;
|
||||||
|
width: 100% !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
}
|
||||||
@ -1,17 +1,17 @@
|
|||||||
.navigation-item {
|
.navigation-item {
|
||||||
font-family : Roboto, Noto Naskh Arabic UI, Arial, sans-serif;
|
font-family: Roboto, Noto Naskh Arabic UI, Arial, sans-serif;
|
||||||
font-size : 20px;
|
font-size: 20px;
|
||||||
line-height : var(--ytmusic-title-1_-_line-height);
|
line-height: var(--ytmusic-title-1_-_line-height);
|
||||||
font-weight : 500;
|
font-weight: 500;
|
||||||
color : #fff;
|
color: #fff;
|
||||||
--yt-endpoint-color : #fff;
|
--yt-endpoint-color: #fff;
|
||||||
--yt-endpoint-hover-color : #fff;
|
--yt-endpoint-hover-color: #fff;
|
||||||
--yt-endpoint-visited-color: #fff;
|
--yt-endpoint-visited-color: #fff;
|
||||||
display : inline-flex;
|
display: inline-flex;
|
||||||
align-items : center;
|
align-items: center;
|
||||||
color : rgba(255, 255, 255, 0.5);
|
color: rgba(255, 255, 255, 0.5);
|
||||||
cursor : pointer;
|
cursor: pointer;
|
||||||
margin : 0 var(--ytmusic-pivot-bar-tab-margin);
|
margin: 0 var(--ytmusic-pivot-bar-tab-margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
.navigation-item:hover {
|
.navigation-item:hover {
|
||||||
@ -19,18 +19,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.navigation-icon {
|
.navigation-icon {
|
||||||
display : inline-flex;
|
display: inline-flex;
|
||||||
-ms-flex-align : center;
|
-ms-flex-align: center;
|
||||||
-webkit-align-items : center;
|
-webkit-align-items: center;
|
||||||
align-items : center;
|
align-items: center;
|
||||||
-ms-flex-pack : center;
|
-ms-flex-pack: center;
|
||||||
-webkit-justify-content: center;
|
-webkit-justify-content: center;
|
||||||
justify-content : center;
|
justify-content: center;
|
||||||
position : relative;
|
position: relative;
|
||||||
vertical-align : middle;
|
vertical-align: middle;
|
||||||
fill : var(--iron-icon-fill-color, currentcolor);
|
fill: var(--iron-icon-fill-color, currentcolor);
|
||||||
stroke : none;
|
stroke: none;
|
||||||
width : var(--iron-icon-width, 24px);
|
width: var(--iron-icon-width, 24px);
|
||||||
height : var(--iron-icon-height, 24px);
|
height: var(--iron-icon-height, 24px);
|
||||||
animation : var(--iron-icon_-_animation);
|
animation: var(--iron-icon_-_animation);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,26 +4,6 @@
|
|||||||
role="tab"
|
role="tab"
|
||||||
onclick="goToPreviousPage()"
|
onclick="goToPreviousPage()"
|
||||||
>
|
>
|
||||||
<div
|
|
||||||
class="tab-icon style-scope ytmusic-pivot-bar-item-renderer yt-icon-container"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
preserveAspectRatio="xMidYMid meet"
|
|
||||||
focusable="false"
|
|
||||||
class="style-scope yt-icon"
|
|
||||||
style="pointer-events: none; display: block; width: 100%; height: 100%;"
|
|
||||||
>
|
|
||||||
<g class="style-scope yt-icon">
|
|
||||||
<path
|
|
||||||
class="st0"
|
|
||||||
d="M109.3 265.2l218.9 218.9c5.1 5.1 11.8 7.9 19 7.9s14-2.8 19-7.9l16.1-16.1c10.5-10.5 10.5-27.6 0-38.1L198.6 246.1 382.7 62c5.1-5.1 7.9-11.8 7.9-19 0-7.2-2.8-14-7.9-19L366.5 7.9c-5.1-5.1-11.8-7.9-19-7.9-7.2 0-14 2.8-19 7.9L109.3 227c-5.1 5.1-7.9 11.9-7.8 19.1 0 7.2 2.8 14 7.8 19.1z"
|
|
||||||
class="style-scope yt-icon"
|
|
||||||
></path>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="search-icon style-scope ytmusic-search-box"
|
class="search-icon style-scope ytmusic-search-box"
|
||||||
role="button"
|
role="button"
|
||||||
@ -31,7 +11,10 @@
|
|||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
title="Go to previous page"
|
title="Go to previous page"
|
||||||
>
|
>
|
||||||
<div id="icon" class="style-scope paper-icon-button navigation-icon">
|
<div
|
||||||
|
id="icon"
|
||||||
|
class="tab-icon style-scope paper-icon-button navigation-icon"
|
||||||
|
>
|
||||||
<svg
|
<svg
|
||||||
viewBox="0 0 492 492"
|
viewBox="0 0 492 492"
|
||||||
preserveAspectRatio="xMidYMid meet"
|
preserveAspectRatio="xMidYMid meet"
|
||||||
@ -41,7 +24,6 @@
|
|||||||
>
|
>
|
||||||
<g class="style-scope iron-icon">
|
<g class="style-scope iron-icon">
|
||||||
<path
|
<path
|
||||||
class="st0"
|
|
||||||
d="M109.3 265.2l218.9 218.9c5.1 5.1 11.8 7.9 19 7.9s14-2.8 19-7.9l16.1-16.1c10.5-10.5 10.5-27.6 0-38.1L198.6 246.1 382.7 62c5.1-5.1 7.9-11.8 7.9-19 0-7.2-2.8-14-7.9-19L366.5 7.9c-5.1-5.1-11.8-7.9-19-7.9-7.2 0-14 2.8-19 7.9L109.3 227c-5.1 5.1-7.9 11.9-7.8 19.1 0 7.2 2.8 14 7.8 19.1z"
|
d="M109.3 265.2l218.9 218.9c5.1 5.1 11.8 7.9 19 7.9s14-2.8 19-7.9l16.1-16.1c10.5-10.5 10.5-27.6 0-38.1L198.6 246.1 382.7 62c5.1-5.1 7.9-11.8 7.9-19 0-7.2-2.8-14-7.9-19L366.5 7.9c-5.1-5.1-11.8-7.9-19-7.9-7.2 0-14 2.8-19 7.9L109.3 227c-5.1 5.1-7.9 11.9-7.8 19.1 0 7.2 2.8 14 7.8 19.1z"
|
||||||
></path>
|
></path>
|
||||||
</g>
|
</g>
|
||||||
|
|||||||
@ -4,26 +4,6 @@
|
|||||||
role="tab"
|
role="tab"
|
||||||
onclick="goToNextPage()"
|
onclick="goToNextPage()"
|
||||||
>
|
>
|
||||||
<div class="tab-icon style-scope ytmusic-pivot-bar-item-renderer">
|
|
||||||
<svg
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
preserveAspectRatio="xMidYMid meet"
|
|
||||||
focusable="false"
|
|
||||||
class="style-scope yt-icon"
|
|
||||||
style="pointer-events: none; display: block; width: 100%; height: 100%;"
|
|
||||||
>
|
|
||||||
<g class="style-scope yt-icon">
|
|
||||||
<path
|
|
||||||
d="M382.678,226.804L163.73,7.86C158.666,2.792,151.906,0,144.698,0s-13.968,2.792-19.032,7.86l-16.124,16.12
|
|
||||||
c-10.492,10.504-10.492,27.576,0,38.064L293.398,245.9l-184.06,184.06c-5.064,5.068-7.86,11.824-7.86,19.028
|
|
||||||
c0,7.212,2.796,13.968,7.86,19.04l16.124,16.116c5.068,5.068,11.824,7.86,19.032,7.86s13.968-2.792,19.032-7.86L382.678,265
|
|
||||||
c5.076-5.084,7.864-11.872,7.848-19.088C390.542,238.668,387.754,231.884,382.678,226.804z"
|
|
||||||
class="style-scope yt-icon"
|
|
||||||
></path>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="search-icon style-scope ytmusic-search-box"
|
class="search-icon style-scope ytmusic-search-box"
|
||||||
role="button"
|
role="button"
|
||||||
@ -31,7 +11,10 @@
|
|||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
title="Go to next page"
|
title="Go to next page"
|
||||||
>
|
>
|
||||||
<div id="icon" class="style-scope paper-icon-button navigation-icon">
|
<div
|
||||||
|
id="icon"
|
||||||
|
class="tab-icon style-scope paper-icon-button navigation-icon"
|
||||||
|
>
|
||||||
<svg
|
<svg
|
||||||
viewBox="0 0 492 492"
|
viewBox="0 0 492 492"
|
||||||
preserveAspectRatio="xMidYMid meet"
|
preserveAspectRatio="xMidYMid meet"
|
||||||
@ -41,7 +24,6 @@
|
|||||||
>
|
>
|
||||||
<g class="style-scope iron-icon">
|
<g class="style-scope iron-icon">
|
||||||
<path
|
<path
|
||||||
class="st0"
|
|
||||||
d="M382.7,226.8L163.7,7.9c-5.1-5.1-11.8-7.9-19-7.9s-14,2.8-19,7.9L109.5,24c-10.5,10.5-10.5,27.6,0,38.1
|
d="M382.7,226.8L163.7,7.9c-5.1-5.1-11.8-7.9-19-7.9s-14,2.8-19,7.9L109.5,24c-10.5,10.5-10.5,27.6,0,38.1
|
||||||
l183.9,183.9L109.3,430c-5.1,5.1-7.9,11.8-7.9,19c0,7.2,2.8,14,7.9,19l16.1,16.1c5.1,5.1,11.8,7.9,19,7.9s14-2.8,19-7.9L382.7,265
|
l183.9,183.9L109.3,430c-5.1,5.1-7.9,11.8-7.9,19c0,7.2,2.8,14,7.9,19l16.1,16.1c5.1,5.1,11.8,7.9,19,7.9s14-2.8,19-7.9L382.7,265
|
||||||
c5.1-5.1,7.9-11.9,7.8-19.1C390.5,238.7,387.8,231.9,382.7,226.8z"
|
c5.1-5.1,7.9-11.9,7.8-19.1C390.5,238.7,387.8,231.9,382.7,226.8z"
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
const { getCurrentWindow } = require("electron").remote;
|
const { remote } = require("electron");
|
||||||
|
|
||||||
const { getEnabledPlugins, store } = require("./store");
|
const { getEnabledPlugins, store } = require("./store");
|
||||||
const { fileExists } = require("./plugins/utils");
|
const { fileExists } = require("./plugins/utils");
|
||||||
@ -28,5 +28,5 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
|
|
||||||
// Add action for reloading
|
// Add action for reloading
|
||||||
global.reload = () =>
|
global.reload = () =>
|
||||||
getCurrentWindow().webContents.loadURL(store.get("url"));
|
remote.getCurrentWindow().webContents.loadURL(store.get("url"));
|
||||||
});
|
});
|
||||||
|
|||||||
@ -5,16 +5,17 @@ const store = new Store({
|
|||||||
defaults: {
|
defaults: {
|
||||||
"window-size": {
|
"window-size": {
|
||||||
width: 1100,
|
width: 1100,
|
||||||
height: 550
|
height: 550,
|
||||||
},
|
},
|
||||||
url: "https://music.youtube.com",
|
url: "https://music.youtube.com",
|
||||||
plugins: ["navigation", "shortcuts", "adblocker"],
|
plugins: ["navigation", "shortcuts", "adblocker"],
|
||||||
options: {
|
options: {
|
||||||
tray: false,
|
tray: false,
|
||||||
appVisible: true,
|
appVisible: true,
|
||||||
autoUpdates: true
|
autoUpdates: true,
|
||||||
}
|
startAtLogin: false,
|
||||||
}
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -29,5 +30,6 @@ module.exports = {
|
|||||||
store.set("options", { ...store.get("options"), ...options }),
|
store.set("options", { ...store.get("options"), ...options }),
|
||||||
isTrayEnabled: () => store.get("options.tray"),
|
isTrayEnabled: () => store.get("options.tray"),
|
||||||
isAppVisible: () => store.get("options.appVisible"),
|
isAppVisible: () => store.get("options.appVisible"),
|
||||||
autoUpdate: () => store.get("options.autoUpdates")
|
autoUpdate: () => store.get("options.autoUpdates"),
|
||||||
|
startAtLogin: () => store.get("options.startAtLogin"),
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2,6 +2,7 @@ const path = require("path");
|
|||||||
|
|
||||||
const getPort = require("get-port");
|
const getPort = require("get-port");
|
||||||
const NodeEnvironment = require("jest-environment-node");
|
const NodeEnvironment = require("jest-environment-node");
|
||||||
|
const electronPath = require("electron");
|
||||||
const { Application } = require("spectron");
|
const { Application } = require("spectron");
|
||||||
|
|
||||||
class TestEnvironment extends NodeEnvironment {
|
class TestEnvironment extends NodeEnvironment {
|
||||||
@ -12,13 +13,6 @@ class TestEnvironment extends NodeEnvironment {
|
|||||||
async setup() {
|
async setup() {
|
||||||
await super.setup();
|
await super.setup();
|
||||||
|
|
||||||
const electronPath = path.resolve(
|
|
||||||
__dirname,
|
|
||||||
"..",
|
|
||||||
"node_modules",
|
|
||||||
".bin",
|
|
||||||
"electron"
|
|
||||||
);
|
|
||||||
const appPath = path.resolve(__dirname, "..");
|
const appPath = path.resolve(__dirname, "..");
|
||||||
const port = await getPort();
|
const port = await getPort();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user