Compare commits

...

7 Commits

Author SHA1 Message Date
TC
22c7f70c93 Adblocker: add option to disable default lists 2020-12-08 21:40:03 +01:00
TC
467171a17e Bugfix: only use cache with no additional blocklists 2020-12-06 17:55:51 +01:00
3022facbea Readme: add youtube-music logo to badges 2020-12-05 12:33:26 +01:00
a67bf5ea43 Readme: add link to releases 2020-12-05 12:31:14 +01:00
3a1a3d4241 Merge pull request #82 from hbarsaiyan/master
Add AUR badge + beautify badges
2020-12-05 12:29:26 +01:00
9197f4a0e1 Add link to AUR badge
Co-authored-by: th-ch <th-ch@users.noreply.github.com>
2020-12-05 16:18:54 +05:30
d21220693b Add AUR tag + beautify tags 2020-12-05 08:07:17 +00:00
4 changed files with 32 additions and 28 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "youtube-music", "name": "youtube-music",
"productName": "YouTube Music", "productName": "YouTube Music",
"version": "1.7.1", "version": "1.7.3",
"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",

View File

@ -3,5 +3,6 @@ module.exports = (win, options) =>
loadAdBlockerEngine( loadAdBlockerEngine(
win.webContents.session, win.webContents.session,
options.cache, options.cache,
options.additionalBlockLists options.additionalBlockLists,
options.disableDefaultLists
); );

View File

@ -1,4 +1,4 @@
const { existsSync, promises, unlinkSync } = require("fs"); // used for caching const { promises } = require("fs"); // used for caching
const path = require("path"); const path = require("path");
const { ElectronBlocker } = require("@cliqz/adblocker-electron"); const { ElectronBlocker } = require("@cliqz/adblocker-electron");
@ -11,26 +11,24 @@ const SOURCES = [
const loadAdBlockerEngine = ( const loadAdBlockerEngine = (
session = undefined, session = undefined,
cache = true, cache = true,
additionalBlockLists = [] additionalBlockLists = [],
disableDefaultLists = false
) => { ) => {
const adBlockerCache = path.resolve(__dirname, "ad-blocker-engine.bin"); // Only use cache if no additional blocklists are passed
if (!cache && existsSync(adBlockerCache)) { const cachingOptions =
unlinkSync(adBlockerCache); cache && additionalBlockLists.length === 0
} ? {
const cachingOptions = cache path: path.resolve(__dirname, "ad-blocker-engine.bin"),
? { read: promises.readFile,
path: adBlockerCache, write: promises.writeFile,
read: promises.readFile, }
write: promises.writeFile, : undefined;
} const lists = [
: undefined; ...(disableDefaultLists ? [] : SOURCES),
...additionalBlockLists,
];
ElectronBlocker.fromLists( ElectronBlocker.fromLists(fetch, lists, {}, cachingOptions)
fetch,
[...SOURCES, ...additionalBlockLists],
{},
cachingOptions
)
.then((blocker) => { .then((blocker) => {
if (session) { if (session) {
blocker.enableBlockingInSession(session); blocker.enableBlockingInSession(session);

View File

@ -1,11 +1,16 @@
# YouTube Music # YouTube Music
[![GitHub release](https://img.shields.io/github/release/th-ch/youtube-music.svg)](https://GitHub.com/th-ch/youtube-music/releases/) <div align="center">
[![GitHub license](https://img.shields.io/github/license/th-ch/youtube-music.svg)](https://github.com/th-ch/youtube-music/blob/master/LICENSE)
[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo) [![GitHub release](https://img.shields.io/github/release/th-ch/youtube-music.svg?style=for-the-badge&logo=youtube-music)](https://github.com/th-ch/youtube-music/releases/)
[![Build status](https://github.com/th-ch/youtube-music/workflows/Build%20YouTube%20Music/badge.svg)](https://GitHub.com/th-ch/youtube-music/releases/) [![GitHub license](https://img.shields.io/github/license/th-ch/youtube-music.svg?style=for-the-badge)](https://github.com/th-ch/youtube-music/blob/master/LICENSE)
[![Known Vulnerabilities](https://snyk.io/test/github/th-ch/youtube-music/badge.svg)](https://snyk.io/test/github/th-ch/youtube-music) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg?style=for-the-badge)](https://github.com/sindresorhus/xo)
![GitHub All Releases](https://img.shields.io/github/downloads/th-ch/youtube-music/total) [![Build status](https://img.shields.io/github/workflow/status/th-ch/youtube-music/Build%20YouTube%20Music?style=for-the-badge&logo=youtube-music)](https://GitHub.com/th-ch/youtube-music/releases/)
[![Known Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/github/th-ch/youtube-music?style=for-the-badge)](https://snyk.io/test/github/th-ch/youtube-music)
[![GitHub All Releases](https://img.shields.io/github/downloads/th-ch/youtube-music/total?style=for-the-badge&logo=youtube-music)](https://GitHub.com/th-ch/youtube-music/releases/)
[![AUR](https://img.shields.io/aur/version/youtube-music-bin?color=blueviolet&style=for-the-badge&logo=youtube-music)](https://aur.archlinux.org/packages/youtube-music-bin)
</div>
![Screenshot](screenshot.jpg "Screenshot") ![Screenshot](screenshot.jpg "Screenshot")
@ -18,7 +23,7 @@
You can check out the [latest release](https://github.com/th-ch/youtube-music/releases/latest) to quickly find the latest version. You can check out the [latest release](https://github.com/th-ch/youtube-music/releases/latest) to quickly find the latest version.
**Arch Linux** ### Arch Linux
Install the `youtube-music-bin` package from the AUR. For AUR installation instructions, take a look at this [wiki page](https://wiki.archlinux.org/index.php/Arch_User_Repository#Installing_packages). Install the `youtube-music-bin` package from the AUR. For AUR installation instructions, take a look at this [wiki page](https://wiki.archlinux.org/index.php/Arch_User_Repository#Installing_packages).