From cd3b8d4d9cdc8ad11173f7b163ddd9e4ee86c350 Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Thu, 11 Jan 2024 19:35:08 -0500 Subject: [PATCH] Fix update urls --- app/classes/minecraft/serverjars.py | 4 ++++ app/classes/shared/main_controller.py | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/classes/minecraft/serverjars.py b/app/classes/minecraft/serverjars.py index 55e98a80..5c6d6d91 100644 --- a/app/classes/minecraft/serverjars.py +++ b/app/classes/minecraft/serverjars.py @@ -20,6 +20,10 @@ class ServerJars: self.base_url = "https://serverjars.com" self.academy = "https://mineacademy.org" + @staticmethod + def get_mineacademy_jars(): + return MINEACADEMYJARS + def _get_api_result(self, call_url: str): full_url = f"{self.base_url}{call_url}" diff --git a/app/classes/shared/main_controller.py b/app/classes/shared/main_controller.py index ae58d988..60f3c5df 100644 --- a/app/classes/shared/main_controller.py +++ b/app/classes/shared/main_controller.py @@ -538,10 +538,17 @@ class Controller: # modded update urls from server jars will only update the installer if create_data["category"] != "modded": server_obj = self.servers.get_server_obj(new_server_id) - url = ( - f"https://serverjars.com/api/fetchJar/{create_data['category']}" - f"/{create_data['type']}/{create_data['version']}" - ) + if create_data["type"] not in ServerJars.get_mineacademy_jars(): + url = ( + "https://serverjars.com/api/fetchJar/" + f"{create_data['category']}" + f"/{create_data['type']}/{create_data['version']}" + ) + else: + url = ( + "https://mineacademy.org/api/" + f"{create_data['type']}/{create_data['version']}" + ) server_obj.executable_update_url = url self.servers.update_server(server_obj) self.server_jars.download_jar(