From 34ae8b9bdfd6b3545ccff406e667b38becb4c898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Thu, 9 May 2024 07:34:09 +0200 Subject: [PATCH] Switch to new fields in Wago API --- CB/Core.py | 6 ++++-- CB/WagoAddons.py | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CB/Core.py b/CB/Core.py index 2c9a462..c76e215 100644 --- a/CB/Core.py +++ b/CB/Core.py @@ -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/'): diff --git a/CB/WagoAddons.py b/CB/WagoAddons.py index b3354be..f8664a2 100644 --- a/CB/WagoAddons.py +++ b/CB/WagoAddons.py @@ -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'] @@ -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']