From 544828d06bdf378d1123388aa729e7875ca11ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Tue, 6 Oct 2020 16:13:01 +0200 Subject: [PATCH] Implemented simple blocklist --- CB/Core.py | 7 +++++++ CB/__init__.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CB/Core.py b/CB/Core.py index b902d91..81814dc 100644 --- a/CB/Core.py +++ b/CB/Core.py @@ -39,6 +39,7 @@ def __init__(self): self.cfIDs = None self.cfDirs = None self.cfDirsCompact = None + self.blocklist = None self.cfCache = {} self.wowiCache = {} self.checksumCache = {} @@ -164,6 +165,12 @@ def cleanup(self, directories): shutil.rmtree(self.path / directory, ignore_errors=True) def parse_url(self, url): + if not self.blocklist: + self.blocklist = pickle.load(gzip.open(io.BytesIO(requests.get( + f'https://storage.googleapis.com/cursebreaker/blocklist.pickle.gz', headers=HEADERS).content))) + for block in self.blocklist: + if block in url.lower(): + raise RuntimeError(f'{url}\nThe addon is unavailable. You can\'t manage it with this application.') if url.startswith('https://www.curseforge.com/wow/addons/'): return CurseForgeAddon(url, self.parse_cf_id(url), self.cfCache, 'wow' if url in self.config['IgnoreClientVersion'].keys() else self.clientType, diff --git a/CB/__init__.py b/CB/__init__.py index 6537d71..bf4dc2b 100644 --- a/CB/__init__.py +++ b/CB/__init__.py @@ -2,7 +2,7 @@ import random from rich.terminal_theme import TerminalTheme -__version__ = '3.11.0' +__version__ = '3.11.1' __license__ = 'GPLv3' __copyright__ = '2019-2020, Paweł Jastrzębski ' __docformat__ = 'restructuredtext en'