diff --git a/web_interface/blueprints/api_v3.py b/web_interface/blueprints/api_v3.py index de16d59e..25e9a7ce 100644 --- a/web_interface/blueprints/api_v3.py +++ b/web_interface/blueprints/api_v3.py @@ -3335,7 +3335,33 @@ def save_plugin_config(): # Form fields can use dot notation for nested values (e.g., "transition.type") form_data = request.form.to_dict() - # First pass: detect and combine array index fields (e.g., "text_color.0", "text_color.1" -> "text_color" as array) + # First pass: handle bracket notation array fields (e.g., "field_name[]" from checkbox-group) + # These fields use getlist() to preserve all values, then replace in form_data + bracket_array_fields = {} # Maps base field path to list of values + for key in request.form.keys(): + # Check if key ends with "[]" (bracket notation for array fields) + if key.endswith('[]'): + base_path = key[:-2] # Remove "[]" suffix + values = request.form.getlist(key) + if values: + bracket_array_fields[base_path] = values + # Remove the bracket notation key from form_data if present + if key in form_data: + del form_data[key] + + # Process bracket notation fields and add to form_data as comma-separated strings + for base_path, values in bracket_array_fields.items(): + # Get schema property to verify it's an array + base_prop = _get_schema_property(schema, base_path) + if base_prop and base_prop.get('type') == 'array': + # Combine values into comma-separated string for consistent parsing + combined_value = ', '.join(str(v) for v in values if v) + form_data[base_path] = combined_value + import logging + logger = logging.getLogger(__name__) + logger.debug(f"Processed bracket notation array field {base_path}: {values} -> {combined_value}") + + # Second pass: detect and combine array index fields (e.g., "text_color.0", "text_color.1" -> "text_color" as array) # This handles cases where forms send array fields as indexed inputs array_fields = {} # Maps base field path to list of (index, value) tuples processed_keys = set() diff --git a/web_interface/static/v3/plugins_manager.js b/web_interface/static/v3/plugins_manager.js index 74b3e6a0..7cf6337e 100644 --- a/web_interface/static/v3/plugins_manager.js +++ b/web_interface/static/v3/plugins_manager.js @@ -6467,8 +6467,9 @@ window.updateImageScheduleDay = function(fieldId, imageId, imageIdx, day) { window.updateImageList(fieldId, currentImages); } -// Expose renderArrayObjectItem to window for use by window.addArrayObjectItem +// Expose renderArrayObjectItem and getSchemaProperty to window for use by global functions window.renderArrayObjectItem = renderArrayObjectItem; +window.getSchemaProperty = getSchemaProperty; })(); // End IIFE @@ -6491,7 +6492,7 @@ if (typeof window !== 'undefined') { if (!schema) return; // Use getSchemaProperty to properly handle nested schemas (e.g., news.custom_feeds) - const arraySchema = getSchemaProperty(schema, fullKey); + const arraySchema = window.getSchemaProperty(schema, fullKey); if (!arraySchema || arraySchema.type !== 'array' || !arraySchema.items) { return; } diff --git a/web_interface/templates/v3/partials/plugin_config.html b/web_interface/templates/v3/partials/plugin_config.html index 687ac55d..516089f2 100644 --- a/web_interface/templates/v3/partials/plugin_config.html +++ b/web_interface/templates/v3/partials/plugin_config.html @@ -232,10 +232,13 @@ id="{{ field_id }}_logo_{{ item_index }}" accept="image/png,image/jpeg,image/bmp,image/gif" style="display: none;" - onchange="handleCustomFeedLogoUpload(event, '{{ field_id }}', {{ item_index }}, '{{ plugin_id }}', '{{ full_key }}')"> + disabled + aria-disabled="true"> {% if logo_path %}