Skip to content

Commit

Permalink
Implemented simple blocklist
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Oct 6, 2020
1 parent 3faa736 commit 544828d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CB/Core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion CB/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>'
__docformat__ = 'restructuredtext en'
Expand Down

0 comments on commit 544828d

Please sign in to comment.