From 8d8b065e412a8c841c9a9342892f6fd066bff84f Mon Sep 17 00:00:00 2001 From: Andrew Date: Sun, 15 Jan 2023 18:57:22 -0500 Subject: [PATCH] Working config.json from page --- app/classes/web/panel_handler.py | 25 +++++++--- app/frontend/templates/panel/config_json.html | 46 ++++++++++++++++--- 2 files changed, 58 insertions(+), 13 deletions(-) diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py index 38b9fd71..6186a33a 100644 --- a/app/classes/web/panel_handler.py +++ b/app/classes/web/panel_handler.py @@ -1724,19 +1724,30 @@ class PanelHandler(BaseHandler): try: data = {} with open(self.helper.settings_file, "r", encoding="utf-8") as f: - print("open") keys = json.load(f).keys() + this_uuid = self.get_argument("uuid") for key in keys: - print(self.get_argument(key)) - data[key] = self.get_argument(key) - print("data:", data) - """ + arg_data = self.get_argument(key) + if arg_data.startswith(this_uuid): + arg_data = arg_data.split(",") + arg_data.pop(0) + data[key] = arg_data + else: + try: + data[key] = int(arg_data) + except: + if arg_data == "True": + data[key] = True + elif arg_data == "False": + data[key] = False + else: + data[key] = arg_data with open(self.helper.settings_file, "w", encoding="utf-8") as f: json.dump(data, f, indent=4) -""" except Exception as e: logger.critical( - f"Config File Error: Unable to read {self.helper.settings_file} due to {e}" + "Config File Error: Unable to read " + f"{self.helper.settings_file} due to {e}" ) self.redirect("/panel/config_json") diff --git a/app/frontend/templates/panel/config_json.html b/app/frontend/templates/panel/config_json.html index c2afaa93..c9856cce 100644 --- a/app/frontend/templates/panel/config_json.html +++ b/app/frontend/templates/panel/config_json.html @@ -46,12 +46,9 @@ {% if isinstance(item[1], list) %} - +
+ {% elif isinstance(item[1], bool) %} {% if item[1] == True %} @@ -107,6 +104,43 @@ {% block js %}