From 8f26fdec2d7e280c11f9ef33cd706d7feb172ace Mon Sep 17 00:00:00 2001 From: Party Wumpus <48649272+PartyWumpus@users.noreply.github.com> Date: Fri, 10 Nov 2023 17:19:01 +0000 Subject: [PATCH] Count the number of installs for each plugin (#557) --- backend/src/browser.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/backend/src/browser.py b/backend/src/browser.py index da8569bee..966206671 100644 --- a/backend/src/browser.py +++ b/backend/src/browser.py @@ -186,6 +186,18 @@ async def _install(self, artifact: str, name: str, version: str, hash: str): else: logger.fatal(f"Could not fetch from URL. {await res.text()}") + storeUrl = "" + match self.settings.getSetting("store", 0): + case 0: storeUrl = "https://plugins.deckbrew.xyz/plugins" # default + case 1: storeUrl = "https://testing.deckbrew.xyz/plugins" # testing + case 2: storeUrl = self.settings.getSetting("store-url", "https://plugins.deckbrew.xyz/plugins") # custom + case _: storeUrl = "https://plugins.deckbrew.xyz/plugins" + logger.info(f"Incrementing installs for {name} from URL {storeUrl} (version {version})") + async with ClientSession() as client: + res = await client.post(storeUrl+f"/{name}/versions/{version}/increment?isUpdate={isInstalled}", ssl=get_ssl_context()) + if res.status != 200: + logger.error(f"Server did not accept install count increment request. code: {res.status}") + # Check to make sure we got the file if res_zip is None: logger.fatal(f"Could not fetch {artifact}")