diff --git a/src/components/config/ConfigTabs.tsx b/src/components/config/ConfigTabs.tsx index 0af2ea2..f64ad3f 100644 --- a/src/components/config/ConfigTabs.tsx +++ b/src/components/config/ConfigTabs.tsx @@ -50,6 +50,10 @@ export function ConfigTabs() { starredReposOrg: 'starred', starredReposMode: 'dedicated-org', preserveOrgStructure: false, + backupBeforeSync: true, + backupRetentionCount: 20, + backupDirectory: 'data/repo-backups', + blockSyncOnBackupFailure: true, }, scheduleConfig: { enabled: false, // Don't set defaults here - will be loaded from API diff --git a/src/components/config/GiteaConfigForm.tsx b/src/components/config/GiteaConfigForm.tsx index c1a13f3..342b1ba 100644 --- a/src/components/config/GiteaConfigForm.tsx +++ b/src/components/config/GiteaConfigForm.tsx @@ -100,9 +100,16 @@ export function GiteaConfigForm({ config, setConfig, onAutoSave, isAutoSaving, g ); } + const normalizedValue = + type === "checkbox" + ? checked + : name === "backupRetentionCount" + ? Math.max(1, Number.parseInt(value, 10) || 20) + : value; + const newConfig = { ...config, - [name]: type === "checkbox" ? checked : value, + [name]: normalizedValue, }; setConfig(newConfig); @@ -286,7 +293,77 @@ export function GiteaConfigForm({ config, setConfig, onAutoSave, isAutoSaving, g if (onAutoSave) onAutoSave(newConfig); }} /> - + + + +
+

Destructive Update Protection

+ + + {config.backupBeforeSync && ( +
+
+ + +
+
+ + +
+
+ )} + + +
+ {/* Mobile: Show button at bottom */}