Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 18, 2025

This PR implements comprehensive internal user backup functionality for WLED as requested in issue #4941. The feature allows users to create and restore backups of their configuration and custom files directly on the device filesystem.

Features Added

Backend Implementation:

  • New user backup functions in file.cpp with bku. prefix format (e.g., /bku.cfg.json)
  • Web API endpoints for backup/restore operations with PIN authentication
  • Support for batch operations on multiple files (palettes and mappings)
  • Comprehensive error handling and JSON validation

Frontend Implementation:

  • New "Internal User Backup" section in Security & Update page
  • Separate backup/restore buttons for each file type
  • Dynamic restore button visibility (hidden when no backup exists)
  • Enhanced UI feedback with loading states and confirmation dialogs
  • Clear warnings about overwrite behavior and device limitations

Supported File Types

  • Configuration (/cfg.json) - Device reboots automatically after restore
  • Presets (/presets.json) - User effect presets and playlists
  • Custom Palettes (/palette0.json to /palette9.json) - Up to 10 custom color palettes
  • Custom Mappings (/ledmap1.json to /ledmap15.json + /2d-gaps.json) - LED mapping and 2D matrix gap files

API Endpoints

  • POST /backup/{type} - Creates internal backup for specified type
  • POST /restore/{type} - Restores from internal backup
  • GET /backup/status - Returns JSON status of existing backups

All endpoints require settings PIN authentication for security.

Technical Details

The implementation follows existing WLED patterns and conventions:

  • Uses the same JSON validation and file operations as automatic backups
  • Integrates seamlessly with existing security settings page layout
  • Maintains backward compatibility with existing backup functionality
  • Provides proper error handling and user feedback

Internal backups are stored on the device filesystem and will be lost if the device is factory reset or reflashed, making them ideal for temporary backup scenarios or quick rollback operations.

Fixes #4941.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@Copilot Copilot AI changed the title [WIP] Add internal user backup Add internal user backup functionality to Security & Update page Sep 18, 2025
@Copilot Copilot AI requested a review from DedeHai September 18, 2025 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add internal user backup
2 participants