mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 07c4a429c1 | |||
| b10a1bb32d | |||
| 0420f2e49e | |||
| 9714994501 | |||
| b1c4cc9c45 | |||
| a85325f33d | |||
| 147ac48de6 | |||
| e86d63da8c | |||
| 09a39daeda | |||
| d9247dad33 | |||
| ec58b5cbed | |||
| eac2c5cf14 | |||
| 5a1d7fbf23 | |||
| 15275236b0 | |||
| 639ae28122 | |||
| d3453a600b | |||
| caf76e7588 | |||
| 2d3f77d962 | |||
| 5279a45f35 | |||
| e52e522d22 | |||
| aa3e4b32eb | |||
| eb63917b5d | |||
| 6e037483c7 | |||
| 941477bb0c | |||
| abc2bb8a4f | |||
| 253e82a2d7 | |||
| 708ba3167e | |||
| b3c24a5212 | |||
| 9d343bf779 | |||
| cd78db4e84 | |||
| 5648a3020b | |||
| 828e8d472c |
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
node_modules
|
||||
/dist
|
||||
/assets/generated
|
||||
/assets/generated
|
||||
electron-builder.yml
|
||||
|
||||
43
.travis.yml
Normal file
43
.travis.yml
Normal file
@ -0,0 +1,43 @@
|
||||
matrix:
|
||||
include:
|
||||
- os: osx
|
||||
osx_image: xcode9.4
|
||||
language: node_js
|
||||
node_js: "10"
|
||||
env:
|
||||
- ELECTRON_CACHE=$HOME/.cache/electron
|
||||
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
|
||||
|
||||
- os: linux
|
||||
services: docker
|
||||
language: generic
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- node_modules
|
||||
- $HOME/.cache/electron
|
||||
- $HOME/.cache/electron-builder
|
||||
|
||||
script:
|
||||
- |
|
||||
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
|
||||
docker run --rm \
|
||||
$(env | \
|
||||
grep -Eo '^[^\s=]*(DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS|APPVEYOR_|CSC_|_TOKEN|_KEY|AWS_|STRIP|BUILD_)[^\s=]*' | \
|
||||
sed '/^$/d;s/^/-e /' | \
|
||||
paste -sd ' ' \
|
||||
) \
|
||||
-v ${PWD}:/project \
|
||||
-v ~/.cache/electron:/root/.cache/electron \
|
||||
-v ~/.cache/electron-builder:/root/.cache/electron-builder \
|
||||
electronuserland/builder \
|
||||
/bin/bash -c "npm install && npm run release:linux"
|
||||
else
|
||||
npm run release:mac
|
||||
fi
|
||||
before_cache:
|
||||
- rm -rf $HOME/.cache/electron-builder
|
||||
|
||||
branches:
|
||||
except:
|
||||
- "/^v\\d+\\.\\d+\\.\\d+$/"
|
||||
20
appveyor.yml
Normal file
20
appveyor.yml
Normal file
@ -0,0 +1,20 @@
|
||||
image: Visual Studio 2017
|
||||
|
||||
platform:
|
||||
- x64
|
||||
|
||||
cache:
|
||||
- node_modules
|
||||
- '%USERPROFILE%\.electron'
|
||||
|
||||
init:
|
||||
- git config --global core.autocrlf input
|
||||
|
||||
install:
|
||||
- ps: Install-Product node 8 x64
|
||||
- npm install
|
||||
|
||||
build_script:
|
||||
- npm run release:win
|
||||
|
||||
test: off
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 40 KiB |
50
error.html
Normal file
50
error.html
Normal file
@ -0,0 +1,50 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Cannot load YouTube Music</title>
|
||||
<style>
|
||||
body {
|
||||
background: #000;
|
||||
}
|
||||
|
||||
.container {
|
||||
margin: 0;
|
||||
font-family: Roboto, Arial, sans-serif;
|
||||
font-size: 20px;
|
||||
font-weight: 500;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-right: -50%;
|
||||
transform: translate(-50%, -50%);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.button {
|
||||
background: #065fd4;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
color: white;
|
||||
font: inherit;
|
||||
text-transform: uppercase;
|
||||
text-decoration: none;
|
||||
border-radius: 2px;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
text-align: center;
|
||||
padding: 8px 22px;
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<p>Cannot load YouTube Music… Internet disconnected?</p>
|
||||
<a href="#" class="button" onclick="reload()">Retry</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
33
index.js
33
index.js
@ -1,8 +1,9 @@
|
||||
"use strict";
|
||||
const path = require("path");
|
||||
|
||||
const electron = require("electron");
|
||||
const isDev = require("electron-is-dev");
|
||||
const electron = require("electron");
|
||||
const is = require("electron-is");
|
||||
const { autoUpdater } = require("electron-updater");
|
||||
|
||||
const { setApplicationMenu } = require("./menu");
|
||||
const { getEnabledPlugins, store } = require("./store");
|
||||
@ -15,6 +16,7 @@ require("electron-debug")();
|
||||
|
||||
// Prevent window being garbage collected
|
||||
let mainWindow;
|
||||
autoUpdater.autoDownload = false;
|
||||
|
||||
let icon = "assets/youtube-music.png";
|
||||
if (process.platform == "win32") {
|
||||
@ -43,8 +45,8 @@ function createMainWindow() {
|
||||
nodeIntegration: false,
|
||||
preload : path.join(__dirname, "preload.js")
|
||||
},
|
||||
frame : false,
|
||||
titleBarStyle: "hiddenInset"
|
||||
frame : !is.macOS(),
|
||||
titleBarStyle: is.macOS() ? "hiddenInset": "default"
|
||||
});
|
||||
if (windowMaximized) {
|
||||
win.maximize();
|
||||
@ -55,7 +57,7 @@ function createMainWindow() {
|
||||
|
||||
injectCSS(win.webContents, path.join(__dirname, "youtube-music.css"));
|
||||
win.webContents.on("did-finish-load", () => {
|
||||
if (isDev) {
|
||||
if (is.dev()) {
|
||||
console.log("did finish load");
|
||||
win.webContents.openDevTools();
|
||||
}
|
||||
@ -70,6 +72,13 @@ function createMainWindow() {
|
||||
});
|
||||
});
|
||||
|
||||
win.webContents.on("did-fail-load", () => {
|
||||
if (is.dev()) {
|
||||
console.log("did fail load");
|
||||
}
|
||||
win.webContents.loadFile(path.join(__dirname, "error.html"));
|
||||
});
|
||||
|
||||
win.webContents.on("did-navigate-in-page", () => {
|
||||
const url = win.webContents.getURL();
|
||||
if (url.startsWith("https://music.youtube.com")) {
|
||||
@ -120,6 +129,20 @@ app.on("activate", () => {
|
||||
app.on("ready", () => {
|
||||
setApplicationMenu();
|
||||
mainWindow = createMainWindow();
|
||||
if (!is.dev()) {
|
||||
autoUpdater.checkForUpdatesAndNotify();
|
||||
autoUpdater.on("update-available", () => {
|
||||
const dialogOpts = {
|
||||
type : "info",
|
||||
buttons: ["OK"],
|
||||
title : "Application Update",
|
||||
message: "A new version is available",
|
||||
detail :
|
||||
"A new version is available and can be downloaded at https://github.com/th-ch/youtube-music/releases/latest"
|
||||
};
|
||||
electron.dialog.showMessageBox(dialogOpts);
|
||||
});
|
||||
}
|
||||
|
||||
// Optimized for Mac OS X
|
||||
if (process.platform === "darwin") {
|
||||
|
||||
1016
package-lock.json
generated
1016
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
44
package.json
44
package.json
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name" : "youtube-music",
|
||||
"productName": "YouTube Music",
|
||||
"version" : "1.0.0",
|
||||
"description": "",
|
||||
"version" : "1.1.5",
|
||||
"description": "YouTube Music Desktop App - including custom plugins",
|
||||
"license" : "MIT",
|
||||
"repository" : "th-ch/youtube-music",
|
||||
"author" : {
|
||||
@ -10,28 +10,50 @@
|
||||
"email": "th-ch@users.noreply.github.com",
|
||||
"url" : "https://github.com/th-ch/youtube-music"
|
||||
},
|
||||
"build": {
|
||||
"appId" : "com.github.th-ch.youtube-music",
|
||||
"productName": "YouTube Music",
|
||||
"mac" : {
|
||||
"identity": null,
|
||||
"icon" : "assets/generated/icons/mac/icon.icns"
|
||||
},
|
||||
"win": {
|
||||
"icon": "assets/generated/icons/win/icon.ico"
|
||||
},
|
||||
"linux": {
|
||||
"icon" : "assets/generated/icons/png",
|
||||
"category": "AudioVideo"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"test" : "xo",
|
||||
"start" : "electron .",
|
||||
"icon" : "electron-icon-maker --input=assets/youtube-music.png --output=assets/generated",
|
||||
"postinstall": "npm run icon && npm rebuild && node plugins/adblocker/generator.js && electron-rebuild",
|
||||
"build" : "electron-packager . --out=dist --asar --overwrite --all --icon=assets/generated/icons/mac/icon.icns --prune=true",
|
||||
"build:macos": "electron-packager . --platform=darwin --arch=x64 --out=dist --asar --overwrite --icon=assets/generated/icons/mac/icon.icns --prune=true"
|
||||
"test" : "xo",
|
||||
"start" : "electron .",
|
||||
"icon" : "rimraf assets/generated && electron-icon-maker --input=assets/youtube-music.png --output=assets/generated",
|
||||
"postinstall" : "npm run icon && npm rebuild && node plugins/adblocker/generator.js && electron-rebuild",
|
||||
"clean" : "rimraf dist",
|
||||
"build" : "npm run clean && build --win --mac --linux",
|
||||
"build:mac" : "npm run clean && build --mac",
|
||||
"build:win" : "npm run clean && build --win",
|
||||
"release:linux": "npm run clean && build --linux -p always",
|
||||
"release:mac" : "npm run clean && build --mac -p always",
|
||||
"release:win" : "npm run clean && build --win -p always"
|
||||
},
|
||||
"dependencies": {
|
||||
"ad-block" : "^4.1.3",
|
||||
"electron-debug" : "^2.0.0",
|
||||
"electron-is-dev" : "^1.0.1",
|
||||
"electron-is" : "^3.0.0",
|
||||
"electron-localshortcut": "^3.1.0",
|
||||
"electron-store" : "^2.0.0"
|
||||
"electron-store" : "^2.0.0",
|
||||
"electron-updater" : "^4.0.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"devtron" : "^1.4.0",
|
||||
"electron" : "^4.0.8",
|
||||
"electron-builder" : "^20.40.2",
|
||||
"electron-devtools-installer": "^2.2.4",
|
||||
"electron-icon-maker" : "0.0.4",
|
||||
"electron-packager" : "^13.1.1",
|
||||
"electron-rebuild" : "^1.8.4",
|
||||
"rimraf" : "^2.6.3",
|
||||
"xo" : "^0.24.0"
|
||||
},
|
||||
"xo": {
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
const { listenAction } = require("../utils");
|
||||
const { ACTIONS, CHANNEL } = require("./actions.js");
|
||||
const path = require("path");
|
||||
|
||||
const { injectCSS, listenAction } = require("../utils");
|
||||
const { ACTIONS, CHANNEL } = require("./actions.js");
|
||||
|
||||
function handle(win) {
|
||||
injectCSS(win.webContents, path.join(__dirname, "style.css"));
|
||||
listenAction(CHANNEL, (event, action) => {
|
||||
switch (action) {
|
||||
case ACTIONS.NEXT:
|
||||
|
||||
@ -1,14 +1,15 @@
|
||||
const { ElementFromFile, templatePath } = require('../utils');
|
||||
const { ElementFromFile, templatePath } = require("../utils");
|
||||
|
||||
function run() {
|
||||
const forwardButton = ElementFromFile(templatePath(__dirname, 'forward.html'));
|
||||
const backButton = ElementFromFile(templatePath(__dirname, 'back.html'));
|
||||
const menu = document.querySelector("ytmusic-pivot-bar-renderer");
|
||||
const forwardButton = ElementFromFile(
|
||||
templatePath(__dirname, "forward.html")
|
||||
);
|
||||
const backButton = ElementFromFile(templatePath(__dirname, "back.html"));
|
||||
const menu = document.querySelector("ytmusic-pivot-bar-renderer");
|
||||
|
||||
if (menu) {
|
||||
menu.prepend(forwardButton);
|
||||
menu.prepend(backButton);
|
||||
}
|
||||
if (menu) {
|
||||
menu.prepend(backButton, forwardButton);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = run;
|
||||
|
||||
36
plugins/navigation/style.css
Normal file
36
plugins/navigation/style.css
Normal file
@ -0,0 +1,36 @@
|
||||
.navigation-item {
|
||||
font-family : Roboto, Noto Naskh Arabic UI, Arial, sans-serif;
|
||||
font-size : 20px;
|
||||
line-height : var(--ytmusic-title-1_-_line-height);
|
||||
font-weight : 500;
|
||||
color : #fff;
|
||||
--yt-endpoint-color : #fff;
|
||||
--yt-endpoint-hover-color : #fff;
|
||||
--yt-endpoint-visited-color: #fff;
|
||||
display : inline-flex;
|
||||
align-items : center;
|
||||
color : rgba(255, 255, 255, 0.5);
|
||||
cursor : pointer;
|
||||
margin : 0 var(--ytmusic-pivot-bar-tab-margin);
|
||||
}
|
||||
|
||||
.navigation-item:hover {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.navigation-icon {
|
||||
display : inline-flex;
|
||||
-ms-flex-align : center;
|
||||
-webkit-align-items : center;
|
||||
align-items : center;
|
||||
-ms-flex-pack : center;
|
||||
-webkit-justify-content: center;
|
||||
justify-content : center;
|
||||
position : relative;
|
||||
vertical-align : middle;
|
||||
fill : var(--iron-icon-fill-color, currentcolor);
|
||||
stroke : none;
|
||||
width : var(--iron-icon-width, 24px);
|
||||
height : var(--iron-icon-height, 24px);
|
||||
animation : var(--iron-icon_-_animation);
|
||||
}
|
||||
@ -1,21 +1,51 @@
|
||||
<ytmusic-pivot-bar-item-renderer class="style-scope ytmusic-pivot-bar-renderer" tab-id="FEmusic_back" role="tab" onclick="goToPreviousPage()">
|
||||
<yt-icon 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 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>
|
||||
</yt-icon>
|
||||
<div
|
||||
class="style-scope ytmusic-pivot-bar-renderer navigation-item"
|
||||
tab-id="FEmusic_back"
|
||||
role="tab"
|
||||
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>
|
||||
|
||||
<paper-icon-button class="search-icon style-scope ytmusic-search-box" role="button" tabindex="0" aria-disabled="false" title="Go to previous page">
|
||||
<iron-icon id="icon" class="style-scope paper-icon-button">
|
||||
<svg viewBox="0 0 492 492" preserveAspectRatio="xMidYMid meet" focusable="false" class="style-scope iron-icon" style="pointer-events: none; display: block; width: 100%; height: 100%;">
|
||||
<g class="style-scope iron-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">
|
||||
</path>
|
||||
</g>
|
||||
</svg>
|
||||
</iron-icon>
|
||||
</paper-icon-button>
|
||||
</ytmusic-pivot-bar-item-renderer>
|
||||
<div
|
||||
class="search-icon style-scope ytmusic-search-box"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
aria-disabled="false"
|
||||
title="Go to previous page"
|
||||
>
|
||||
<div id="icon" class="style-scope paper-icon-button navigation-icon">
|
||||
<svg
|
||||
viewBox="0 0 492 492"
|
||||
preserveAspectRatio="xMidYMid meet"
|
||||
focusable="false"
|
||||
class="style-scope iron-icon"
|
||||
style="pointer-events: none; display: block; width: 100%; height: 100%;"
|
||||
>
|
||||
<g class="style-scope iron-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"
|
||||
></path>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,26 +1,53 @@
|
||||
<ytmusic-pivot-bar-item-renderer class="style-scope ytmusic-pivot-bar-renderer" tab-id="FEmusic_next" role="tab" onclick="goToNextPage()">
|
||||
<yt-icon 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
|
||||
<div
|
||||
class="style-scope ytmusic-pivot-bar-renderer navigation-item"
|
||||
tab-id="FEmusic_next"
|
||||
role="tab"
|
||||
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>
|
||||
</yt-icon>
|
||||
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>
|
||||
|
||||
<paper-icon-button class="search-icon style-scope ytmusic-search-box" role="button" tabindex="0" aria-disabled="false" title="Go to next page">
|
||||
<iron-icon id="icon" class="style-scope paper-icon-button">
|
||||
<svg viewBox="0 0 492 492" preserveAspectRatio="xMidYMid meet" focusable="false" class="style-scope iron-icon" style="pointer-events: none; display: block; width: 100%; height: 100%;">
|
||||
<g class="style-scope iron-icon">
|
||||
<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
|
||||
<div
|
||||
class="search-icon style-scope ytmusic-search-box"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
aria-disabled="false"
|
||||
title="Go to next page"
|
||||
>
|
||||
<div id="icon" class="style-scope paper-icon-button navigation-icon">
|
||||
<svg
|
||||
viewBox="0 0 492 492"
|
||||
preserveAspectRatio="xMidYMid meet"
|
||||
focusable="false"
|
||||
class="style-scope iron-icon"
|
||||
style="pointer-events: none; display: block; width: 100%; height: 100%;"
|
||||
>
|
||||
<g class="style-scope iron-icon">
|
||||
<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
|
||||
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">
|
||||
</path>
|
||||
</g>
|
||||
</svg>
|
||||
</iron-icon>
|
||||
</paper-icon-button>
|
||||
</ytmusic-pivot-bar-item-renderer>
|
||||
c5.1-5.1,7.9-11.9,7.8-19.1C390.5,238.7,387.8,231.9,382.7,226.8z"
|
||||
></path>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
10
preload.js
10
preload.js
@ -1,7 +1,9 @@
|
||||
const path = require("path");
|
||||
|
||||
const { getEnabledPlugins } = require("./store");
|
||||
const { fileExists } = require("./plugins/utils");
|
||||
const { getCurrentWindow } = require("electron").remote;
|
||||
|
||||
const { getEnabledPlugins, store } = require("./store");
|
||||
const { fileExists } = require("./plugins/utils");
|
||||
|
||||
const plugins = getEnabledPlugins();
|
||||
|
||||
@ -23,4 +25,8 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
run();
|
||||
});
|
||||
});
|
||||
|
||||
// Add action for reloading
|
||||
global.reload = () =>
|
||||
getCurrentWindow().webContents.loadURL(store.get("url"));
|
||||
});
|
||||
|
||||
32
readme.md
32
readme.md
@ -1,4 +1,9 @@
|
||||
# YouTube Music [](https://github.com/sindresorhus/xo)
|
||||
# YouTube Music
|
||||
[](https://GitHub.com/th-ch/youtube-music/releases/)
|
||||
[](https://github.com/th-ch/youtube-music/blob/master/LICENSE)
|
||||
[](https://github.com/sindresorhus/xo)
|
||||
[](https://ci.appveyor.com/project/th-ch/youtube-music)
|
||||
[](https://travis-ci.org/th-ch/youtube-music)
|
||||
|
||||

|
||||
|
||||
@ -7,6 +12,10 @@
|
||||
- Native look & feel, aims at keeping the original interface
|
||||
- Framework for custom plugins: change YouTube Music to your needs (style, content, features), enable/disable plugins in one click
|
||||
|
||||
## Download
|
||||
|
||||
You can check out the [latest release](https://github.com/th-ch/youtube-music/releases/latest) to quickly find the latest version.
|
||||
|
||||
## Available plugins:
|
||||
|
||||
- **Ad Blocker**: block all ads and tracking out of the box
|
||||
@ -16,7 +25,7 @@
|
||||
|
||||
## Dev
|
||||
|
||||
```
|
||||
```sh
|
||||
git clone https://github.com/th-ch/youtube-music
|
||||
cd youtube-music
|
||||
npm install
|
||||
@ -36,7 +45,7 @@ Create a folder in `plugins/YOUR-PLUGIN-NAME`:
|
||||
|
||||
- if you need to manipulate the BrowserWindow, create a file `back.js` with the following template:
|
||||
|
||||
```
|
||||
```node
|
||||
module.exports = win => {
|
||||
// win is the BrowserWindow object
|
||||
};
|
||||
@ -44,10 +53,10 @@ module.exports = win => {
|
||||
|
||||
- if you need to change the front, create a file `front.js` with the following template:
|
||||
|
||||
```
|
||||
```node
|
||||
module.exports = () => {
|
||||
// This function will be called as a preload script
|
||||
// So you can use front features like `document.querySelector`
|
||||
// So you can use front features like `document.querySelector`
|
||||
};
|
||||
```
|
||||
|
||||
@ -55,7 +64,10 @@ module.exports = () => {
|
||||
|
||||
- injecting custom CSS: create a `style.css` file in the same folder then:
|
||||
|
||||
```
|
||||
```node
|
||||
const path = require("path");
|
||||
const { injectCSS } = require("../utils");
|
||||
|
||||
// back.js
|
||||
module.exports = win => {
|
||||
injectCSS(win.webContents, path.join(__dirname, "style.css"));
|
||||
@ -64,7 +76,7 @@ module.exports = win => {
|
||||
|
||||
- changing the HTML:
|
||||
|
||||
```
|
||||
```node
|
||||
// front.js
|
||||
module.exports = () => {
|
||||
// Remove the login button
|
||||
@ -76,11 +88,11 @@ module.exports = () => {
|
||||
|
||||
## Build
|
||||
|
||||
```
|
||||
$ npm run build
|
||||
```sh
|
||||
npm run build
|
||||
```
|
||||
|
||||
Builds the app for macOS, Linux, and Windows, using [electron-packager](https://github.com/electron-userland/electron-packager).
|
||||
Builds the app for macOS, Linux, and Windows, using [electron-builder](https://github.com/electron-userland/electron-builder).
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ const store = new Store({
|
||||
height: 550
|
||||
},
|
||||
url : "https://music.youtube.com",
|
||||
plugins: ["navigation", "shortcuts", "adblocker", "no-google-login"]
|
||||
plugins: ["navigation", "shortcuts", "adblocker"]
|
||||
}
|
||||
});
|
||||
|
||||
@ -16,6 +16,6 @@ module.exports = {
|
||||
store : store,
|
||||
isPluginEnabled : plugin => plugins.isEnabled(store, plugin),
|
||||
getEnabledPlugins: () => plugins.getEnabledPlugins(store),
|
||||
enableplugin : plugin => plugins.enablePlugin(store, plugin),
|
||||
enablePlugin : plugin => plugins.enablePlugin(store, plugin),
|
||||
disablePlugin : plugin => plugins.disablePlugin(store, plugin)
|
||||
};
|
||||
|
||||
@ -26,6 +26,6 @@ function disablePlugin(store, plugin) {
|
||||
module.exports = {
|
||||
isEnabled : isEnabled,
|
||||
getEnabledPlugins: getEnabledPlugins,
|
||||
enableplugin : enablePlugin,
|
||||
disableplugin : disablePlugin
|
||||
enablePlugin : enablePlugin,
|
||||
disablePlugin : disablePlugin
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user