diff --git a/app/classes/web/ajax_handler.py b/app/classes/web/ajax_handler.py index ddaa3dcc..c3539bb1 100644 --- a/app/classes/web/ajax_handler.py +++ b/app/classes/web/ajax_handler.py @@ -40,6 +40,7 @@ class AjaxHandler(BaseHandler): elif page == 'server_log': server_id = self.get_argument('id', None) + full_log = self.get_argument('full', False) if server_id is None: logger.warning("Server ID not found in server_log ajax call") @@ -56,7 +57,12 @@ class AjaxHandler(BaseHandler): if server_data['log_path']: logger.warning("Server ID not found in server_log ajax call") - log_lines = helper.get_setting('virtual_terminal_lines') + if full_log: + log_lines = helper.get_setting('max_log_lines') + else: + log_lines = helper.get_setting('virtual_terminal_lines') + + print(log_lines) data = helper.tail_file(server_data['log_path'], log_lines) for d in data: diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py index 18442c30..e8c949f8 100644 --- a/app/classes/web/panel_handler.py +++ b/app/classes/web/panel_handler.py @@ -84,7 +84,7 @@ class PanelHandler(BaseHandler): self.redirect("/panel/error?error=Invalid Server ID") return False - valid_subpages = ['term'] + valid_subpages = ['term', 'logs'] if subpage not in valid_subpages: subpage = 'term' diff --git a/app/config/serverjars.json b/app/config/serverjars.json index 6c62cdec..e3c0fb5e 100644 --- a/app/config/serverjars.json +++ b/app/config/serverjars.json @@ -1,5 +1,5 @@ { - "last_refreshed": "09/01/2020, 12:53:08", + "last_refreshed": "09/03/2020, 22:13:41", "servers": { "nukkitx": [ "1.14" diff --git a/app/frontend/templates/panel/parts/details_stats.html b/app/frontend/templates/panel/parts/details_stats.html new file mode 100644 index 00000000..d7074cca --- /dev/null +++ b/app/frontend/templates/panel/parts/details_stats.html @@ -0,0 +1,43 @@ +
+
+
+
+
+
+ Server Status: + {% if data['server_stats'][0]['running'] %} + Online
+ Server Started: {{ data['server_stats'][0]['started'] }} + {% else %} + Offline
+ Server Started: Not Started + {% end %} +
+ +
+ CPU: {{ data['server_stats'][0]['cpu'] }}%
+ Mem: {{ data['server_stats'][0]['mem'] }}
+ {% if data['server_stats'][0]['int_ping_results'] %} + Players: {{ data['server_stats'][0]['online'] }} / {{ data['server_stats'][0]['max'] }}
+ {% else %} + Players: 0/0
+ {% end %} +
+ +
+ {% if data['server_stats'][0]['version'] != 'False' %} + Server: {{ data['server_stats'][0]['version'] }}
+ Desc: {{ data['server_stats'][0]['desc'] }}
+ {% else %} + Server: Unable To Connect
+ Desc: Unable To Connect
+ {% end %} +
+ +
+
+ +
+
+ +
\ No newline at end of file diff --git a/app/frontend/templates/panel/server_logs.html b/app/frontend/templates/panel/server_logs.html new file mode 100644 index 00000000..ca6c4a53 --- /dev/null +++ b/app/frontend/templates/panel/server_logs.html @@ -0,0 +1,123 @@ +{% extends ../base.html %} + +{% block meta %} + +{% end %} + +{% block title %}Crafty Controller - Server Details{% end %} + +{% block content %} + +
+ + +
+
+ +
+ +
+ + + {% include "parts/details_stats.html %} + +
+ +
+
+
+ + + +
+
+
+
+
+ + +
+ +
+
+
+
+ + +
+ + +{% end %} + +{% block js %} + + +{% end %} \ No newline at end of file diff --git a/app/frontend/templates/panel/server_term.html b/app/frontend/templates/panel/server_term.html index 9ceaa458..4b992f69 100644 --- a/app/frontend/templates/panel/server_term.html +++ b/app/frontend/templates/panel/server_term.html @@ -24,50 +24,7 @@ -
- -
-
-
-
-
- Server Status: - {% if data['server_stats'][0]['running'] %} - Online
- Server Started: {{ data['server_stats'][0]['started'] }} - {% else %} - Offline
- Server Started: Not Started - {% end %} -
- -
- CPU: {{ data['server_stats'][0]['cpu'] }}%
- Mem: {{ data['server_stats'][0]['mem'] }}
- {% if data['server_stats'][0]['int_ping_results'] %} - Players: {{ data['server_stats'][0]['online'] }} / {{ data['server_stats'][0]['max'] }}
- {% else %} - Players: 0/0
- {% end %} -
- -
- {% if data['server_stats'][0]['version'] != 'False' %} - Server: {{ data['server_stats'][0]['version'] }}
- Desc: {{ data['server_stats'][0]['desc'] }}
- {% else %} - Server: Unable To Connect
- Desc: Unable To Connect
- {% end %} -
- -
-
- -
-
- -
+ {% include "parts/details_stats.html %}
@@ -78,26 +35,26 @@ -
diff --git a/config.json b/config.json index 1b3355cd..805ec51e 100644 --- a/config.json +++ b/config.json @@ -11,6 +11,7 @@ "max_stats_count": 1000, "delete_default_json": false, "show_contribute_link": true, - "virtual_terminal_lines": 100, + "virtual_terminal_lines": 10, + "max_log_lines": 700, "keywords": ["help", "chunk"] } \ No newline at end of file