mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-23 01:20:11 +00:00
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
This commit is contained in:
parent
903a61d0f2
commit
6b25215768
7
api.go
7
api.go
@ -950,8 +950,11 @@ func (app *appContext) ModifyConfig(gc *gin.Context) {
|
|||||||
gc.BindJSON(&req)
|
gc.BindJSON(&req)
|
||||||
tempConfig, _ := ini.Load(app.config_path)
|
tempConfig, _ := ini.Load(app.config_path)
|
||||||
for section, settings := range req {
|
for section, settings := range req {
|
||||||
_, err := tempConfig.GetSection(section)
|
if section != "restart-program" {
|
||||||
if section != "restart-program" && err == nil {
|
_, err := tempConfig.GetSection(section)
|
||||||
|
if err != nil {
|
||||||
|
tempConfig.NewSection(section)
|
||||||
|
}
|
||||||
for setting, value := range settings.(map[string]interface{}) {
|
for setting, value := range settings.(map[string]interface{}) {
|
||||||
tempConfig.Section(section).Key(setting).SetValue(value.(string))
|
tempConfig.Section(section).Key(setting).SetValue(value.(string))
|
||||||
}
|
}
|
||||||
|
@ -678,6 +678,7 @@
|
|||||||
"user_template",
|
"user_template",
|
||||||
"user_configuration",
|
"user_configuration",
|
||||||
"user_displayprefs",
|
"user_displayprefs",
|
||||||
|
"user_profiles",
|
||||||
"custom_css"
|
"custom_css"
|
||||||
],
|
],
|
||||||
"meta": {
|
"meta": {
|
||||||
@ -732,6 +733,14 @@
|
|||||||
"value": "",
|
"value": "",
|
||||||
"description": "Location of stored displayPreferences template (also used for homescreen layout) (json)"
|
"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": {
|
"custom_css": {
|
||||||
"name": "Custom CSS",
|
"name": "Custom CSS",
|
||||||
"required": false,
|
"required": false,
|
||||||
|
Loading…
Reference in New Issue
Block a user