From 2af21c94fa4f26d926d965ce3f8f5a8105d2ecd5 Mon Sep 17 00:00:00 2001 From: librelad Date: Fri, 22 May 2026 23:32:56 +0100 Subject: [PATCH] fix(webui): populate per-location backup dropdowns (Type/Path/Engine/SSH auth) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The location editor's Type, Path Mode, Engine and SSH Auth selects rendered with no options. The config generator only scans flat per-category files and never descends into configs/backup/locations//, so configData carries no options for CFG_BACKUP_LOC__* keys — and the hardcoded fallbacks had been removed in favour of generator-emitted ones. Resolve these four dropdowns by suffix in ConfigOptions.getSelectOptions with their static option lists (labels mirror location.config), so every location works regardless of index — including locations added after install. The global CFG_BACKUP_ENGINE/STRATEGY selects still come from the generator. Co-Authored-By: Claude Opus 4.7 Signed-off-by: librelad --- .../js/components/config/config-options.js | 41 ++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/containers/libreportal/frontend/js/components/config/config-options.js b/containers/libreportal/frontend/js/components/config/config-options.js index 4f1419b..78a7c21 100755 --- a/containers/libreportal/frontend/js/components/config/config-options.js +++ b/containers/libreportal/frontend/js/components/config/config-options.js @@ -232,11 +232,42 @@ class ConfigOptions { return generated; } - // Backup-related dropdowns (TYPE / ENGINE / PATH_MODE / SSH_AUTH / - // STRATEGY) now come from the bash generator's [value:Label|...] parser - // and land in window.configData.config[key].options — see the - // "Generator-emitted options" check above. The corresponding hardcoded - // blocks that used to live here are gone on purpose. + // Per-location backup dropdowns (CFG_BACKUP_LOC__*). Their options are + // static and identical for every location, but the config generator only + // scans flat per-category files — it never descends into the nested + // configs/backup/locations// dir — so configData carries no options for + // these keys. Resolve them here by suffix so every location index works, + // including ones added after install. (The global CFG_BACKUP_ENGINE/ + // STRATEGY still come from the generator via the check above.) + const locDropdown = key.match(/^CFG_BACKUP_LOC_[0-9]+_(TYPE|PATH_MODE|ENGINE|SSH_AUTH)$/); + if (locDropdown) { + const BACKUP_LOC_OPTIONS = { + TYPE: [ + { value: 'local', label: 'Local / mounted path' }, + { value: 'sftp', label: 'SFTP' }, + { value: 'rest', label: 'REST' }, + { value: 's3', label: 'S3' }, + { value: 'b2', label: 'Backblaze B2' }, + { value: 'gs', label: 'Google Cloud Storage' }, + { value: 'azure', label: 'Azure' }, + { value: 'rclone', label: 'rclone' } + ], + PATH_MODE: [ + { value: 'auto', label: 'Automatic (/docker/backups/)' }, + { value: 'custom', label: 'Custom path' } + ], + ENGINE: [ + { value: 'restic', label: 'restic' }, + { value: 'borg', label: 'BorgBackup' }, + { value: 'kopia', label: 'Kopia' } + ], + SSH_AUTH: [ + { value: 'key', label: 'SSH key (~/.ssh/id_rsa)' }, + { value: 'password', label: 'Password (via sshpass)' } + ] + }; + return BACKUP_LOC_OPTIONS[locDropdown[1]]; + } const result = optionMaps[key] || []; //console.log('Final result for', key, ':', result);