diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py index 6186a33a..6d94cab6 100644 --- a/app/classes/web/panel_handler.py +++ b/app/classes/web/panel_handler.py @@ -902,6 +902,20 @@ class PanelHandler(BaseHandler): with open(self.helper.settings_file, "r", encoding="utf-8") as f: data = json.load(f) page_data["config-json"] = data + page_data["availables_languages"] = [] + page_data["all_languages"] = [] + + for file in sorted( + os.listdir( + os.path.join(self.helper.root_dir, "app", "translations") + ) + ): + if file.endswith(".json"): + if file.split(".")[0] not in self.helper.get_setting( + "disabled_language_files" + ): + page_data["availables_languages"].append(file.split(".")[0]) + page_data["all_languages"].append(file.split(".")[0]) template = "panel/config_json.html" @@ -961,7 +975,9 @@ class PanelHandler(BaseHandler): os.listdir(os.path.join(self.helper.root_dir, "app", "translations")) ): if file.endswith(".json"): - if file not in self.helper.get_setting("disabled_language_files"): + if file.split(".")[0] not in self.helper.get_setting( + "disabled_language_files" + ): if file != str(page_data["languages"][0] + ".json"): page_data["languages"].append(file.split(".")[0]) @@ -1172,7 +1188,9 @@ class PanelHandler(BaseHandler): os.listdir(os.path.join(self.helper.root_dir, "app", "translations")) ): if file.endswith(".json"): - if file not in self.helper.get_setting("disabled_language_files"): + if file.split(".")[0] not in self.helper.get_setting( + "disabled_language_files" + ): if file != str(page_data["languages"][0] + ".json"): page_data["languages"].append(file.split(".")[0]) diff --git a/app/config/config.json b/app/config/config.json index ea2e1f0a..86bfbacb 100644 --- a/app/config/config.json +++ b/app/config/config.json @@ -1,27 +1,40 @@ { - "http_port": 8000, - "https_port": 8443, - "language": "en_EN", - "cookie_expire": 30, - "cookie_secret": "random", - "apikey_secret": "random", - "show_errors": true, - "history_max_age": 7, - "stats_update_frequency": 30, - "delete_default_json": false, - "show_contribute_link": true, - "virtual_terminal_lines": 70, - "max_log_lines": 700, - "max_audit_entries": 300, - "disabled_language_files": [ - "lol_EN.json", - "" - ], - "stream_size_GB": 1, - "keywords": [ - "help", - "chunk" - ], - "allow_nsfw_profile_pictures": false, - "enable_user_self_delete": false -} + "http_port": 8000, + "https_port": 8443, + "language": "en_EN", + "cookie_expire": 30, + "cookie_secret": "\"random\"", + "apikey_secret": "\"random\"", + "show_errors": true, + "history_max_age": 7, + "stats_update_frequency": 30, + "delete_default_json": false, + "show_contribute_link": true, + "virtual_terminal_lines": 70, + "max_log_lines": 700, + "max_audit_entries": 300, + "disabled_language_files": [ + "cs_CS", + "de_DE", + "es_ES", + "fi_FI", + "fy_NL", + "he_IL", + "hr_HR", + "id_ID", + "it_IT", + "lv_LV", + "nl_BE", + "nl_NL", + "pl_PL", + "pt_BR", + "zh_CN" + ], + "stream_size_GB": 1, + "keywords": [ + "help", + "chunk" + ], + "allow_nsfw_profile_pictures": false, + "enable_user_self_delete": false +} \ No newline at end of file diff --git a/app/frontend/templates/panel/config_json.html b/app/frontend/templates/panel/config_json.html index f1c761e4..b5f358ed 100644 --- a/app/frontend/templates/panel/config_json.html +++ b/app/frontend/templates/panel/config_json.html @@ -39,41 +39,60 @@
{% raw xsrf_form_html() %} - {% for item in data['config-json'].items() %} -
-
- - {% if isinstance(item[1], list) %} -
- - - {% elif isinstance(item[1], bool) %} - {% if item[1] == True %} -
- -  
- -   + {% for item in data['config-json'].items() %} +
+ + {% if item[0] == 'language' %} + + {% elif item[0] == 'disabled_language_files' %} + + + {% elif isinstance(item[1], list) %} + + {% elif isinstance(item[1], bool) %} + {% if item[1] == True %} +
+ +  
+ +   +
+ {% else %} +
+ +  
+ +   +
+ {% end %} + {% elif isinstance(item[1], int) %} + + {% else %} + + {% end %}
- {% else %} -
- -  
- -   -
- {% end %} - {% elif isinstance(item[1], int) %} - - {% else %} - - {% end %} {% end %} @@ -109,6 +128,11 @@ let uuid = uuidv4(); var token = getCookie("_xsrf") e.preventDefault(); + + /* Convert multiple select to text list */ + let selected_Lang = $('#lang_select').val(); + $('#disabled_lang').val(selected_Lang); + let class_list = document.getElementsByClassName("list"); let form_json = convertFormToJSON($("#config-form")); for (let i = 0; i < class_list.length; i++) {