mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Sort config.json in alphabetical order
This commit is contained in:
parent
8707a1470c
commit
3f3595acb4
@ -411,7 +411,7 @@ class Helpers:
|
||||
"virtual_terminal_lines": 70,
|
||||
"max_log_lines": 700,
|
||||
"max_audit_entries": 300,
|
||||
"disabled_language_files": ["lol_EN.json", ""],
|
||||
"disabled_language_files": [],
|
||||
"stream_size_GB": 1,
|
||||
"keywords": ["help", "chunk"],
|
||||
"allow_nsfw_profile_pictures": False,
|
||||
|
@ -251,7 +251,11 @@ class Controller:
|
||||
except:
|
||||
# Call helper to set updated config.
|
||||
Console.warning("No Config found. Setting Default Config.json")
|
||||
self.helper.set_settings(master_config)
|
||||
user_config = master_config
|
||||
keys = list(user_config.keys())
|
||||
keys.sort()
|
||||
sorted_data = {i: user_config[i] for i in keys}
|
||||
self.helper.set_settings(user_config)
|
||||
return
|
||||
items_to_del = []
|
||||
|
||||
@ -270,7 +274,10 @@ class Controller:
|
||||
if key not in user_config.keys():
|
||||
user_config[key] = value
|
||||
# Call helper to set updated config.
|
||||
self.helper.set_settings(user_config)
|
||||
keys = list(user_config.keys())
|
||||
keys.sort()
|
||||
sorted_data = {i: user_config[i] for i in keys}
|
||||
self.helper.set_settings(sorted_data)
|
||||
|
||||
def send_log_status(self):
|
||||
try:
|
||||
|
@ -1774,8 +1774,11 @@ class PanelHandler(BaseHandler):
|
||||
data[key] = False
|
||||
else:
|
||||
data[key] = arg_data
|
||||
keys = list(data.keys())
|
||||
keys.sort()
|
||||
sorted_data = {i: data[i] for i in keys}
|
||||
with open(self.helper.settings_file, "w", encoding="utf-8") as f:
|
||||
json.dump(data, f, indent=4)
|
||||
json.dump(sorted_data, f, indent=4)
|
||||
except Exception as e:
|
||||
logger.critical(
|
||||
"Config File Error: Unable to read "
|
||||
|
Loading…
Reference in New Issue
Block a user