mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-11-11 16:09:16 +00:00
Improve ui_settings init
This commit is contained in:
parent
934566d330
commit
d8e7ba7ab0
|
@ -487,11 +487,21 @@ def read_ui_settings():
|
||||||
with open(ui_mynode_file, 'r') as fp:
|
with open(ui_mynode_file, 'r') as fp:
|
||||||
ui_settings = json.load(fp)
|
ui_settings = json.load(fp)
|
||||||
|
|
||||||
|
# If no files were read, init variable and mark we need to write files
|
||||||
|
need_file_write = False
|
||||||
|
if ui_settings == None:
|
||||||
|
ui_settings = {}
|
||||||
|
need_file_write = True
|
||||||
|
|
||||||
# Set reseller
|
# Set reseller
|
||||||
ui_settings["reseller"] = is_device_from_reseller()
|
ui_settings["reseller"] = is_device_from_reseller()
|
||||||
|
|
||||||
|
# Load defaults
|
||||||
ui_settings = init_ui_setting_defaults(ui_settings)
|
ui_settings = init_ui_setting_defaults(ui_settings)
|
||||||
|
|
||||||
|
if need_file_write:
|
||||||
|
write_ui_settings(ui_settings)
|
||||||
|
|
||||||
return ui_settings
|
return ui_settings
|
||||||
|
|
||||||
def write_ui_settings(ui_settings_new):
|
def write_ui_settings(ui_settings_new):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user