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 # Changelog
## --- [4.0.22] - 2023/TBD ## --- [4.0.23] - 2023/TBD
### New features ### New features
TBD TBD
### Bug fixes ### Bug fixes
@ -10,6 +10,15 @@ TBD
TBD TBD
<br><br> <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 ## --- [4.0.21] - 2023/03/04
### New features ### New features
- Add better feedback for uploads with a progress bar ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/546)) - 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 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 > Python based Control Panel for your Minecraft Server
## What is Crafty Controller? ## What is Crafty Controller?

View File

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

View File

@ -191,21 +191,25 @@ class Stats:
# ENOENT, pop-up a Windows GUI error for a non-ready # ENOENT, pop-up a Windows GUI error for a non-ready
# partition or just hang. # partition or just hang.
continue continue
usage = psutil.disk_usage(part.mountpoint) try:
disk_data.append( usage = psutil.disk_usage(part.mountpoint)
{ disk_data.append(
"device": part.device, {
"total_raw": usage.total, "device": part.device,
"total": Helpers.human_readable_file_size(usage.total), "total_raw": usage.total,
"used_raw": usage.used, "total": Helpers.human_readable_file_size(usage.total),
"used": Helpers.human_readable_file_size(usage.used), "used_raw": usage.used,
"free_raw": usage.free, "used": Helpers.human_readable_file_size(usage.used),
"free": Helpers.human_readable_file_size(usage.free), "free_raw": usage.free,
"percent_used": usage.percent, "free": Helpers.human_readable_file_size(usage.free),
"fs": part.fstype, "percent_used": usage.percent,
"mount": part.mountpoint, "fs": part.fstype,
} "mount": part.mountpoint,
) }
)
except PermissionError:
logger.debug(f"Permission error accessing {part.mountpoint}")
continue
return disk_data return disk_data

View File

@ -294,7 +294,12 @@ class Helpers:
requests.get("https://ntp.org", timeout=1) requests.get("https://ntp.org", timeout=1)
return True return True
except Exception: except Exception:
return False try:
logger.error("ntp.org ping failed. Falling back to google")
requests.get("https://google.com", timeout=1)
return True
except Exception:
return False
@staticmethod @staticmethod
def check_port(server_port): def check_port(server_port):

View File

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

View File

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

View File

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

View File

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