Merge branch 'dev' into tweak/improve-display

This commit is contained in:
Silversthorn 2023-04-15 21:00:24 +02:00
commit 8119c97927
9 changed files with 46 additions and 26 deletions

View File

@ -1,5 +1,5 @@
# Changelog
## --- [4.0.22] - 2023/TBD
## --- [4.0.23] - 2023/TBD
### New features
TBD
### Bug fixes
@ -10,6 +10,15 @@ TBD
TBD
<br><br>
## --- [4.0.22] - 2023/04/08
### Bug fixes
- Fix dashboard crash for users without disks or if crafty doesn't have permission to access mount point ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/571))
- Strip Minecraft motd obfuscation chars to prevent text jumping on dashboard ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/572))
### Tweaks
- Improve logging on tz failures ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/569))
- Add fallback for ping domain to provide better feedback on internet connection ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/570))
<br><br>
## --- [4.0.21] - 2023/03/04
### New features
- Add better feedback for uploads with a progress bar ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/546))

View File

@ -1,5 +1,5 @@
[![Crafty Logo](app/frontend/static/assets/images/logo_long.svg)](https://craftycontrol.com)
# Crafty Controller 4.0.22
# Crafty Controller 4.0.23
> Python based Control Panel for your Minecraft Server
## What is Crafty Controller?

View File

@ -40,8 +40,6 @@ class Server:
lines.append(get_code_format("underlined"))
if "strikethrough" in e.keys():
lines.append(get_code_format("strikethrough"))
if "obfuscated" in e.keys():
lines.append(get_code_format("obfuscated"))
if "color" in e.keys():
lines.append(get_code_format(e["color"]))
# Then append the text

View File

@ -191,6 +191,7 @@ class Stats:
# ENOENT, pop-up a Windows GUI error for a non-ready
# partition or just hang.
continue
try:
usage = psutil.disk_usage(part.mountpoint)
disk_data.append(
{
@ -206,6 +207,9 @@ class Stats:
"mount": part.mountpoint,
}
)
except PermissionError:
logger.debug(f"Permission error accessing {part.mountpoint}")
continue
return disk_data

View File

@ -293,6 +293,11 @@ class Helpers:
try:
requests.get("https://ntp.org", timeout=1)
return True
except Exception:
try:
logger.error("ntp.org ping failed. Falling back to google")
requests.get("https://google.com", timeout=1)
return True
except Exception:
return False

View File

@ -134,9 +134,10 @@ class ServerInstance:
self.last_backup_failed = False
try:
self.tz = get_localzone()
except ZoneInfoNotFoundError:
except ZoneInfoNotFoundError as e:
logger.error(
"Could not capture time zone from system. Falling back to Europe/London"
f" error: {e}"
)
self.tz = ZoneInfo("Europe/London")
self.server_scheduler = BackgroundScheduler(timezone=str(self.tz))

View File

@ -47,9 +47,10 @@ class TasksManager:
self.tornado: Webserver = Webserver(helper, controller, self)
try:
self.tz = get_localzone()
except ZoneInfoNotFoundError:
except ZoneInfoNotFoundError as e:
logger.error(
"Could not capture time zone from system. Falling back to Europe/London"
f" error: {e}"
)
self.tz = "Europe/London"
self.scheduler = BackgroundScheduler(timezone=str(self.tz))

View File

@ -1,5 +1,5 @@
{
"major": 4,
"minor": 0,
"sub": 22
"sub": 23
}

View File

@ -100,6 +100,7 @@
</div>
</div>
</div>
{% if len(data['hosts_data']['disk_json']) > 0 %}
<div class="col-12 mt-4">
<div class="d-flex">
<div class="wrapper" style="width: 100%;">
@ -107,7 +108,7 @@
</h5>
<div id="storage_data">
<div class="row">
{% for item in data.get('hosts_data').get('disk_json') %}
{% for item in data['hosts_data']['disk_json'] %}
{% if item["mount"] in data["monitored"] %}
<div id="{{item['device']}}" class="col-xl-3 col-lg-3 col-md-4 col-12">
<h4 class="mb-0 font-weight-semibold d-inline-block text-truncate storage-heading"
@ -137,6 +138,7 @@
</div>
</div>
</div>
{% end %}
</div>
</div>
</div>
@ -931,8 +933,8 @@
var storage_html = '<div class="row">';
for (i = 0; i < hostStats.disk_usage.length; i++) {
if (hostStats.mounts.includes(hostStats.disk_usage[i].mount)) {
storage_html += `<div id="{{item['device']}}" class="col-xl-3 col-lg-3 col-md-4 col-12">
<h4 class="mb-0 font-weight-semibold d-inline-block text-truncate storage-heading" id="title_{{item['device']}}" data-toggle="tooltip" data-placement="bottom" title="${hostStats.disk_usage[i].mount}" style="max-width: 100%;"><i class="fas fa-hdd"></i> ${hostStats.disk_usage[i].mount}</h4>
storage_html += `<div id="host_storage" class="col-xl-3 col-lg-3 col-md-4 col-12">
<h4 class="mb-0 font-weight-semibold d-inline-block text-truncate storage-heading" id="title_host_storage" data-toggle="tooltip" data-placement="bottom" title="${hostStats.disk_usage[i].mount}" style="max-width: 100%;"><i class="fas fa-hdd"></i> ${hostStats.disk_usage[i].mount}</h4>
<div class="progress" style="display: inline-block; height: 20px; width: 100%; background-color: rgb(139, 139, 139) !important;">
<div class="progress-bar`;
if (hostStats.disk_usage[i].percent_used <= 58) {