Fixes #980
Summary
POST /api/v1/configuration/startupconfig bound the whole StartupConfig and the writer serialised it over config.json, so every property the body left out was written back as null. A body of just { "authenticationRequired": "false" }, which the settings view sends when its initial GET failed, erased the API key, bind address, port, SSL settings and log level. This takes the issue's option 3: the endpoint merges server-side, and the settings view refuses to post a startup config it never loaded.
Changes
StartupConfigPatchReader.ApplyTooverlays the properties a body actually carries onto the configuration the server holds. It walksStartupConfigby reflection, so later additions are merged automatically, and nested objects such asffmpegmerge in turn. Values are read with the serializer defaults MVC binds with, so a quoted number such as"8080"is still accepted.SaveStartupConfigbindsJsonElement, so "absent" and "sent as null" can be told apart. The contract changes from replace to merge: clearing a property means sending null or an empty string. A body that is not a JSON object, or has a property of the wrong type, still gets a 400, now with a plain message instead of aValidationProblemDetails; an empty body still gets the framework's response. There is no[Consumes]restriction, sotext/jsonis still accepted.SettingsViewshows a toast and skips the post when the load failed.
Testing
Control: an uncommitted scratch test through the real MVC pipeline, with only IStartupConfigService stubbed, ran on canary e1a1d12 and on this branch (final revision 499b5e4) from the same stored config.
| Case | Canary | This branch |
|---|---|---|
{"authenticationRequired":"false"}
| other keys written as null | other keys kept |
{} or unknown property
| wipes the file | every key kept |
| `{"ffmpeg":{"... |
Automated Canary build