Skip to content

Commit 34ae8b9

Browse files
committed
Switch to new fields in Wago API
1 parent c068557 commit 34ae8b9

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CB/Core.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,10 @@ def cleanup(self, directories):
209209

210210
def parse_url(self, url):
211211
if url.startswith('https://addons.wago.io/addons/'):
212-
return WagoAddonsAddon(url, self.wagoCache, 'retail' if url in self.config['IgnoreClientVersion'].keys()
213-
else self.clientType, self.check_if_dev(url), self.config['WAAAPIKey'], self.http)
212+
return WagoAddonsAddon(url, self.wagoCache,
213+
'retail' if url in self.config['IgnoreClientVersion'].keys() else self.clientType,
214+
self.masterConfig['ClientTypes'][self.clientType]['CurrentVersion'],
215+
self.check_if_dev(url), self.config['WAAAPIKey'], self.http)
214216
elif url.startswith('https://www.wowinterface.com/downloads/'):
215217
return WoWInterfaceAddon(url, self.wowiCache, self.http)
216218
elif url.startswith('https://github.com/'):

CB/WagoAddons.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111

1212
class WagoAddonsAddon:
1313
@retry()
14-
def __init__(self, url, checkcache, clienttype, allowdev, apikey, http):
14+
def __init__(self, url, checkcache, clienttype, clientversion, allowdev, apikey, http):
1515
project = url.replace('https://addons.wago.io/addons/', '')
1616
self.http = http
1717
self.apiKey = apikey
1818
self.clientType = clienttype
19+
self.clientVersion = clientversion
1920
if project in checkcache:
2021
self.payload = checkcache[project]
2122
self.payload['display_name'] = self.payload['name']
@@ -88,7 +89,9 @@ def get_current_version(self):
8889
release = self.payload['recent_release'][max(release, key=release.get)]
8990

9091
self.downloadUrl = release['download_link'] if 'download_link' in release else release['link']
91-
self.uiVersion = release['patch'] if 'patch' in release else release[f'supported_{self.clientType}_patch']
92+
patches = release['supported_patches'] if 'supported_patches' in release \
93+
else release[f'supported_{self.clientType}_patches']
94+
self.uiVersion = self.clientVersion if self.clientVersion in patches else patches[0]
9295
self.changelogUrl = f'{self.payload["website_url"]}/versions'
9396
self.currentVersion = release['label']
9497

0 commit comments

Comments
 (0)