Skip to content

Commit

Permalink
Improved handling of unsupported addon sources (close #332)
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Jul 5, 2022
1 parent 677e3e4 commit 75a4426
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
16 changes: 9 additions & 7 deletions CB/Core.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,9 @@ def parse_url(self, url):
else:
raise RuntimeError('Incorrect client version.')
elif url.startswith('https://www.townlong-yak.com/addons/'):
raise RuntimeError(f'{url}\nTownlong Yak is no longer supported by this application.'
f'\nPlease uninstall this addon and install it from different source.')
raise RuntimeError(f'{url}\nTownlong Yak is no longer supported by this application.')
elif url.startswith('https://www.curseforge.com/wow/addons/'):
raise RuntimeError(f'{url}\nCurseForge is no longer supported by this application.'
f'\nPlease uninstall this addon and install it from different source.')
raise RuntimeError(f'{url}\nCurseForge is no longer supported by this application.')
else:
raise NotImplementedError('Provided URL is not supported.')

Expand Down Expand Up @@ -326,15 +324,19 @@ def del_addon(self, url, keep):
def update_addon(self, url, update, force):
old = self.check_if_installed(url)
if old:
new = self.parse_url(old['URL'])
dev = self.check_if_dev(old['URL'])
source, sourceurl = self.parse_url_source(old['URL'])
blocked = self.check_if_blocked(old)
oldversion = old['Version']
if old['URL'] in self.checksumCache:
modified = self.checksumCache[old['URL']]
else:
modified = self.check_checksum(old, False)
blocked = self.check_if_blocked(old)
if old['URL'].startswith(('https://www.townlong-yak.com/addons/',
'https://www.curseforge.com/wow/addons/')):
return old['Name'], [], oldversion, oldversion, None, modified, blocked, 'Unsupported', old['URL'],\
None, dev
source, sourceurl = self.parse_url_source(old['URL'])
new = self.parse_url(old['URL'])
if force or (new.currentVersion != old['Version'] and update and not modified and not blocked):
new.get_addon()
self.cleanup(old['Directories'])
Expand Down
4 changes: 3 additions & 1 deletion CurseBreaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,8 @@ def c_update(self, args, addline=False, update=True, force=False, provider=False
addon if isinstance(addon, str) else addon['URL'], update, force)
if provider:
source = f' [bold white]{source}[/bold white]'
elif source == 'Unsupported':
source = f' [bold red]{source.upper()}[/bold red]'
else:
source = ''
if versionold:
Expand All @@ -533,7 +535,7 @@ def c_update(self, args, addline=False, update=True, force=False, provider=False
self.parse_link(versionold, changelog, dstate,
uiversion=uiversion))
else:
if compact and compacted > -1:
if compact and compacted > -1 and 'unsupported' not in source.lower():
compacted += 1
else:
self.table.add_row(f'[green]Up-to-date[/green]{source}',
Expand Down

0 comments on commit 75a4426

Please sign in to comment.