mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 19:31:46 +00:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| eac2c5cf14 | |||
| 5a1d7fbf23 | |||
| 15275236b0 | |||
| 639ae28122 | |||
| d3453a600b | |||
| caf76e7588 | |||
| 2d3f77d962 | |||
| 5279a45f35 | |||
| e52e522d22 | |||
| aa3e4b32eb | |||
| eb63917b5d | |||
| 6e037483c7 | |||
| 941477bb0c | |||
| abc2bb8a4f | |||
| 253e82a2d7 |
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
|
||||||
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>
|
||||||
7
index.js
7
index.js
@ -72,6 +72,13 @@ function createMainWindow() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
win.webContents.on("did-fail-load", () => {
|
||||||
|
if (isDev) {
|
||||||
|
console.log("did fail load");
|
||||||
|
}
|
||||||
|
win.webContents.loadFile(path.join(__dirname, "error.html"));
|
||||||
|
});
|
||||||
|
|
||||||
win.webContents.on("did-navigate-in-page", () => {
|
win.webContents.on("did-navigate-in-page", () => {
|
||||||
const url = win.webContents.getURL();
|
const url = win.webContents.getURL();
|
||||||
if (url.startsWith("https://music.youtube.com")) {
|
if (url.startsWith("https://music.youtube.com")) {
|
||||||
|
|||||||
643
package-lock.json
generated
643
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
23
package.json
23
package.json
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name" : "youtube-music",
|
"name" : "youtube-music",
|
||||||
"productName": "YouTube Music",
|
"productName": "YouTube Music",
|
||||||
"version" : "1.1.0",
|
"version" : "1.1.2",
|
||||||
"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",
|
||||||
@ -22,18 +22,21 @@
|
|||||||
},
|
},
|
||||||
"linux": {
|
"linux": {
|
||||||
"icon" : "assets/generated/icons/png",
|
"icon" : "assets/generated/icons/png",
|
||||||
"category": "Audio"
|
"category": "AudioVideo"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test" : "xo",
|
"test" : "xo",
|
||||||
"start" : "electron .",
|
"start" : "electron .",
|
||||||
"icon" : "rimraf assets/generated && electron-icon-maker --input=assets/youtube-music.png --output=assets/generated",
|
"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",
|
"postinstall" : "npm run icon && npm rebuild && node plugins/adblocker/generator.js && electron-rebuild",
|
||||||
"clean" : "rimraf dist",
|
"clean" : "rimraf dist",
|
||||||
"build" : "npm run clean && build --win --mac --linux",
|
"build" : "npm run clean && build --win --mac --linux",
|
||||||
"build:mac" : "npm run clean && build --mac",
|
"build:mac" : "npm run clean && build --mac",
|
||||||
"release" : "npm run clean && build --win --mac --linux -p always"
|
"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": {
|
"dependencies": {
|
||||||
"ad-block" : "^4.1.3",
|
"ad-block" : "^4.1.3",
|
||||||
|
|||||||
10
preload.js
10
preload.js
@ -1,7 +1,9 @@
|
|||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
const { getEnabledPlugins } = require("./store");
|
const { getCurrentWindow } = require("electron").remote;
|
||||||
const { fileExists } = require("./plugins/utils");
|
|
||||||
|
const { getEnabledPlugins, store } = require("./store");
|
||||||
|
const { fileExists } = require("./plugins/utils");
|
||||||
|
|
||||||
const plugins = getEnabledPlugins();
|
const plugins = getEnabledPlugins();
|
||||||
|
|
||||||
@ -23,4 +25,8 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
run();
|
run();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Add action for reloading
|
||||||
|
global.reload = () =>
|
||||||
|
getCurrentWindow().webContents.loadURL(store.get("url"));
|
||||||
});
|
});
|
||||||
|
|||||||
17
readme.md
17
readme.md
@ -2,6 +2,8 @@
|
|||||||
[](https://GitHub.com/th-ch/youtube-music/releases/)
|
[](https://GitHub.com/th-ch/youtube-music/releases/)
|
||||||
[](https://github.com/th-ch/youtube-music/blob/master/LICENSE)
|
[](https://github.com/th-ch/youtube-music/blob/master/LICENSE)
|
||||||
[](https://github.com/sindresorhus/xo)
|
[](https://github.com/sindresorhus/xo)
|
||||||
|
[](https://ci.appveyor.com/project/th-ch/youtube-music)
|
||||||
|
[](https://travis-ci.org/th-ch/youtube-music)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@ -28,7 +30,7 @@ Here are the links to the current version:
|
|||||||
|
|
||||||
## Dev
|
## Dev
|
||||||
|
|
||||||
```
|
```sh
|
||||||
git clone https://github.com/th-ch/youtube-music
|
git clone https://github.com/th-ch/youtube-music
|
||||||
cd youtube-music
|
cd youtube-music
|
||||||
npm install
|
npm install
|
||||||
@ -48,7 +50,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:
|
- if you need to manipulate the BrowserWindow, create a file `back.js` with the following template:
|
||||||
|
|
||||||
```
|
```node
|
||||||
module.exports = win => {
|
module.exports = win => {
|
||||||
// win is the BrowserWindow object
|
// win is the BrowserWindow object
|
||||||
};
|
};
|
||||||
@ -56,7 +58,7 @@ module.exports = win => {
|
|||||||
|
|
||||||
- if you need to change the front, create a file `front.js` with the following template:
|
- if you need to change the front, create a file `front.js` with the following template:
|
||||||
|
|
||||||
```
|
```node
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
// This function will be called as a preload script
|
// 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`
|
||||||
@ -67,7 +69,10 @@ module.exports = () => {
|
|||||||
|
|
||||||
- injecting custom CSS: create a `style.css` file in the same folder then:
|
- injecting custom CSS: create a `style.css` file in the same folder then:
|
||||||
|
|
||||||
```
|
```node
|
||||||
|
const path = require("path");
|
||||||
|
const { injectCSS } = require("../utils");
|
||||||
|
|
||||||
// back.js
|
// back.js
|
||||||
module.exports = win => {
|
module.exports = win => {
|
||||||
injectCSS(win.webContents, path.join(__dirname, "style.css"));
|
injectCSS(win.webContents, path.join(__dirname, "style.css"));
|
||||||
@ -76,7 +81,7 @@ module.exports = win => {
|
|||||||
|
|
||||||
- changing the HTML:
|
- changing the HTML:
|
||||||
|
|
||||||
```
|
```node
|
||||||
// front.js
|
// front.js
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
// Remove the login button
|
// Remove the login button
|
||||||
@ -88,7 +93,7 @@ module.exports = () => {
|
|||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
```
|
```sh
|
||||||
npm run build
|
npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user