Merge branch 'tweak/support-logs' into 'dev'

Add platform & crafty version info to support logs

See merge request crafty-controller/crafty-4!405
This commit is contained in:
Iain Powrie 2022-07-18 20:58:24 +00:00
commit 4cd0301d5f
2 changed files with 15 additions and 0 deletions

View File

@ -12,6 +12,7 @@
- Fix an issue where the motd were not displayed properly one small screens ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/402))
### Tweaks
- Remove server.props requirement ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/403))
- Add platform & crafty version info to support logs ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/405))
### Lang
None
<br><br>

View File

@ -1,6 +1,7 @@
import os
import pathlib
from pathlib import Path
import platform
import shutil
import time
import logging
@ -172,6 +173,19 @@ class Controller:
id="logs_" + str(exec_user["user_id"]),
args=[temp_dir, temp_zip_storage + ".zip", exec_user],
)
# Make version file .txt when we download it for support
# Most people have a default editor for .txt also more mobile friendly...
FileHelpers.copy_file(
os.path.join(self.project_root, "app", "config", "version.json"),
os.path.join(temp_dir, "crafty_sys_info.txt"),
)
with open(
os.path.join(temp_dir, "crafty_sys_info.txt"), "a", encoding="utf-8"
) as f:
f.write("\n")
f.write("OS Info:\n")
f.write("OS: " + str(platform.system()) + "\n")
f.write("Version: " + str(platform.release()))
FileHelpers.make_compressed_archive(temp_zip_storage, temp_dir)
if len(self.helper.websocket_helper.clients) > 0:
self.helper.websocket_helper.broadcast_user(