mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-09-07 00:17:12 +08:00
fix: remove cleanup address due to many table need to be clean (#240)
This commit is contained in:
@@ -26,7 +26,6 @@ const { t } = useI18n({
|
|||||||
tip: 'Please input the cleanup days',
|
tip: 'Please input the cleanup days',
|
||||||
mailBoxLabel: 'Clean up days for mailbox',
|
mailBoxLabel: 'Clean up days for mailbox',
|
||||||
mailUnknowLabel: "Clean up days for unknow receiver",
|
mailUnknowLabel: "Clean up days for unknow receiver",
|
||||||
addressUnActiveLabel: "Clean up days for unactive address",
|
|
||||||
sendBoxLabel: "Clean up days for sendbox",
|
sendBoxLabel: "Clean up days for sendbox",
|
||||||
cleanupNow: "Cleanup now",
|
cleanupNow: "Cleanup now",
|
||||||
autoCleanup: "Auto cleanup",
|
autoCleanup: "Auto cleanup",
|
||||||
@@ -38,7 +37,6 @@ const { t } = useI18n({
|
|||||||
tip: '请输入清理天数',
|
tip: '请输入清理天数',
|
||||||
mailBoxLabel: '收件箱清理天数',
|
mailBoxLabel: '收件箱清理天数',
|
||||||
mailUnknowLabel: "无收件人邮件清理天数",
|
mailUnknowLabel: "无收件人邮件清理天数",
|
||||||
addressUnActiveLabel: "未活跃地址清理天数",
|
|
||||||
sendBoxLabel: "发件箱清理天数",
|
sendBoxLabel: "发件箱清理天数",
|
||||||
autoCleanup: "自动清理",
|
autoCleanup: "自动清理",
|
||||||
cleanupSuccess: "清理成功",
|
cleanupSuccess: "清理成功",
|
||||||
@@ -123,18 +121,6 @@ onMounted(async () => {
|
|||||||
{{ t('cleanupNow') }}
|
{{ t('cleanupNow') }}
|
||||||
</n-button>
|
</n-button>
|
||||||
</n-form-item-row>
|
</n-form-item-row>
|
||||||
<n-form-item-row :label="t('addressUnActiveLabel')">
|
|
||||||
<n-checkbox v-model:checked="cleanupModel.enableAddressAutoCleanup">
|
|
||||||
{{ t('autoCleanup') }}
|
|
||||||
</n-checkbox>
|
|
||||||
<n-input-number v-model:value="cleanupModel.cleanAddressDays" :placeholder="t('tip')" />
|
|
||||||
<n-button @click="cleanup('address', cleanupModel.cleanAddressDays)">
|
|
||||||
<template #icon>
|
|
||||||
<n-icon :component="CleaningServicesFilled" />
|
|
||||||
</template>
|
|
||||||
{{ t('cleanupNow') }}
|
|
||||||
</n-button>
|
|
||||||
</n-form-item-row>
|
|
||||||
<n-form-item-row :label="t('sendBoxLabel')">
|
<n-form-item-row :label="t('sendBoxLabel')">
|
||||||
<n-checkbox v-model:checked="cleanupModel.enableSendBoxAutoCleanup">
|
<n-checkbox v-model:checked="cleanupModel.enableSendBoxAutoCleanup">
|
||||||
{{ t('autoCleanup') }}
|
{{ t('autoCleanup') }}
|
||||||
|
|||||||
@@ -68,12 +68,6 @@ export const cleanup = async (c, cleanType, cleanDays) => {
|
|||||||
(select name from address) AND created_at < datetime('now', '-${cleanDays} day')`
|
(select name from address) AND created_at < datetime('now', '-${cleanDays} day')`
|
||||||
).run();
|
).run();
|
||||||
break;
|
break;
|
||||||
case "address":
|
|
||||||
await c.env.DB.prepare(`
|
|
||||||
DELETE FROM address WHERE updated_at < datetime('now', '-${cleanDays} day')`
|
|
||||||
+ ` AND id NOT IN (SELECT address_id FROM users_address)`
|
|
||||||
).run();
|
|
||||||
break;
|
|
||||||
case "sendbox":
|
case "sendbox":
|
||||||
await c.env.DB.prepare(`
|
await c.env.DB.prepare(`
|
||||||
DELETE FROM sendbox WHERE created_at < datetime('now', '-${cleanDays} day')`
|
DELETE FROM sendbox WHERE created_at < datetime('now', '-${cleanDays} day')`
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ export class CleanupSettings {
|
|||||||
const {
|
const {
|
||||||
enableMailsAutoCleanup, cleanMailsDays,
|
enableMailsAutoCleanup, cleanMailsDays,
|
||||||
enableUnknowMailsAutoCleanup, cleanUnknowMailsDays,
|
enableUnknowMailsAutoCleanup, cleanUnknowMailsDays,
|
||||||
enableAddressAutoCleanup, cleanAddressDays,
|
|
||||||
enableSendBoxAutoCleanup, cleanSendBoxDays
|
enableSendBoxAutoCleanup, cleanSendBoxDays
|
||||||
} = data || {};
|
} = data || {};
|
||||||
/** @type {boolean|undefined} */
|
/** @type {boolean|undefined} */
|
||||||
@@ -41,10 +40,6 @@ export class CleanupSettings {
|
|||||||
/** @type {number|undefined} */
|
/** @type {number|undefined} */
|
||||||
this.cleanUnknowMailsDays = cleanUnknowMailsDays;
|
this.cleanUnknowMailsDays = cleanUnknowMailsDays;
|
||||||
/** @type {boolean|undefined} */
|
/** @type {boolean|undefined} */
|
||||||
this.enableAddressAutoCleanup = enableAddressAutoCleanup;
|
|
||||||
/** @type {number|undefined} */
|
|
||||||
this.cleanAddressDays = cleanAddressDays;
|
|
||||||
/** @type {boolean|undefined} */
|
|
||||||
this.enableSendBoxAutoCleanup = enableSendBoxAutoCleanup;
|
this.enableSendBoxAutoCleanup = enableSendBoxAutoCleanup;
|
||||||
/** @type {number|undefined} */
|
/** @type {number|undefined} */
|
||||||
this.cleanSendBoxDays = cleanSendBoxDays;
|
this.cleanSendBoxDays = cleanSendBoxDays;
|
||||||
|
|||||||
@@ -25,13 +25,6 @@ export async function scheduled(event, env, ctx) {
|
|||||||
autoCleanupSetting.cleanUnknowMailsDays
|
autoCleanupSetting.cleanUnknowMailsDays
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (autoCleanupSetting.enableAddressAutoCleanup && autoCleanupSetting.cleanAddressDays > 0) {
|
|
||||||
await cleanup(
|
|
||||||
{ env: env, },
|
|
||||||
"address",
|
|
||||||
autoCleanupSetting.cleanAddressDays
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (autoCleanupSetting.enableSendBoxAutoCleanup && autoCleanupSetting.cleanSendBoxDays > 0) {
|
if (autoCleanupSetting.enableSendBoxAutoCleanup && autoCleanupSetting.cleanSendBoxDays > 0) {
|
||||||
await cleanup(
|
await cleanup(
|
||||||
{ env: env, },
|
{ env: env, },
|
||||||
|
|||||||
Reference in New Issue
Block a user