Fix update urls

This commit is contained in:
amcmanu3 2024-01-11 19:35:08 -05:00
parent e274b0c677
commit cd3b8d4d9c
2 changed files with 15 additions and 4 deletions

View File

@ -20,6 +20,10 @@ class ServerJars:
self.base_url = "https://serverjars.com" self.base_url = "https://serverjars.com"
self.academy = "https://mineacademy.org" self.academy = "https://mineacademy.org"
@staticmethod
def get_mineacademy_jars():
return MINEACADEMYJARS
def _get_api_result(self, call_url: str): def _get_api_result(self, call_url: str):
full_url = f"{self.base_url}{call_url}" full_url = f"{self.base_url}{call_url}"

View File

@ -538,10 +538,17 @@ class Controller:
# modded update urls from server jars will only update the installer # modded update urls from server jars will only update the installer
if create_data["category"] != "modded": if create_data["category"] != "modded":
server_obj = self.servers.get_server_obj(new_server_id) server_obj = self.servers.get_server_obj(new_server_id)
url = ( if create_data["type"] not in ServerJars.get_mineacademy_jars():
f"https://serverjars.com/api/fetchJar/{create_data['category']}" url = (
f"/{create_data['type']}/{create_data['version']}" "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 server_obj.executable_update_url = url
self.servers.update_server(server_obj) self.servers.update_server(server_obj)
self.server_jars.download_jar( self.server_jars.download_jar(