Merge branch 'feature/update-url-autoset' into 'dev'

Automatically set update url for server creation

See merge request crafty-controller/crafty-4!487
This commit is contained in:
Iain Powrie 2022-10-22 19:21:01 +00:00
commit 4cdbb99166
2 changed files with 17 additions and 3 deletions

View File

@ -1,7 +1,7 @@
# Changelog # Changelog
## --- [4.0.16] - 2022/10/09 ## --- [4.0.16] - 2022/10/23
### New features ### New features
TBD - Automatically set update url for (new) server creation ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/487))
### Bug fixes ### Bug fixes
- Fix conditional issue with zip imports/uploads ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/476)) - Fix conditional issue with zip imports/uploads ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/476))
- Fix API Schedule updates ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/478)) - Fix API Schedule updates ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/478))

View File

@ -419,6 +419,15 @@ class Controller:
data["create_type"] == "minecraft_java" data["create_type"] == "minecraft_java"
and root_create_data["create_type"] == "download_jar" and root_create_data["create_type"] == "download_jar"
): ):
# 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']}"
)
server_obj.executable_update_url = url
self.servers.update_server(server_obj)
self.server_jars.download_jar( self.server_jars.download_jar(
create_data["category"], create_data["category"],
create_data["type"], create_data["type"],
@ -502,7 +511,12 @@ class Controller:
user_id, user_id,
server_type="minecraft-java", server_type="minecraft-java",
) )
# modded update urls from server jars will only update the installer
if jar != "modded":
server_obj = self.servers.get_server_obj(new_id)
url = f"https://serverjars.com/api/fetchJar/{jar}/{server}/{version}"
server_obj.executable_update_url = url
self.servers.update_server(server_obj)
# download the jar # download the jar
self.server_jars.download_jar( self.server_jars.download_jar(
jar, server, version, os.path.join(server_dir, server_file), new_id jar, server, version, os.path.join(server_dir, server_file), new_id