新增KV数据库存储附件

This commit is contained in:
eoao
2025-10-21 20:45:20 +08:00
parent dad4a22356
commit fdf9e95d67
18 changed files with 213 additions and 73 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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) {

View File

@@ -16,6 +16,6 @@ export function setBackground(background) {
return http.put('/setting/setBackground',{background})
}
export function physicsDeleteAll() {
return http.delete('/setting/physicsDeleteAll')
}
export function deleteBackground() {
return http.delete('/setting/deleteBackground')
}

View File

@@ -197,13 +197,30 @@
</div>
</div>
<div class="setting-item">
<div><span>{{ $t('s3Configuration') }}</span></div>
<div>
<span>{{ $t('s3Configuration') }}</span>
<el-tooltip effect="dark" :content="$t('s3Desc')">
<Icon class="warning" icon="fe:warning" width="18" height="18"/>
</el-tooltip>
</div>
<div class="r2domain">
<el-button class="opt-button" size="small" type="primary" @click="addS3Show = true">
<Icon icon="fluent:settings-48-regular" width="16" height="16"/>
</el-button>
</div>
</div>
<div class="setting-item">
<div>
<span>{{ $t('kvStorage') }}</span>
<el-tooltip effect="dark" :content="$t('kvStorageDesc')">
<Icon class="warning" icon="fe:warning" width="18" height="18"/>
</el-tooltip>
</div>
<div class="r2domain">
<el-switch @change="change" :before-change="beforeChange" :active-value="0" :inactive-value="1"
v-model="setting.kvStorage"/>
</div>
</div>
</div>
</div>
@@ -636,7 +653,17 @@
<el-input class="dialog-input" type="text" placeholder="Region" v-model="s3.region"/>
<el-input class="dialog-input" type="text" :placeholder="setting.s3AccessKey || 'Access Key'"
v-model="s3.s3AccessKey"/>
<el-input type="text" :placeholder="setting.s3SecretKey || 'Secret Key'" v-model="s3.s3SecretKey"/>
<el-input style="margin-bottom: 10px" type="text" :placeholder="setting.s3SecretKey || 'Secret Key'" v-model="s3.s3SecretKey"/>
<div class="force-path-style">
<div class="force-path-style-left">
<span>ForcePathStyle</span>
<el-tooltip effect="dark" :content="$t('forcePathStyleDesc')">
<Icon class="warning" icon="fe:warning" width="18" height="18"/>
</el-tooltip>
</div>
<el-switch :before-change="beforeChange" :active-value="0" :inactive-value="1"
v-model="s3.forcePathStyle"/>
</div>
<div class="s3-button">
<el-button :loading="clearS3Loading" @click="clearS3">{{ t('clear') }}</el-button>
<el-button type="primary" :loading="settingLoading && !clearS3Loading" @click="saveS3">{{ t('save') }}</el-button>
@@ -649,7 +676,7 @@
<script setup>
import {computed, defineOptions, reactive, ref} from "vue";
import {physicsDeleteAll, setBackground, settingQuery, settingSet} from "@/request/setting.js";
import {deleteBackground, setBackground, settingQuery, settingSet} from "@/request/setting.js";
import {useSettingStore} from "@/store/setting.js";
import {useUiStore} from "@/store/ui.js";
import {useUserStore} from "@/store/user.js";
@@ -718,7 +745,8 @@ const s3 = reactive({
endpoint: '',
region: '',
s3AccessKey: '',
s3SecretKey: ''
s3SecretKey: '',
forcePathStyle: 1
})
const noticeForm = reactive({
@@ -799,6 +827,7 @@ function resetAddS3Form() {
s3.region = setting.value.region
s3.s3AccessKey = ''
s3.s3SecretKey = ''
s3.forcePathStyle = setting.value.forcePathStyle
}
const resendList = computed(() => {
@@ -977,7 +1006,8 @@ function clearS3() {
endpoint: '',
region: '',
s3AccessKey: '',
s3SecretKey: ''
s3SecretKey: '',
forcePathStyle: 1
}
clearS3Loading.value = true
editSetting(form)
@@ -988,7 +1018,8 @@ function saveS3() {
const form = {
bucket: s3.bucket,
endpoint: s3.endpoint,
region: s3.region
region: s3.region,
forcePathStyle: s3.forcePathStyle
}
if (s3.s3AccessKey) form.s3AccessKey = s3.s3AccessKey
@@ -1034,35 +1065,21 @@ const opacityChange = debounce(doOpacityChange, 1000, {
trailing: true
})
function physicsDeleteAllData() {
ElMessageBox.prompt(t('clearAllDelConfirm'), {
confirmButtonText: t('confirm'),
cancelButtonText: t('cancel'),
dangerouslyUseHTMLString: true,
title: t('warning'),
type: 'warning',
inputPattern: new RegExp(`^${t('delInputPattern')}$`),
inputErrorMessage: t('inputErrorMessage'),
}).then(() => {
physicsDeleteAll().then(() => {
ElMessage({
message: t('delSuccessMsg'),
type: "success",
plain: true
})
})
})
}
function delBackground() {
ElMessageBox.confirm(t('delBackgroundConfirm'), {
confirmButtonText: t('confirm'),
cancelButtonText: t('cancel'),
type: 'warning'
}).then(() => {
backgroundUrl.value = ''
setting.value.background = null
editSetting({background: null})
deleteBackground().then(() => {
backgroundUrl.value = ''
setting.value.background = null
ElMessage({
message: t('delSuccessMsg'),
type: "success",
plain: true
})
})
})
}
@@ -1368,7 +1385,7 @@ function editSetting(settingForm, refreshStatus = true) {
}
.warning {
margin-left: 4px;
margin-left: 2px;
color: grey;
cursor: pointer;
}
@@ -1595,6 +1612,19 @@ function editSetting(settingForm, refreshStatus = true) {
margin-bottom: 15px;
}
.force-path-style {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
.force-path-style-left {
display: flex;
justify-content: center;
align-items: center;
gap: 3px;
}
}
.concerning-item {
display: flex;
align-items: center;
@@ -1648,7 +1678,7 @@ function editSetting(settingForm, refreshStatus = true) {
}
form .el-button {
margin-top: 15px;
margin-top: 10px;
width: 100%;
}