Skip to content

Add one-click backup and restore functionality for system configuration and jobs #527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Aug 1, 2025

This PR implements a comprehensive backup and restore feature that allows users to export and import their entire DDNS Updater configuration with a single click from the web interface.

Features Added

UI Components

  • Added backup/restore button to the main navbar with cloud upload/download icon
  • Created a dedicated backup modal with separate export and import sections
  • Integrated seamlessly with existing Bootstrap styling and dark theme

Backend Implementation

  • New Backup Service (pkg/backup/service.go): Handles complete data serialization and deserialization
  • API Endpoints:
    • GET /api/backup/export - Downloads backup as timestamped JSON file
    • POST /api/backup/import - Uploads and restores from backup file
  • Data Handling: Complete export of system configuration (YAML) and all DDNS jobs with proper encryption/decryption

Key Capabilities

  • Complete Export: Backs up both system configuration and all DDNS jobs in a single JSON file
  • Safe Import: Transactional restore process that replaces all existing data
  • Security: Job parameters are properly encrypted in database, decrypted for backup, and re-encrypted on restore
  • User Experience: Clear warnings and confirmations for destructive operations
  • Versioning: Backup format includes version field for future compatibility

Example Backup Format

{
  "version": "1.0",
  "timestamp": "2025-08-01T06:45:23Z",
  "config": {
    "Interval": 600,
    "UseTOTP": false,
    "Port": 8080,
    "Resolver": ""
  },
  "jobs": [
    {
      "provider": "Custom",
      "params": "{\"URL\":\"http://example.com/update?ip=<ipv4>\",\"Check\":\"success\"}"
    }
  ]
}

Testing

The implementation has been thoroughly tested including:

  • Backup export generates proper JSON with configuration and jobs
  • Import successfully restores all data with transactional safety
  • Job parameters correctly encrypted/decrypted throughout the process
  • Full backup/restore cycle verified with sample DDNS jobs

Backup Feature UI

This provides true "one-click" functionality as requested, enabling users to completely backup and restore their DDNS configuration through the web interface without any command-line interaction.

Fixes #380.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.ipify.org
    • Triggering command: ./main (dns block)
  • api.ipy.ch
    • Triggering command: ./main (dns block)
  • api.my-ip.io
    • Triggering command: ./main (dns block)
  • httpbin.org
    • Triggering command: ./main (dns block)
  • icanhazip.com
    • Triggering command: ./main (dns block)
  • ident.me
    • Triggering command: ./main (dns block)
  • ifconfig.me
    • Triggering command: ./main (dns block)
  • nms.intellitrend.de
    • Triggering command: ./main (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] One-click backup and restore Add one-click backup and restore functionality for system configuration and jobs Aug 1, 2025
@Copilot Copilot AI requested a review from Plaenkler August 1, 2025 06:47
Copilot finished work on behalf of Plaenkler August 1, 2025 06:47
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.

One-click backup and restore
2 participants