From 6b252157682d56c6e9e61520091d8ba01227ed19 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Wed, 23 Sep 2020 17:20:48 +0100 Subject: [PATCH] apply settings even if section doesn't exist in response to issue #7. Not sure why this wasn't the original behaviour, nor how I hadn't noticed it earlier --- api.go | 7 +++++-- data/config-base.json | 9 +++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/api.go b/api.go index c444b8d..17f927d 100644 --- a/api.go +++ b/api.go @@ -950,8 +950,11 @@ func (app *appContext) ModifyConfig(gc *gin.Context) { gc.BindJSON(&req) tempConfig, _ := ini.Load(app.config_path) for section, settings := range req { - _, err := tempConfig.GetSection(section) - if section != "restart-program" && err == nil { + if section != "restart-program" { + _, err := tempConfig.GetSection(section) + if err != nil { + tempConfig.NewSection(section) + } for setting, value := range settings.(map[string]interface{}) { tempConfig.Section(section).Key(setting).SetValue(value.(string)) } diff --git a/data/config-base.json b/data/config-base.json index cc94a48..93620a0 100644 --- a/data/config-base.json +++ b/data/config-base.json @@ -678,6 +678,7 @@ "user_template", "user_configuration", "user_displayprefs", + "user_profiles", "custom_css" ], "meta": { @@ -732,6 +733,14 @@ "value": "", "description": "Location of stored displayPreferences template (also used for homescreen layout) (json)" }, + "user_profiles": { + "name": "User Profiles", + "required": false, + "requires_restart": true, + "type": "text", + "value": "", + "description": "Location of stored user profiles (encompasses template and homescreen) (json)" + }, "custom_css": { "name": "Custom CSS", "required": false,