diff --git a/cwd-admin/src/api/admin.ts b/cwd-admin/src/api/admin.ts index ea5ccf1..5b6b5cd 100644 --- a/cwd-admin/src/api/admin.ts +++ b/cwd-admin/src/api/admin.ts @@ -388,3 +388,23 @@ export function setupTelegramWebhook(): Promise<{ message: string; webhookUrl: s export function sendTelegramTestMessage(): Promise<{ message: string }> { return post<{ message: string }>('/admin/settings/telegram/test', {}); } + +export type S3SettingsResponse = { + endpoint: string; + accessKeyId: string; + secretAccessKey: string; + bucket: string; + region: string; +}; + +export function fetchS3Settings(): Promise { + return get('/admin/settings/s3'); +} + +export function saveS3Settings(data: S3SettingsResponse): Promise<{ message: string }> { + return put<{ message: string }>('/admin/settings/s3', data); +} + +export function triggerS3Backup(): Promise<{ message: string; file: string }> { + return post<{ message: string; file: string }>('/admin/backup/s3', {}); +} diff --git a/cwd-admin/src/locales/zh-CN.json b/cwd-admin/src/locales/zh-CN.json index 3a871f7..e8ca2e3 100644 --- a/cwd-admin/src/locales/zh-CN.json +++ b/cwd-admin/src/locales/zh-CN.json @@ -115,6 +115,22 @@ "desc": "一键备份或恢复系统所有数据(评论 + 配置 + 统计)。", "export": "全量导出", "import": "全量恢复" + }, + "s3": { + "title": "S3 备份", + "desc": "配置 S3 兼容存储(AWS S3, Cloudflare R2, MinIO 等),并支持手动触发备份。", + "endpoint": "API 端点 (Endpoint)", + "endpointHint": "例如: https://[account_id].r2.cloudflarestorage.com", + "region": "区域 (Region)", + "regionHint": "例如: auto, us-east-1", + "bucket": "存储桶 (Bucket)", + "accessKey": "Access Key ID", + "secretKey": "Secret Access Key", + "save": "保存配置", + "saving": "保存中...", + "backup": "立即备份到 S3", + "backingUp": "正在备份...", + "success": "备份成功!文件: {file}" } }, "logs": { diff --git a/cwd-admin/src/views/DataView/index.vue b/cwd-admin/src/views/DataView/index.vue index f7dde70..8a0a858 100644 --- a/cwd-admin/src/views/DataView/index.vue +++ b/cwd-admin/src/views/DataView/index.vue @@ -109,6 +109,62 @@ + +
+

{{ t("data.sections.s3.title") }}

+

{{ t("data.sections.s3.desc") }}

+ +
+ + +
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+ + +
+
+