Merge branch 'bugfix/404-startup' into 'dev'

Fix exception related to page data on server start

See merge request crafty-controller/crafty-4!544
This commit is contained in:
Iain Powrie 2023-02-11 18:00:56 +00:00
commit 77d3421778
3 changed files with 8 additions and 7 deletions

View File

@ -3,7 +3,7 @@
### New features
TBD
### Bug fixes
TBD
- Fix exception related to page data on server start ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/544))
### Tweaks
TBD
### Lang

View File

@ -183,6 +183,7 @@ class ServerHandler(BaseHandler):
"version_data": "version_data_here", # TODO
"user_data": exec_user,
"show_contribute": self.helper.get_setting("show_contribute_link", True),
"background": self.controller.cached_login,
"lang": self.controller.users.get_user_lang_by_id(exec_user["user_id"]),
"lang_page": Helpers.get_lang_page(
self.controller.users.get_user_lang_by_id(exec_user["user_id"])

View File

@ -7,12 +7,12 @@ logger = logging.getLogger(__name__)
class StatusHandler(BaseHandler):
def get(self):
page_data = {"background": self.controller.cached_login}
page_data["lang"] = self.helper.get_setting("language")
page_data["lang_page"] = self.helper.get_lang_page(
self.helper.get_setting("language")
)
page_data["servers"] = self.controller.servers.get_all_servers_stats()
page_data = {
"background": self.controller.cached_login,
"lang": self.helper.get_setting("language"),
"lang_page": self.helper.get_lang_page(self.helper.get_setting("language")),
"servers": self.controller.servers.get_all_servers_stats(),
}
running = 0
for srv in page_data["servers"]:
if srv["stats"]["running"]: