mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-06-26 05:58:38 +00:00
fix(web): repair news ticker custom-feeds save for JSON path
The JS dotToNested() helper converts indexed form fields like
feeds.custom_feeds.0.name into a dict {'0': {name:...}} rather than a
proper array. The form-data path already had fix_array_structures() to
convert those dicts back to arrays before schema validation, but the
JSON path (used by all web-UI saves) never ran that fix, so saving any
custom feed produced a schema validation error: "Expected type array,
got object".
Add _fix_json_arrays() immediately after schema loading on the JSON
path, mirroring the existing fix_array_structures() logic.
Also fix custom-feeds.js getValue() to omit the logo key entirely when
no logo is present instead of returning logo:null, which would fail
schema validation (logo expects type object).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -54,15 +54,18 @@
|
||||
const logoIdInput = row.querySelector('input[name*=".logo.id"]');
|
||||
|
||||
if (nameInput && urlInput) {
|
||||
feeds.push({
|
||||
const feedObj = {
|
||||
name: nameInput.value,
|
||||
url: urlInput.value,
|
||||
enabled: enabledInput ? enabledInput.checked : true,
|
||||
logo: logoPathInput || logoIdInput ? {
|
||||
enabled: enabledInput ? enabledInput.checked : true
|
||||
};
|
||||
if (logoPathInput || logoIdInput) {
|
||||
feedObj.logo = {
|
||||
path: logoPathInput ? logoPathInput.value : '',
|
||||
id: logoIdInput ? logoIdInput.value : ''
|
||||
} : null
|
||||
});
|
||||
};
|
||||
}
|
||||
feeds.push(feedObj);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user