From 1d8dcc94e921a81028dbb86eee56725d8061f831 Mon Sep 17 00:00:00 2001 From: eoao Date: Tue, 22 Jul 2025 23:33:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B3=A8=E5=86=8C=E7=A0=81?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=97=A0=E6=95=88bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/email-scroll/index.vue | 2 +- mail-vue/src/components/tiny-editor/index.vue | 4 +- mail-vue/src/i18n/en.js | 15 +++--- mail-vue/src/i18n/zh.js | 13 +++-- mail-vue/src/init/init.js | 2 - mail-vue/src/layout/aside/index.vue | 2 +- mail-vue/src/layout/header/index.vue | 26 +++++---- mail-vue/src/perm/perm.js | 26 ++++++++- mail-vue/src/router/index.js | 24 +-------- mail-vue/src/views/content/index.vue | 2 +- mail-vue/src/views/email/index.vue | 2 +- mail-vue/src/views/role/index.vue | 4 +- mail-vue/src/views/send/index.vue | 2 +- mail-vue/src/views/star/index.vue | 2 +- mail-vue/src/views/user/index.vue | 8 ++- mail-worker/src/email/email.js | 8 +-- mail-worker/src/i18n/en.js | 10 ++-- mail-worker/src/i18n/i18n.js | 2 +- mail-worker/src/i18n/zh.js | 4 +- mail-worker/src/init/init.js | 6 +-- mail-worker/src/security/security.js | 7 +-- mail-worker/src/service/email-service.js | 54 +++++++++---------- mail-worker/src/service/resend-service.js | 2 +- 23 files changed, 115 insertions(+), 112 deletions(-) diff --git a/mail-vue/src/components/email-scroll/index.vue b/mail-vue/src/components/email-scroll/index.vue index 3678018..b8050bd 100644 --- a/mail-vue/src/components/email-scroll/index.vue +++ b/mail-vue/src/components/email-scroll/index.vue @@ -93,7 +93,7 @@ diff --git a/mail-vue/src/components/tiny-editor/index.vue b/mail-vue/src/components/tiny-editor/index.vue index c3146c7..1f55e42 100644 --- a/mail-vue/src/components/tiny-editor/index.vue +++ b/mail-vue/src/components/tiny-editor/index.vue @@ -9,6 +9,7 @@ import {ref, onMounted, onBeforeUnmount, watch, nextTick, shallowRef, defineEmits} from 'vue'; import loading from "@/components/loading/index.vue"; import {compressImage} from "@/utils/file-utils.js"; +import { useI18n } from 'vue-i18n' defineExpose({ clearEditor, focus, @@ -27,6 +28,7 @@ const props = defineProps({ }); +const { locale } = useI18n() const emit = defineEmits(['change']); const editor = shallowRef(null); const isInitialized = ref(false); @@ -81,7 +83,7 @@ function initEditor() { }, font_size_formats: '8px 10px 12px 14px 16px 18px 24px 36px', emoticons_search: false, - language: 'zh_CN', + language: locale.value === 'zh' ? 'zh_CN' : 'en', language_url: '/tinymce/langs/zh_CN.js', menubar: false, license_key: 'gpl', diff --git a/mail-vue/src/i18n/en.js b/mail-vue/src/i18n/en.js index 9aae14f..d505d2b 100644 --- a/mail-vue/src/i18n/en.js +++ b/mail-vue/src/i18n/en.js @@ -67,9 +67,8 @@ const en = { loginDevice: 'Login device', loginSystem: 'Login system', browserLogin: 'Browser Login', - noPerm: 'Unauthorized', - noLimit: 'Unlimited', - blocked: 'Blocked', + unauthorized: 'Unauthorized', + unlimited: 'Unlimited', sendCount: 'Send email : ', accountCount: 'Add account : ', action: 'Action', @@ -173,7 +172,7 @@ const en = { tgBotDesc: 'Forward received emails to a Telegram bot', tgBotToken: 'Bot token', toBotTokenDesc: 'Multiple user chat_ids, separated by commas', - otherEmailDec: 'emails can be forwarded to other providers, but must be verified via cloudflare', + otherEmailDec: '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.', @@ -225,7 +224,7 @@ const en = { allRestore: 'Includes deleted data', restoreSuccessMsg: 'Restore successful', banRestore: 'Confirm banning {msg}?', - signOut: 'Sign out', + logOut: 'Sign out', clearContentConfirm: 'Are you sure to clear all content?', attLimitMsg: 'Attachment size limit: 28MB', emptyRecipientMsg: 'Recipient email cannot be empty', @@ -240,9 +239,9 @@ const en = { sendingErrorMsg: 'Sending in progress', networkErrorMsg: 'Network error. Check your internet', timeoutErrorMsg: 'Timeout. Try again later', - serverBusyErrorMsg: 'Server busy. Please try again later.', - reqFailErrorMsg: 'Request failed. Try again later.', - mailDetails: 'Message', + serverBusyErrorMsg: 'Server busy. Please try again later', + reqFailErrorMsg: 'Request failed. Try again later', + message: 'Message', language: 'Language', totalUserAccount: '{msg}', sendBanned: 'Banned', diff --git a/mail-vue/src/i18n/zh.js b/mail-vue/src/i18n/zh.js index 7687849..ab3f812 100644 --- a/mail-vue/src/i18n/zh.js +++ b/mail-vue/src/i18n/zh.js @@ -35,7 +35,7 @@ const zh = { totalSent: '发送数量', totalMailboxes: '邮箱数量', totalUsers: '用户数量', - deleted: '已删除', + deleted: '删除', active: '正常', emailSource: '邮件来源', userGrowth: '用户增长', @@ -67,9 +67,8 @@ const zh = { loginDevice: '登录设备', loginSystem: '登录系统', browserLogin: '登录浏览器', - noPerm: '无权限', - noLimit: '无限制', - blocked: '被禁用', + unauthorized: '无权限', + unlimited: '无限制', sendCount: '邮件发送 :', accountCount: '邮箱添加 :', action: '操作', @@ -225,7 +224,7 @@ const zh = { allRestore: '包括已删除的数据', restoreSuccessMsg: '恢复成功', banRestore: '确认禁用 {msg} 吗?', - signOut: '退出', + logOut: '退出', clearContentConfirm: '确定要清空所有内容吗?', attLimitMsg: '附件大小限制28mb', emptyRecipientMsg: '收件人邮箱地址不能为空', @@ -242,10 +241,10 @@ const zh = { timeoutErrorMsg: '请求超时,请稍后重试', serverBusyErrorMsg: '服务器繁忙,请稍后重试', reqFailErrorMsg: '请求失败,请稍后再试', - mailDetails: '邮件详情', + message: '邮件详情', language: '网站语言', totalUserAccount: '{msg} 个', - sendBan: '已禁用', + sendBanned: '已禁用', wrote: '来信' } export default zh \ No newline at end of file diff --git a/mail-vue/src/init/init.js b/mail-vue/src/init/init.js index 434df80..7ed09f0 100644 --- a/mail-vue/src/init/init.js +++ b/mail-vue/src/init/init.js @@ -16,8 +16,6 @@ export async function init() { const token = localStorage.getItem('token'); - console.log(settingStore.lang) - if (!settingStore.lang) { settingStore.lang = navigator.language.split('-')[0] } diff --git a/mail-vue/src/layout/aside/index.vue b/mail-vue/src/layout/aside/index.vue index 5d8d5bd..8a3dbbd 100644 --- a/mail-vue/src/layout/aside/index.vue +++ b/mail-vue/src/layout/aside/index.vue @@ -31,7 +31,7 @@ {{$t('settings')}} -
+
{{$t('manage')}}
{{$t('disabled')}} {{ $t('totalUserAccount',{msg: accountCount}) }} - {{$t('noLimit')}} - {{$t('blocked')}} + {{$t('unlimited')}} + {{$t('unauthorized')}}
- {{$t('signOut')}} + {{$t('logOut')}}
@@ -94,20 +94,21 @@ const sendType = computed(() => { } if (!hasPerm('email:send')) { - return t('noPerm') + return t('unauthorized') + } + + if (userStore.user.role.sendType === 'ban') { + return t('sendBanned') } if (!userStore.user.role.sendCount) { - return t('noLimit') - } - - if (userStore.user.role.sendCount < 0) { - return t('blocked') + return t('unlimited') } if (userStore.user.role.sendType === 'day') { return t('daily') } + if (userStore.user.role.sendType === 'count') { return t('total') } @@ -115,15 +116,20 @@ const sendType = computed(() => { const sendCount = computed(() => { + if (!hasPerm('email:send')) { return null } + if (userStore.user.role.sendType === 'ban') { + return null + } + if (!userStore.user.role.sendCount) { return null } - if (userStore.user.role.sendCount < 0) { + if (settingStore.settings.send === 1) { return null } diff --git a/mail-vue/src/perm/perm.js b/mail-vue/src/perm/perm.js index b5fee40..fda6e3a 100644 --- a/mail-vue/src/perm/perm.js +++ b/mail-vue/src/perm/perm.js @@ -20,7 +20,7 @@ export default { } } -export function hasPerm(permKey) { +export function hasPerm(permKey) { const {permKeys} = useUserStore().user; return permKeys.includes('*') || permKeys.includes(permKey); } @@ -37,6 +37,28 @@ export function permsToRouter(permKeys) { } const routers = { + 'email:send': [ + { + path: '/sent', + name: 'send', + component: () => import('@/views/send/index.vue'), + meta: { + title: 'sent', + name: 'send', + menu: true + } + }, + { + path: '/drafts', + name: 'draft', + component: () => import('@/views/draft/index.vue'), + meta: { + title: 'drafts', + name: 'draft', + menu: true + } + } + ], 'user:query': [{ path: '/all-users', name: 'user', @@ -58,7 +80,7 @@ const routers = { } }], 'setting:query': [{ - path: '/sys-setting', + path: '/system-setting', name: 'sys-setting', component: () => import('@/views/sys-setting/index.vue'), meta: { diff --git a/mail-vue/src/router/index.js b/mail-vue/src/router/index.js index 6465af2..0537f6f 100644 --- a/mail-vue/src/router/index.js +++ b/mail-vue/src/router/index.js @@ -19,31 +19,11 @@ const routes = [ } }, { - path: '/sent', - name: 'send', - component: () => import('@/views/send/index.vue'), - meta: { - title: 'sent', - name: 'send', - menu: true - } - }, - { - path: '/drafts', - name: 'draft', - component: () => import('@/views/draft/index.vue'), - meta: { - title: 'drafts', - name: 'draft', - menu: true - } - }, - { - path: '/content', + path: '/message', name: 'content', component: () => import('@/views/content/index.vue'), meta: { - title: 'mailDetails', + title: 'message', name: 'content', menu: false } diff --git a/mail-vue/src/views/content/index.vue b/mail-vue/src/views/content/index.vue index 341dcf3..52f6bae 100644 --- a/mail-vue/src/views/content/index.vue +++ b/mail-vue/src/views/content/index.vue @@ -7,7 +7,7 @@ - +
diff --git a/mail-vue/src/views/email/index.vue b/mail-vue/src/views/email/index.vue index c6150f7..86971ac 100644 --- a/mail-vue/src/views/email/index.vue +++ b/mail-vue/src/views/email/index.vue @@ -64,7 +64,7 @@ function jumpContent(email) { emailStore.contentData.delType = 'logic' emailStore.contentData.showStar = true emailStore.contentData.showReply = true - router.push('/content') + router.push('/message') } const existIds = new Set(); diff --git a/mail-vue/src/views/role/index.vue b/mail-vue/src/views/role/index.vue index 76893d4..576f5ab 100644 --- a/mail-vue/src/views/role/index.vue +++ b/mail-vue/src/views/role/index.vue @@ -14,7 +14,7 @@ style="width: 100%;" > - +