Skip to content

Commit

Permalink
Switch to new fields in Wago API
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed May 9, 2024
1 parent c068557 commit 34ae8b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions CB/Core.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,10 @@ def cleanup(self, directories):

def parse_url(self, url):
if url.startswith('https://addons.wago.io/addons/'):
return WagoAddonsAddon(url, self.wagoCache, 'retail' if url in self.config['IgnoreClientVersion'].keys()
else self.clientType, self.check_if_dev(url), self.config['WAAAPIKey'], self.http)
return WagoAddonsAddon(url, self.wagoCache,
'retail' if url in self.config['IgnoreClientVersion'].keys() else self.clientType,
self.masterConfig['ClientTypes'][self.clientType]['CurrentVersion'],
self.check_if_dev(url), self.config['WAAAPIKey'], self.http)
elif url.startswith('https://www.wowinterface.com/downloads/'):
return WoWInterfaceAddon(url, self.wowiCache, self.http)
elif url.startswith('https://github.com/'):
Expand Down
7 changes: 5 additions & 2 deletions CB/WagoAddons.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@

class WagoAddonsAddon:
@retry()
def __init__(self, url, checkcache, clienttype, allowdev, apikey, http):
def __init__(self, url, checkcache, clienttype, clientversion, allowdev, apikey, http):
project = url.replace('https://addons.wago.io/addons/', '')
self.http = http
self.apiKey = apikey
self.clientType = clienttype
self.clientVersion = clientversion
if project in checkcache:
self.payload = checkcache[project]
self.payload['display_name'] = self.payload['name']
Expand Down Expand Up @@ -88,7 +89,9 @@ def get_current_version(self):
release = self.payload['recent_release'][max(release, key=release.get)]

self.downloadUrl = release['download_link'] if 'download_link' in release else release['link']
self.uiVersion = release['patch'] if 'patch' in release else release[f'supported_{self.clientType}_patch']
patches = release['supported_patches'] if 'supported_patches' in release \
else release[f'supported_{self.clientType}_patches']
self.uiVersion = self.clientVersion if self.clientVersion in patches else patches[0]
self.changelogUrl = f'{self.payload["website_url"]}/versions'
self.currentVersion = release['label']

Expand Down

0 comments on commit 34ae8b9

Please sign in to comment.