Skip to content

Commit 3cc3c57

Browse files
committed
fix(backup): update backup type handling and improve naming conventions for auto backup
1 parent dd25035 commit 3cc3c57

File tree

18 files changed

+2104
-2130
lines changed

18 files changed

+2104
-2130
lines changed

app/src/language/ar/app.po

Lines changed: 141 additions & 141 deletions
Large diffs are not rendered by default.

app/src/language/de_DE/app.po

Lines changed: 141 additions & 141 deletions
Large diffs are not rendered by default.

app/src/language/en/app.po

Lines changed: 131 additions & 139 deletions
Large diffs are not rendered by default.

app/src/language/es/app.po

Lines changed: 141 additions & 141 deletions
Large diffs are not rendered by default.

app/src/language/fr_FR/app.po

Lines changed: 141 additions & 141 deletions
Large diffs are not rendered by default.

app/src/language/ja_JP/app.po

Lines changed: 141 additions & 141 deletions
Large diffs are not rendered by default.

app/src/language/ko_KR/app.po

Lines changed: 141 additions & 141 deletions
Large diffs are not rendered by default.

app/src/language/messages.pot

Lines changed: 131 additions & 139 deletions
Large diffs are not rendered by default.

app/src/language/pt_PT/app.po

Lines changed: 141 additions & 141 deletions
Large diffs are not rendered by default.

app/src/language/ru_RU/app.po

Lines changed: 141 additions & 141 deletions
Large diffs are not rendered by default.

app/src/language/tr_TR/app.po

Lines changed: 141 additions & 141 deletions
Large diffs are not rendered by default.

app/src/language/uk_UA/app.po

Lines changed: 141 additions & 141 deletions
Large diffs are not rendered by default.

app/src/language/vi_VN/app.po

Lines changed: 141 additions & 141 deletions
Large diffs are not rendered by default.

app/src/language/zh_CN/app.po

Lines changed: 141 additions & 141 deletions
Large diffs are not rendered by default.

app/src/language/zh_TW/app.po

Lines changed: 141 additions & 141 deletions
Large diffs are not rendered by default.

app/src/views/backup/AutoBackup/AutoBackup.vue

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ const columns: StdTableColumn[] = [
2525
dataIndex: 'backup_type',
2626
customRender: ({ text }: CustomRenderArgs) => {
2727
const typeMap = {
28-
nginx_config: $gettext('Nginx Config'),
29-
nginx_ui_config: $gettext('Nginx UI Config'),
30-
both_config: $gettext('Both Config'),
28+
nginx_and_nginx_ui: $gettext('Nginx and Nginx UI Config'),
3129
custom_dir: $gettext('Custom Directory'),
3230
}
3331
return typeMap[text as keyof typeof typeMap] || text
@@ -39,9 +37,7 @@ const columns: StdTableColumn[] = [
3937
},
4038
select: {
4139
options: [
42-
{ label: $gettext('Nginx Config'), value: 'nginx_config' },
43-
{ label: $gettext('Nginx UI Config'), value: 'nginx_ui_config' },
44-
{ label: $gettext('Both Nginx and Nginx UI Config'), value: 'both_config' },
40+
{ label: $gettext('Nginx and Nginx UI Config'), value: 'nginx_and_nginx_ui' },
4541
{ label: $gettext('Custom Directory'), value: 'custom_dir' },
4642
],
4743
},

internal/backup/auto_backup.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,8 @@ func ExecuteAutoBackup(autoBackup *model.AutoBackup) error {
133133
// - error: CosyError if backup fails
134134
func executeBackupByType(autoBackup *model.AutoBackup) (*BackupExecutionResult, error) {
135135
switch autoBackup.BackupType {
136-
case model.BackupTypeNginxConfig:
137-
return createEncryptedBackup(autoBackup, "nginx_config")
138-
case model.BackupTypeNginxUIConfig:
139-
return createEncryptedBackup(autoBackup, "nginx_ui_config")
140-
case model.BackupTypeBothConfig:
141-
return createEncryptedBackup(autoBackup, "both_config")
136+
case model.BackupTypeNginxAndNginxUI:
137+
return createEncryptedBackup(autoBackup)
142138
case model.BackupTypeCustomDir:
143139
return createCustomDirectoryBackup(autoBackup)
144140
default:
@@ -156,9 +152,9 @@ func executeBackupByType(autoBackup *model.AutoBackup) (*BackupExecutionResult,
156152
// Returns:
157153
// - BackupExecutionResult: Result containing file paths
158154
// - error: CosyError if backup creation fails
159-
func createEncryptedBackup(autoBackup *model.AutoBackup, backupPrefix string) (*BackupExecutionResult, error) {
155+
func createEncryptedBackup(autoBackup *model.AutoBackup) (*BackupExecutionResult, error) {
160156
// Generate unique filename with timestamp
161-
filename := fmt.Sprintf("%s_%s_%d.zip", backupPrefix, autoBackup.GetName(), time.Now().Unix())
157+
filename := fmt.Sprintf("%s_%d.zip", autoBackup.GetName(), time.Now().Unix())
162158

163159
// Determine output path based on storage type
164160
var outputPath string

model/auto_backup.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ import (
99
type BackupType string
1010

1111
const (
12-
BackupTypeNginxConfig BackupType = "nginx_config"
13-
BackupTypeNginxUIConfig BackupType = "nginx_ui_config"
14-
BackupTypeBothConfig BackupType = "both_config"
15-
BackupTypeCustomDir BackupType = "custom_dir"
12+
BackupTypeNginxAndNginxUI BackupType = "nginx_and_nginx_ui"
13+
BackupTypeCustomDir BackupType = "custom_dir"
1614
)
1715

1816
// StorageType represents where the backup is stored
@@ -55,5 +53,5 @@ type AutoBackup struct {
5553
}
5654

5755
func (a *AutoBackup) GetName() string {
58-
return strings.ReplaceAll(a.Name, " ", "_")
56+
return strings.ReplaceAll(strings.TrimSpace(a.Name), " ", "_")
5957
}

0 commit comments

Comments
 (0)