Merge branch 'dev' into bug/unzip-firefox

This commit is contained in:
Zedifus 2022-07-05 23:47:27 +01:00
commit 3719d3f24f
4 changed files with 34 additions and 24 deletions

View File

@ -4,7 +4,9 @@
### New features
None
### Bug fixes
None
- Remove redundant path check on backup restore ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/390))
- Fix issue with stats pinging on slow starting servers ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/391))
- Fix unhandled exeption when serverjars api returns 'None' ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/392))
### Tweaks
None
### Lang

View File

@ -266,14 +266,24 @@ class Stats:
"Unable to read the server icon due to the following error:", exc_info=e
)
if ping_obj:
ping_data = {
"online": online_stats.get("online", 0),
"max": online_stats.get("max", 0),
"players": online_stats.get("players", 0),
"server_description": ping_obj.description,
"server_version": ping_obj.version,
"server_icon": server_icon,
}
try:
ping_data = {
"online": online_stats.get("online", 0),
"max": online_stats.get("max", 0),
"players": online_stats.get("players", 0),
"server_description": ping_obj.description,
"server_version": ping_obj.version,
"server_icon": server_icon,
}
except:
ping_data = {
"online": online_stats.get("online", 0),
"max": online_stats.get("max", 0),
"players": online_stats.get("players", 0),
"server_description": "",
"server_version": "",
"server_icon": server_icon,
}
else:
ping_data = {
"online": online_stats.get("online", 0),

View File

@ -783,26 +783,21 @@ class Controller:
def rename_backup_dir(self, old_server_id, new_server_id, new_uuid):
server_data = self.servers.get_server_data_by_id(old_server_id)
server_obj = self.servers.get_server_obj(new_server_id)
old_bu_path = server_data["backup_path"]
ServerPermsController.backup_role_swap(old_server_id, new_server_id)
if not Helpers.is_os_windows():
backup_path = Helpers.validate_traversal(
self.helper.backup_path, old_bu_path
)
if Helpers.is_os_windows():
backup_path = Helpers.validate_traversal(
Helpers.wtol_path(self.helper.backup_path),
Helpers.wtol_path(old_bu_path),
)
backup_path = Helpers.wtol_path(str(backup_path))
backup_path.replace(" ", "^ ")
backup_path = Path(backup_path)
backup_path = old_bu_path
backup_path = Path(backup_path)
backup_path_components = list(backup_path.parts)
backup_path_components[-1] = new_uuid
new_bu_path = pathlib.PurePath(os.path.join(*backup_path_components))
if os.path.isdir(new_bu_path):
if Helpers.validate_traversal(self.helper.backup_path, new_bu_path):
os.rmdir(new_bu_path)
server_obj.backup_path = new_bu_path
default_backup_dir = os.path.join(self.helper.backup_path, new_uuid)
try:
os.rmdir(default_backup_dir)
except:
logger.error("Could not delete default backup dir")
self.servers.update_server(server_obj)
backup_path.rename(new_bu_path)
def register_server(

View File

@ -156,6 +156,9 @@ class ServerHandler(BaseHandler):
page_data["js_server_types"] = json.dumps(
self.controller.server_jars.get_serverjar_data()
)
if page_data["server_types"] is None:
page_data["server_types"] = []
page_data["js_server_types"] = []
template = "server/wizard.html"
if page == "bedrock_step1":