From 140d45147205c3a78c16b6b184f685470b8c5974 Mon Sep 17 00:00:00 2001 From: eoao Date: Tue, 21 Oct 2025 20:45:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EKV=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E9=99=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/email-scroll/index.vue | 4 +- mail-vue/src/i18n/en.js | 21 +++-- mail-vue/src/i18n/zh.js | 6 +- mail-vue/src/layout/account/index.vue | 5 +- mail-vue/src/request/setting.js | 6 +- mail-vue/src/views/sys-setting/index.vue | 92 ++++++++++++------- mail-worker/src/api/r2-api.js | 4 +- mail-worker/src/api/setting-api.js | 6 ++ mail-worker/src/const/entity-const.js | 8 ++ mail-worker/src/entity/setting.js | 4 +- mail-worker/src/i18n/en.js | 1 + mail-worker/src/i18n/zh.js | 1 + mail-worker/src/index.js | 8 +- mail-worker/src/init/init.js | 12 +++ mail-worker/src/security/security.js | 5 +- mail-worker/src/service/kv-obj-service.js | 36 ++++++++ mail-worker/src/service/r2-service.js | 28 +++++- mail-worker/src/service/setting-service.js | 39 +++++--- 18 files changed, 213 insertions(+), 73 deletions(-) create mode 100644 mail-worker/src/service/kv-obj-service.js diff --git a/mail-vue/src/components/email-scroll/index.vue b/mail-vue/src/components/email-scroll/index.vue index acaa455..eb91acb 100644 --- a/mail-vue/src/components/email-scroll/index.vue +++ b/mail-vue/src/components/email-scroll/index.vue @@ -494,8 +494,8 @@ function getEmailList(refresh = false) { props.getEmailList(queryParam.emailId, queryParam.size).then(async data => { let end = Date.now(); let duration = end - start; - if (duration < 500 && !queryParam.emailId) { - await sleep(500 - duration) + if (duration < 300 && !queryParam.emailId) { + await sleep(300 - duration) } firstLoad.value = false diff --git a/mail-vue/src/i18n/en.js b/mail-vue/src/i18n/en.js index d279efa..029f42b 100644 --- a/mail-vue/src/i18n/en.js +++ b/mail-vue/src/i18n/en.js @@ -32,7 +32,7 @@ const en = { username: 'Username', password: 'Password', delAccount: 'Delete Account', - delAccountMsg: 'This will permanently delete your account and data. It cannot be reactivated.', + delAccountMsg: 'This will permanently delete your account and data. It cannot be reactivated', totalReceived: 'Total Received', totalSent: 'Total Sent', totalMailboxes: 'Total Accounts', @@ -137,7 +137,7 @@ const en = { websiteReg: 'Sign Up', loginDomain: 'Sign-In Box Domain', multipleEmail: 'Multiple Accounts', - multipleEmailDesc: 'Enable this feature to allow users to add multiple accounts.', + multipleEmailDesc: 'Enable this feature to allow users to add multiple accounts', customization: 'Customization', websiteTitle: 'Title', loginBoxOpacity: 'Login Box Opacity', @@ -145,7 +145,7 @@ const en = { emailSetting: 'Email', receiveEmail: 'Receive Email', autoRefresh: 'Auto Refresh', - autoRefreshDesc: 'Automatically fetch the latest emails from the server.', + autoRefreshDesc: 'Automatically fetch the latest emails from the server', sendEmail: 'Send Email', resendToken: 'Resend Token', oss: 'Object Storage', @@ -165,7 +165,7 @@ const en = { version: 'Version', community: 'Community', changeTitle: 'Change Title', - addResendTokenDesc: 'Input to add; leave empty to delete.', + addResendTokenDesc: 'Input to add; leave empty to delete', addOsDomain: 'Add Domain', domainDesc: 'Domain', addTurnstileSecret: 'Add turnstile secret', @@ -173,14 +173,14 @@ const en = { tgBotDesc: 'Forward received emails to a Telegram bot', tgBotToken: 'Bot token', toBotTokenDesc: 'Multiple user chat_ids, separated by commas', - otherEmailDesc: 'emails can be forwarded to external email, but must be verified via cloudflare.', + otherEmailDesc: 'emails can be forwarded to external email, but must be verified via cloudflare', otherEmailInputDesc: 'Separate multiple email addresses with commas.', - forwardingRulesDesc: 'Rule-based forwarding only forwards emails received by the specified address.', - ruleEmailsInputDesc: 'Separate multiple email addresses with commas.', + forwardingRulesDesc: 'Rule-based forwarding only forwards emails received by the specified address', + ruleEmailsInputDesc: 'Separate multiple email addresses with commas', resendTokenList: 'Token List', domain: 'Domain', optional: 'Optional', - subjectInputDesc: 'Please enter the email subject.', + subjectInputDesc: 'Please enter the email subject', changeUserName: 'Change Username', sendSeparately: 'Separately', send: 'Send', @@ -294,7 +294,10 @@ const en = { s3Configuration: 'S3 Configuration', confirmDeletionOfContacts: 'Confirm clearing contacts?', recentContacts: 'Recent contacts', - selectContacts: 'Select' + selectContacts: 'Select', + forcePathStyleDesc: 'Some self-hosted object storages require path-style access to be enabled', + kvStorageDesc: 'Replace object storage with KV, and update the access domain to a Worker custom domain', + kvStorage: 'KV Storage' } export default en diff --git a/mail-vue/src/i18n/zh.js b/mail-vue/src/i18n/zh.js index 757b602..6622b52 100644 --- a/mail-vue/src/i18n/zh.js +++ b/mail-vue/src/i18n/zh.js @@ -292,8 +292,12 @@ const zh = { include: '包含', delAllEmailConfirm: '确定要删除吗?', s3Configuration: 'S3 配置', + s3Desc: '设置其他S3协议存储,如果绑定了R2会优先用R2', confirmDeletionOfContacts: '确认清除这些联系人吗?', recentContacts: '最近联系人', - selectContacts: '选中' + selectContacts: '选中', + forcePathStyleDesc: '路径样式访问,一些自建的对象存储需要打开', + kvStorageDesc: '使用KV替代对象存储,访问域名改成worker自定义域', + kvStorage: 'KV存储' } export default zh diff --git a/mail-vue/src/layout/account/index.vue b/mail-vue/src/layout/account/index.vue index 922d52e..7c3288d 100644 --- a/mail-vue/src/layout/account/index.vue +++ b/mail-vue/src/layout/account/index.vue @@ -343,9 +343,8 @@ function getAccountList() { let end = Date.now(); let duration = end - start; - if (duration < 500) { - await sleep(500 - duration) - + if (duration < 300) { + await sleep(300 - duration) } if (list.length < queryParams.size) { diff --git a/mail-vue/src/request/setting.js b/mail-vue/src/request/setting.js index 041441f..9a5f9b0 100644 --- a/mail-vue/src/request/setting.js +++ b/mail-vue/src/request/setting.js @@ -16,6 +16,6 @@ export function setBackground(background) { return http.put('/setting/setBackground',{background}) } -export function physicsDeleteAll() { - return http.delete('/setting/physicsDeleteAll') -} \ No newline at end of file +export function deleteBackground() { + return http.delete('/setting/deleteBackground') +} diff --git a/mail-vue/src/views/sys-setting/index.vue b/mail-vue/src/views/sys-setting/index.vue index 2eddbf6..eb214ce 100644 --- a/mail-vue/src/views/sys-setting/index.vue +++ b/mail-vue/src/views/sys-setting/index.vue @@ -197,13 +197,30 @@
-
{{ $t('s3Configuration') }}
+
+ {{ $t('s3Configuration') }} + + + +
+
+
+ {{ $t('kvStorage') }} + + + +
+
+ +
+
@@ -636,7 +653,17 @@ - + +
+
+ ForcePathStyle + + + +
+ +
{{ t('clear') }} {{ t('save') }} @@ -649,7 +676,7 @@