diff --git a/src/main.v b/src/main.v index d0abc1e..da9c2cf 100644 --- a/src/main.v +++ b/src/main.v @@ -25,8 +25,9 @@ struct App { } struct RpvWebSettings { - symbol_path string symbol_file string + mut: + symbol_path string } pub fn (app App) before_request() diff --git a/src/settings-api.v b/src/settings-api.v index d2c6af3..719bc18 100644 --- a/src/settings-api.v +++ b/src/settings-api.v @@ -14,13 +14,16 @@ pub fn (mut app App) get_settings() vweb.Result ['/api/settings'; post] pub fn (mut app App) set_settings() vweb.Result { - settings := json2.decode[RpvWebSettings](app.req.data) or + if json_body := json2.raw_decode(app.req.data) { - return app.json(g_settings) - } + json_map := json_body.as_map() - g_symbol_resolver.symbol_path = settings.symbol_path - g_settings = settings + if symbol_path := json_map['symbol_path'].str() + { + g_symbol_resolver.symbol_path = symbol_path + g_settings.symbol_path = symbol_path + } + } return app.json(g_settings) }