diff --git a/app/classes/web/status_handler.py b/app/classes/web/status_handler.py new file mode 100644 index 00000000..93e54bad --- /dev/null +++ b/app/classes/web/status_handler.py @@ -0,0 +1,47 @@ +from re import template +import sys +import json +import logging +import tornado.web +import tornado.escape +import requests + +from app.classes.shared.helpers import helper +from app.classes.web.base_handler import BaseHandler +from app.classes.shared.console import console +from app.classes.shared.models import Users, fn, db_helper + +logger = logging.getLogger(__name__) + +try: + import bleach + +except ModuleNotFoundError as e: + logger.critical("Import Error: Unable to load {} module".format(e.name), exc_info=True) + console.critical("Import Error: Unable to load {} module".format(e.name)) + sys.exit(1) + + +class StatusHandler(BaseHandler): + def get(self): + page_data = {} + page_data['servers'] = db_helper.get_all_servers_stats() + + template = 'public/status.html' + + self.render( + template, + data=page_data, + translate=self.translator.translate, + ) + def post(self): + page_data = {} + page_data['servers'] = db_helper.get_all_servers_stats() + + template = 'public/status.html' + + self.render( + template, + data=page_data, + translate=self.translator.translate, + ) \ No newline at end of file diff --git a/app/classes/web/tornado.py b/app/classes/web/tornado.py index a82f619f..aeed856f 100644 --- a/app/classes/web/tornado.py +++ b/app/classes/web/tornado.py @@ -29,6 +29,7 @@ try: from app.classes.shared.translation import translation from app.classes.web.upload_handler import UploadHandler from app.classes.web.http_handler import HTTPHandler, HTTPHandlerPage + from app.classes.web.status_handler import StatusHandler except ModuleNotFoundError as e: logger.critical("Import Error: Unable to load {} module".format(e, e.name)) @@ -132,6 +133,7 @@ class Webserver: (r'/api/stats/node', NodeStats, handler_args), (r'/ws', SocketHandler, handler_args), (r'/upload', UploadHandler), + (r'/status', StatusHandler, handler_args) ] app = tornado.web.Application( diff --git a/app/frontend/static/assets/css/crafty.css b/app/frontend/static/assets/css/crafty.css index 892bd52f..c39b2c2a 100644 --- a/app/frontend/static/assets/css/crafty.css +++ b/app/frontend/static/assets/css/crafty.css @@ -80,3 +80,8 @@ body { background-color: var(--dark) !important; /* Firefox */ } .actions_serverlist > a > i { cursor: pointer; } +.corner { + position: absolute; + margin-top: 0; + margin-left: 0; +} \ No newline at end of file diff --git a/app/frontend/static/assets/images/logo_long.png b/app/frontend/static/assets/images/logo_long.png new file mode 100644 index 00000000..8ebca3a5 Binary files /dev/null and b/app/frontend/static/assets/images/logo_long.png differ diff --git a/app/frontend/templates/blank_base.html b/app/frontend/templates/blank_base.html index ace4b7dd..cc5bba76 100644 --- a/app/frontend/templates/blank_base.html +++ b/app/frontend/templates/blank_base.html @@ -11,6 +11,7 @@ + @@ -24,7 +25,7 @@
{{ translate('dashboard', 'server') }} | +{{ translate('dashboard', 'players') }} | +{{ translate('dashboard', 'status') }} | +
---|---|---|
+ + {{ server['server_data']['server_name'] }} + | +
+ {% if server['stats']['int_ping_results'] %}
+ {{ server['stats']['online'] }} / {{ server['stats']['max'] }} {{ translate('dashboard', 'max') }} + + {% if server['stats']['desc'] != 'False' %} + {{ server['stats']['desc'] }} + {% end %} + + {% if server['stats']['version'] != 'False' %} + {{ server['stats']['version'] }} + {% end %} + {% end %} + + |
+ + {% if server['stats']['running'] %} + {{ translate('dashboard', 'online') }} + {% else %} + {{ translate('dashboard', 'offline') }} + {% end %} + | +