mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Merge branch 'dev' into tweak/backup-restore
This commit is contained in:
commit
d2d812edb7
@ -3,9 +3,13 @@
|
||||
### New features
|
||||
TBD
|
||||
### Bug fixes
|
||||
TBD
|
||||
- Fix bug where trying to reconfigure unloaded server would stack ([Commit](https://gitlab.com/crafty-controller/crafty-4/-/commit/1b2fef06fb3b02b76c9506caf7e07e932df95fab))
|
||||
- Fix traceback error when a user click the roles config tab while already on the roles config page; **this is for new role creation only** ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/452))
|
||||
- Fix logic issue when removing items from backup exclusions ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/453))
|
||||
- Cleanup various JS errors ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/455))
|
||||
- Temp fix for `&` issue in pathing and minecraft colour codes ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/457))
|
||||
### Tweaks
|
||||
TBD
|
||||
- Add button to scroll to bottom of vterm ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/454))
|
||||
### Lang
|
||||
TBD
|
||||
<br><br>
|
||||
|
@ -226,18 +226,24 @@ class FileHelpers:
|
||||
comment, "utf-8"
|
||||
) # comments over 65535 bytes will be truncated
|
||||
for root, dirs, files in os.walk(path_to_zip, topdown=True):
|
||||
for l_dir in dirs:
|
||||
for l_dir in dirs[:]:
|
||||
# make all paths in exclusions a unix style slash
|
||||
# to match directories.
|
||||
if str(os.path.join(root, l_dir)).replace("\\", "/") in ex_replace:
|
||||
dirs.remove(l_dir)
|
||||
ziproot = path_to_zip
|
||||
# iterate through list of files
|
||||
for file in files:
|
||||
# check if file/dir is in exclusions list.
|
||||
# Only proceed if not exluded.
|
||||
if (
|
||||
str(os.path.join(root, file)).replace("\\", "/")
|
||||
not in ex_replace
|
||||
and file != "crafty.sqlite"
|
||||
):
|
||||
try:
|
||||
logger.info(f"backing up: {os.path.join(root, file)}")
|
||||
logger.debug(f"backing up: {os.path.join(root, file)}")
|
||||
# add trailing slash to zip root dir if not windows.
|
||||
if os.name == "nt":
|
||||
zip_file.write(
|
||||
os.path.join(root, file),
|
||||
@ -254,12 +260,20 @@ class FileHelpers:
|
||||
f"Error backing up: {os.path.join(root, file)}!"
|
||||
f" - Error was: {e}"
|
||||
)
|
||||
# debug logging for exlusions list
|
||||
else:
|
||||
logger.debug(f"Found {file} in exclusion list. Skipping...")
|
||||
|
||||
# add current file bytes to total bytes.
|
||||
total_bytes += os.path.getsize(os.path.join(root, file))
|
||||
# calcualte percentage based off total size and current archive size
|
||||
percent = round((total_bytes / dir_bytes) * 100, 2)
|
||||
# package results
|
||||
results = {
|
||||
"percent": percent,
|
||||
"total_files": self.helper.human_readable_file_size(dir_bytes),
|
||||
}
|
||||
# send status results to page.
|
||||
self.helper.websocket_helper.broadcast_page_params(
|
||||
"/panel/server_detail",
|
||||
{"id": str(server_id)},
|
||||
|
@ -104,7 +104,10 @@ class BaseHandler(tornado.web.RequestHandler):
|
||||
strip: bool = True,
|
||||
) -> t.Optional[str]:
|
||||
arg = self._get_argument(name, default, self.request.arguments, strip)
|
||||
return self.autobleach(name, arg)
|
||||
bleached = self.autobleach(name, arg)
|
||||
if "&" in str(bleached):
|
||||
bleached = bleached.replace("&", "&")
|
||||
return bleached
|
||||
|
||||
def get_arguments(self, name: str, strip: bool = True) -> t.List[str]:
|
||||
if not isinstance(strip, bool):
|
||||
|
@ -1727,7 +1727,7 @@ class PanelHandler(BaseHandler):
|
||||
if interval_type == "days":
|
||||
sch_time = bleach.clean(self.get_argument("time", None))
|
||||
if action == "command":
|
||||
command = bleach.clean(self.get_argument("command", None))
|
||||
command = self.get_argument("command", None)
|
||||
elif action == "start":
|
||||
command = "start_server"
|
||||
elif action == "stop":
|
||||
@ -1743,7 +1743,7 @@ class PanelHandler(BaseHandler):
|
||||
delay = bleach.clean(self.get_argument("delay", None))
|
||||
parent = bleach.clean(self.get_argument("parent", None))
|
||||
if action == "command":
|
||||
command = bleach.clean(self.get_argument("command", None))
|
||||
command = self.get_argument("command", None)
|
||||
elif action == "start":
|
||||
command = "start_server"
|
||||
elif action == "stop":
|
||||
@ -1763,7 +1763,7 @@ class PanelHandler(BaseHandler):
|
||||
return
|
||||
action = bleach.clean(self.get_argument("action", None))
|
||||
if action == "command":
|
||||
command = bleach.clean(self.get_argument("command", None))
|
||||
command = self.get_argument("command", None)
|
||||
elif action == "start":
|
||||
command = "start_server"
|
||||
elif action == "stop":
|
||||
@ -1889,7 +1889,7 @@ class PanelHandler(BaseHandler):
|
||||
if interval_type == "days":
|
||||
sch_time = bleach.clean(self.get_argument("time", None))
|
||||
if action == "command":
|
||||
command = bleach.clean(self.get_argument("command", None))
|
||||
command = self.get_argument("command", None)
|
||||
elif action == "start":
|
||||
command = "start_server"
|
||||
elif action == "stop":
|
||||
@ -1904,7 +1904,7 @@ class PanelHandler(BaseHandler):
|
||||
delay = bleach.clean(self.get_argument("delay", None))
|
||||
parent = bleach.clean(self.get_argument("parent", None))
|
||||
if action == "command":
|
||||
command = bleach.clean(self.get_argument("command", None))
|
||||
command = self.get_argument("command", None)
|
||||
elif action == "start":
|
||||
command = "start_server"
|
||||
elif action == "stop":
|
||||
@ -1924,7 +1924,7 @@ class PanelHandler(BaseHandler):
|
||||
return
|
||||
action = bleach.clean(self.get_argument("action", None))
|
||||
if action == "command":
|
||||
command = bleach.clean(self.get_argument("command", None))
|
||||
command = self.get_argument("command", None)
|
||||
elif action == "start":
|
||||
command = "start_server"
|
||||
elif action == "stop":
|
||||
|
@ -525,10 +525,6 @@
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$(window).unload(function () {
|
||||
jQuery.get("/public/logout")
|
||||
});
|
||||
</script>
|
||||
|
||||
{% block js %}
|
||||
|
@ -39,7 +39,7 @@
|
||||
<div class="card-body pt-0">
|
||||
<ul class="nav nav-tabs col-md-12 tab-simple-styled " role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="/panel/edit_role?id={{ data['role']['role_id'] }}&subpage=config" role="tab" aria-selected="true">
|
||||
<a class="nav-link active" href="" role="tab" aria-selected="true">
|
||||
<i class="fas fa-cogs"></i>{{ translate('rolesConfig', 'config', data['lang']) }}</a>
|
||||
</li>
|
||||
<!-- <li class="nav-item">
|
||||
|
@ -40,6 +40,9 @@
|
||||
</span>
|
||||
|
||||
<div class="col-md-12">
|
||||
<button id="to-bottom" style="visibility: hidden; float: right;" class="btn btn-outline-success">{{ translate('serverDetails', 'reset', data['lang']) }}</button>
|
||||
<br />
|
||||
<br />
|
||||
<div class="input-group">
|
||||
<div id="virt_console" class="" style="width: 100%; font-size: .8em; padding: 5px 10px; border: 1px solid #383e5d; background-color:#2a2c44;height:500px; overflow: scroll;"></div>
|
||||
</div>
|
||||
@ -193,8 +196,7 @@
|
||||
function new_line_handler(data) {
|
||||
$('#virt_console').append(data.line)
|
||||
const elem = document.getElementById('virt_console');
|
||||
const scrollDiff = (elem.scrollHeight - elem.scrollTop) - elem.clientHeight;
|
||||
if (!$("#stop_scroll").is(':checked') && scrollDiff < 450) {
|
||||
if (!scrolled) {
|
||||
scrollConsole()
|
||||
}
|
||||
}
|
||||
@ -293,6 +295,31 @@
|
||||
return nextCommand;
|
||||
}
|
||||
}
|
||||
|
||||
const chkScroll = (e) => {
|
||||
const elem = $(e.currentTarget);
|
||||
|
||||
if (Math.round(elem[0].scrollHeight - elem.scrollTop()) <= elem.outerHeight()) {
|
||||
document.getElementById("to-bottom").style.visibility = "hidden";
|
||||
scrolled = false;
|
||||
}else{
|
||||
document.getElementById("to-bottom").style.visibility = "visible";
|
||||
scrolled = true;
|
||||
}
|
||||
}
|
||||
|
||||
const scrollToBottom = (id) => {
|
||||
const element = $(`#virt_console`);
|
||||
element.animate({
|
||||
scrollTop: element.prop("scrollHeight")
|
||||
}, 500);
|
||||
}
|
||||
|
||||
$(document).ready(() => {
|
||||
var scrolled;
|
||||
$('#virt_console').on('scroll', chkScroll);
|
||||
$('#to-bottom').on('click', scrollToBottom)
|
||||
});
|
||||
</script>
|
||||
|
||||
{% end %}
|
@ -457,7 +457,7 @@
|
||||
"absoluteZipPath": "Absoluter Pfad zu dem Server",
|
||||
"addRole": "Server zu existierender Rolle hinzufügen",
|
||||
"autoCreate": "Wenn keine ausgewählt werden, wird Crafty eine erstellen!",
|
||||
"bePatient": "Bitte haben Sie etwas Geduld, da wir ' + (importing ? 'import' : 'download')",
|
||||
"bePatient": "Bitte haben Sie etwas Geduld, da wir ' + (importing ? 'import' : 'download') + '",
|
||||
"buildServer": "Server erstellen!",
|
||||
"clickRoot": "Hier klicken, um das Stammverzeichnis auszuwählen",
|
||||
"close": "Schließen",
|
||||
|
@ -359,7 +359,8 @@
|
||||
"schedule": "Schedule",
|
||||
"serverDetails": "Server Details",
|
||||
"terminal": "Terminal",
|
||||
"metrics": "Metrics"
|
||||
"metrics": "Metrics",
|
||||
"reset": "Reset Scroll"
|
||||
},
|
||||
"serverFiles": {
|
||||
"clickUpload": "Click here to select your files",
|
||||
|
Loading…
Reference in New Issue
Block a user