diff --git a/CHANGELOG.md b/CHANGELOG.md
index ee86b2be..266ec6bf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,7 +1,7 @@
# Changelog
## --- [4.2.0] - 2023/TBD
### New features
-- Finish and Activate Arcadia notification backend ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/621) | [Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/626))
+- Finish and Activate Arcadia notification backend ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/621) | [Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/626) | [Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/632))
### Bug fixes
- PWA: Removed the custom offline page in favour of browser default ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/607))
- Fix hidden servers appearing visible on public mobile status page ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/612))
@@ -11,6 +11,7 @@
- Fix select installs failing to start, returning missing python package `packaging` ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/629))
- Fix public status page not updating #255 ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/615))
- Fix service worker vulrn and CQ raised by SonarQ ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/631))
+- Fix Backup Restore/Schedules, Backup button function on `remote-comms2` ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/634))
### Refactor
- Consolidate remaining frontend functions into API V2, and remove ajax internal API ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/585))
- Replace bleach with nh3 ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/628))
@@ -21,6 +22,7 @@
- Add get_users command to Crafty's console ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/620))
- Make files hover cursor pointer ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/627))
- Use `Jar` class naming for jar refresh to make room for steamCMD naming in the future ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/630))
+- Improve ui visibility of Build Wizard selection tabs ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/633))
### Lang
TBD
diff --git a/app/classes/shared/main_controller.py b/app/classes/shared/main_controller.py
index 4100b21e..541e45ad 100644
--- a/app/classes/shared/main_controller.py
+++ b/app/classes/shared/main_controller.py
@@ -594,6 +594,66 @@ class Controller:
return False
return True
+ def restore_java_zip_server(
+ self,
+ server_name: str,
+ zip_path: str,
+ server_jar: str,
+ min_mem: int,
+ max_mem: int,
+ port: int,
+ user_id: int,
+ ):
+ server_id = Helpers.create_uuid()
+ new_server_dir = os.path.join(self.helper.servers_dir, server_id)
+ backup_path = os.path.join(self.helper.backup_path, server_id)
+ if Helpers.is_os_windows():
+ new_server_dir = Helpers.wtol_path(new_server_dir)
+ backup_path = Helpers.wtol_path(backup_path)
+ new_server_dir.replace(" ", "^ ")
+ backup_path.replace(" ", "^ ")
+
+ temp_dir = Helpers.get_os_understandable_path(zip_path)
+ Helpers.ensure_dir_exists(new_server_dir)
+ Helpers.ensure_dir_exists(backup_path)
+
+ full_jar_path = os.path.join(new_server_dir, server_jar)
+
+ if Helpers.is_os_windows():
+ server_command = (
+ f"java -Xms{Helpers.float_to_string(min_mem)}M "
+ f"-Xmx{Helpers.float_to_string(max_mem)}M "
+ f'-jar "{full_jar_path}" nogui'
+ )
+ else:
+ server_command = (
+ f"java -Xms{Helpers.float_to_string(min_mem)}M "
+ f"-Xmx{Helpers.float_to_string(max_mem)}M "
+ f"-jar {full_jar_path} nogui"
+ )
+ logger.debug("command: " + server_command)
+ server_log_file = "./logs/latest.log"
+ server_stop = "stop"
+
+ new_id = self.register_server(
+ server_name,
+ server_id,
+ new_server_dir,
+ backup_path,
+ server_command,
+ server_jar,
+ server_log_file,
+ server_stop,
+ port,
+ user_id,
+ server_type="minecraft-java",
+ )
+ ServersController.set_import(new_id)
+ self.import_helper.import_java_zip_server(
+ temp_dir, new_server_dir, port, new_id
+ )
+ return new_id
+
# **********************************************************************************
# BEDROCK IMPORTS
# **********************************************************************************
@@ -691,7 +751,7 @@ class Controller:
self.import_helper.download_bedrock_server(new_server_dir, new_id)
return new_id
- def import_bedrock_zip_server(
+ def restore_bedrock_zip_server(
self,
server_name: str,
zip_path: str,
@@ -836,6 +896,7 @@ class Controller:
srv_obj = server["server_obj"]
srv_obj.server_scheduler.shutdown()
+ srv_obj.dir_scheduler.shutdown()
running = srv_obj.check_running()
if running:
diff --git a/app/classes/shared/server.py b/app/classes/shared/server.py
index 717939db..72c41e65 100644
--- a/app/classes/shared/server.py
+++ b/app/classes/shared/server.py
@@ -1048,13 +1048,6 @@ class ServerInstance:
logger.info(f"Backup Thread started for server {self.settings['server_name']}.")
def a_backup_server(self):
- if len(WebSocketManager().clients) > 0:
- WebSocketManager().broadcast_page_params(
- "/panel/server_detail",
- {"id": str(self.server_id)},
- "backup_reload",
- {"percent": 0, "total_files": 0},
- )
was_server_running = None
logger.info(f"Starting server {self.name} (ID {self.server_id}) backup")
server_users = PermissionsServers.get_server_user_list(self.server_id)
@@ -1567,7 +1560,6 @@ class ServerInstance:
# process stats
p_stats = Stats._try_get_process_stats(self.process, self.check_running())
-
internal_ip = server["server_ip"]
server_port = server["server_port"]
server_name = server.get("server_name", f"ID#{server_id}")
diff --git a/app/classes/shared/tasks.py b/app/classes/shared/tasks.py
index 28e932be..c89be9d8 100644
--- a/app/classes/shared/tasks.py
+++ b/app/classes/shared/tasks.py
@@ -102,7 +102,7 @@ class TasksManager:
)
except:
logger.error(
- "Server value requested does not exist! "
+ f"Server value {cmd['server_id']} requested does not exist! "
"Purging item from waiting commands."
)
continue
diff --git a/app/classes/web/routes/api/servers/server/backups/backup/index.py b/app/classes/web/routes/api/servers/server/backups/backup/index.py
index 20a9ded0..b92e1e9f 100644
--- a/app/classes/web/routes/api/servers/server/backups/backup/index.py
+++ b/app/classes/web/routes/api/servers/server/backups/backup/index.py
@@ -121,11 +121,11 @@ class ApiServersServerBackupsBackupIndexHandler(BaseApiHandler):
server_data = self.controller.servers.get_server_data_by_id(server_id)
zip_name = data["filename"]
# import the server again based on zipfile
- if server_data["type"] == "minecraft-java":
- backup_path = svr_obj.backup_path
- if Helpers.validate_traversal(backup_path, zip_name):
- temp_dir = Helpers.unzip_backup_archive(backup_path, zip_name)
- new_server = self.controller.import_zip_server(
+ backup_path = svr_obj.backup_path
+ if Helpers.validate_traversal(backup_path, zip_name):
+ temp_dir = Helpers.unzip_backup_archive(backup_path, zip_name)
+ if server_data["type"] == "minecraft-java":
+ new_server = self.controller.restore_java_zip_server(
svr_obj.server_name,
temp_dir,
server_data["executable"],
@@ -134,71 +134,78 @@ class ApiServersServerBackupsBackupIndexHandler(BaseApiHandler):
server_data["server_port"],
server_data["created_by"],
)
- new_server_id = new_server
- new_server = self.controller.servers.get_server_data(new_server)
- self.controller.rename_backup_dir(
- server_id, new_server_id, new_server["server_uuid"]
+ elif server_data["type"] == "minecraft-bedrock":
+ new_server = self.controller.restore_bedrock_zip_server(
+ svr_obj.server_name,
+ temp_dir,
+ server_data["executable"],
+ server_data["server_port"],
+ server_data["created_by"],
)
- # preserve current schedules
- for schedule in self.controller.management.get_schedules_by_server(
- server_id
- ):
- self.tasks_manager.update_job(
- schedule.schedule_id, {"server_id": new_server_id}
- )
- # preserve execution command
- new_server_obj = self.controller.servers.get_server_obj(
- new_server_id
+ new_server_id = new_server
+ new_server = self.controller.servers.get_server_data(new_server)
+ self.controller.rename_backup_dir(
+ server_id, new_server_id, new_server["server_uuid"]
+ )
+ # preserve current schedules
+ for schedule in self.controller.management.get_schedules_by_server(
+ server_id
+ ):
+ job_data = self.controller.management.get_scheduled_task(
+ schedule.schedule_id
)
- new_server_obj.execution_command = server_data["execution_command"]
- # reset executable path
- if svr_obj.path in svr_obj.executable:
- new_server_obj.executable = str(svr_obj.executable).replace(
- svr_obj.path, new_server_obj.path
- )
- # reset run command path
- if svr_obj.path in svr_obj.execution_command:
- new_server_obj.execution_command = str(
- svr_obj.execution_command
- ).replace(svr_obj.path, new_server_obj.path)
- # reset log path
- if svr_obj.path in svr_obj.log_path:
- new_server_obj.log_path = str(svr_obj.log_path).replace(
- svr_obj.path, new_server_obj.path
- )
- self.controller.servers.update_server(new_server_obj)
+ job_data["server_id"] = new_server_id
+ del job_data["schedule_id"]
+ self.tasks_manager.update_job(schedule.schedule_id, job_data)
+ # preserve execution command
+ new_server_obj = self.controller.servers.get_server_obj(new_server_id)
+ new_server_obj.execution_command = server_data["execution_command"]
+ # reset executable path
+ if svr_obj.path in svr_obj.executable:
+ new_server_obj.executable = str(svr_obj.executable).replace(
+ svr_obj.path, new_server_obj.path
+ )
+ # reset run command path
+ if svr_obj.path in svr_obj.execution_command:
+ new_server_obj.execution_command = str(
+ svr_obj.execution_command
+ ).replace(svr_obj.path, new_server_obj.path)
+ # reset log path
+ if svr_obj.path in svr_obj.log_path:
+ new_server_obj.log_path = str(svr_obj.log_path).replace(
+ svr_obj.path, new_server_obj.path
+ )
+ self.controller.servers.update_server(new_server_obj)
- # preserve backup config
- backup_config = self.controller.management.get_backup_config(
- server_id
- )
- excluded_dirs = []
- server_obj = self.controller.servers.get_server_obj(server_id)
- loop_backup_path = self.helper.wtol_path(server_obj.path)
- for item in self.controller.management.get_excluded_backup_dirs(
- server_id
- ):
- item_path = self.helper.wtol_path(item)
- bu_path = os.path.relpath(item_path, loop_backup_path)
- bu_path = os.path.join(new_server_obj.path, bu_path)
- excluded_dirs.append(bu_path)
- self.controller.management.set_backup_config(
- new_server_id,
- new_server_obj.backup_path,
- backup_config["max_backups"],
- excluded_dirs,
- backup_config["compress"],
- backup_config["shutdown"],
- )
- # remove old server's tasks
- try:
- self.tasks_manager.remove_all_server_tasks(server_id)
- except JobLookupError as e:
- logger.info("No active tasks found for server: {e}")
- self.controller.remove_server(server_id, True)
- except Exception:
+ # preserve backup config
+ backup_config = self.controller.management.get_backup_config(server_id)
+ excluded_dirs = []
+ server_obj = self.controller.servers.get_server_obj(server_id)
+ loop_backup_path = self.helper.wtol_path(server_obj.path)
+ for item in self.controller.management.get_excluded_backup_dirs(
+ server_id
+ ):
+ item_path = self.helper.wtol_path(item)
+ bu_path = os.path.relpath(item_path, loop_backup_path)
+ bu_path = os.path.join(new_server_obj.path, bu_path)
+ excluded_dirs.append(bu_path)
+ self.controller.management.set_backup_config(
+ new_server_id,
+ new_server_obj.backup_path,
+ backup_config["max_backups"],
+ excluded_dirs,
+ backup_config["compress"],
+ backup_config["shutdown"],
+ )
+ # remove old server's tasks
+ try:
+ self.tasks_manager.remove_all_server_tasks(server_id)
+ except JobLookupError as e:
+ logger.info("No active tasks found for server: {e}")
+ self.controller.remove_server(server_id, True)
+ except Exception as e:
return self.finish_json(
- 400, {"status": "error", "error": "NO BACKUP FOUND"}
+ 400, {"status": "error", "error": f"NO BACKUP FOUND {e}"}
)
self.controller.management.add_to_audit_log(
auth_data[4]["user_id"],
diff --git a/app/frontend/static/assets/css/dark/style.css b/app/frontend/static/assets/css/dark/style.css
index c8ac5eb9..12320636 100755
--- a/app/frontend/static/assets/css/dark/style.css
+++ b/app/frontend/static/assets/css/dark/style.css
@@ -22979,27 +22979,42 @@ ul li {
padding-left: 0;
}
-.tab-simple-styled {
+.nav-tabs.tab-simple-styled {
border-bottom: none;
margin-top: 30px;
margin-bottom: 30px;
}
-.tab-simple-styled .nav-item {
+.nav-tabs.tab-simple-styled .nav-item {
margin-right: 30px;
}
-.tab-simple-styled .nav-item .nav-link {
+.nav-tabs.tab-simple-styled .nav-item .nav-link {
border: none;
padding: 0;
color: var(--base-text);
}
-.tab-simple-styled .nav-item .nav-link.active {
+.nav-tabs.tab-simple-styled .nav-item .nav-link.active {
background: var(--dropdown-bg);
color: var(--info);
}
+.nav-pills.tab-simple-styled {
+ border-bottom: none;
+ /*margin-top: 1.5rem;*/
+ margin-bottom: 1.5rem;
+}
+
+/*.nav-pills.tab-simple-styled .nav-item {
+ margin-right: 1.5rem;
+}*/
+
+.nav-pills.tab-simple-styled .nav-item .nav-link.active {
+ background: var(--info);
+ color: #ffffff;
+}
+
.tab-tile-style {
display: -webkit-box;
display: -ms-flexbox;
diff --git a/app/frontend/static/assets/css/shared/style.css b/app/frontend/static/assets/css/shared/style.css
index 7352d637..a4b6df04 100755
--- a/app/frontend/static/assets/css/shared/style.css
+++ b/app/frontend/static/assets/css/shared/style.css
@@ -21494,27 +21494,42 @@ ul li {
padding-left: 0;
}
-.tab-simple-styled {
+.nav-tabs.tab-simple-styled {
border-bottom: none;
margin-top: 30px;
margin-bottom: 30px;
}
-.tab-simple-styled .nav-item {
+.nav-tabs.tab-simple-styled .nav-item {
margin-right: 30px;
}
-.tab-simple-styled .nav-item .nav-link {
+.nav-tabs.tab-simple-styled .nav-item .nav-link {
border: none;
padding: 0;
color: var(--gray);
}
-.tab-simple-styled .nav-item .nav-link.active {
+.nav-tabs.tab-simple-styled .nav-item .nav-link.active {
background: #fff;
color: var(--info);
}
+.nav-pills.tab-simple-styled {
+ border-bottom: none;
+ /*margin-top: 1.5rem;*/
+ margin-bottom: 1.5rem;
+}
+
+/*.nav-pills.tab-simple-styled .nav-item {
+ margin-right: 1.5rem;
+}*/
+
+.nav-pills.tab-simple-styled .nav-item .nav-link.active {
+ background: var(--info);
+ color: #ffffff;
+}
+
.tab-tile-style {
display: -webkit-box;
display: -ms-flexbox;
diff --git a/app/frontend/templates/notify.html b/app/frontend/templates/notify.html
index 77b72780..4527d46b 100644
--- a/app/frontend/templates/notify.html
+++ b/app/frontend/templates/notify.html
@@ -1,7 +1,6 @@