From b7308587c6874a4033b3c6f2c9dfa5fae5b5d584 Mon Sep 17 00:00:00 2001 From: Dream Hunter Date: Thu, 9 May 2024 18:43:09 +0800 Subject: [PATCH] feat: admin search mailbox && fix generateName multi dot && user jwt exp in 30 days && UI globalTabplacement && useSideMargin (#214) * fix: generateName multi dot && user jwt exp in 30 days * feat: support admin search mailbox * fix: DELETE mail bug(should be raw_mails) * feat: UI add globalTabplacement * feat: UI add useSideMargin option --- CHANGELOG.md | 5 + frontend/src/App.vue | 9 +- frontend/src/api/index.js | 2 +- frontend/src/store/index.js | 4 + frontend/src/views/Admin.vue | 16 ++- frontend/src/views/Index.vue | 4 +- frontend/src/views/User.vue | 4 +- frontend/src/views/admin/Mails.vue | 18 ++- frontend/src/views/admin/Maintenance.vue | 9 ++ frontend/src/views/common/Appearance.vue | 82 +++++++++++ frontend/src/views/index/AccountSettings.vue | 26 +--- frontend/src/views/index/Login.vue | 5 +- worker/src/admin_api/index.js | 144 ++++++------------- worker/src/common.js | 29 ++++ worker/src/mails_api/send_mail_api.js | 2 +- worker/src/router.js | 2 +- worker/src/user_api/user.js | 5 +- worker/src/worker.js | 12 +- 18 files changed, 231 insertions(+), 147 deletions(-) create mode 100644 frontend/src/views/common/Appearance.vue diff --git a/CHANGELOG.md b/CHANGELOG.md index a00267ae..f13aa760 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,11 @@ ### function changs - 增加用户注册功能,可绑定邮箱地址,绑定后可自动获取邮箱JWT凭证 +- 增加默认以文本显示邮件,文本和HTML邮箱显示方式切换按钮 +- 修复 `BUG` 随机生成的邮箱名字不合法 #211 +- `admin` 邮件页面支持邮件内容搜索 #210 +- 修复删除地址时邮件未删除的BUG #213 +- UI 增加全局标签页位置配置, 侧边距配置 ## v0.3.3 diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 82c67190..4268290f 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -8,10 +8,11 @@ import Header from './views/Header.vue'; import Footer from './views/Footer.vue'; -const { localeCache, isDark, loading } = useGlobalState() +const { localeCache, isDark, loading, useSideMargin } = useGlobalState() const theme = computed(() => isDark.value ? darkTheme : null) const localeConfig = computed(() => localeCache.value == 'zh' ? zhCN : null) const isMobile = useIsMobile() +const showSideMargin = computed(() => !isMobile.value && !useSideMargin.value); const { locale } = useI18n({ useScope: 'global', @@ -39,8 +40,8 @@ onMounted(async () => { - - + +
@@ -51,7 +52,7 @@ onMounted(async () => {
- +
diff --git a/frontend/src/api/index.js b/frontend/src/api/index.js index cafb1de3..f2e6933d 100644 --- a/frontend/src/api/index.js +++ b/frontend/src/api/index.js @@ -10,7 +10,7 @@ const { const instance = axios.create({ baseURL: API_BASE, - timeout: 10000 + timeout: 30000 }); const apiFetch = async (path, options = {}) => { diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index c369687b..2902a5b1 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -54,6 +54,8 @@ export const useGlobalState = createGlobalState( const userJwt = useStorage('userJwt', ''); const userTab = useStorage('userTab', 'user_settings'); const indexTab = useStorage('indexTab', 'mailbox'); + const globalTabplacement = useStorage('globalTabplacement', 'top'); + const useSideMargin = useStorage('useSideMargin', true); const userOpenSettings = ref({ enable: false, enableMailVerify: false, @@ -91,6 +93,8 @@ export const useGlobalState = createGlobalState( indexTab, userOpenSettings, userSettings, + globalTabplacement, + useSideMargin, } }, ) diff --git a/frontend/src/views/Admin.vue b/frontend/src/views/Admin.vue index 68deadf3..ed038889 100644 --- a/frontend/src/views/Admin.vue +++ b/frontend/src/views/Admin.vue @@ -15,9 +15,10 @@ import UserSettings from './admin/UserSettings.vue'; import Mails from './admin/Mails.vue'; import MailsUnknow from './admin/MailsUnknow.vue'; import Maintenance from './admin/Maintenance.vue'; +import Appearance from './common/Appearance.vue'; const { - localeCache, adminAuth, showAdminAuth, adminTab, loading + localeCache, adminAuth, showAdminAuth, adminTab, loading, globalTabplacement } = useGlobalState() const message = useMessage() @@ -44,7 +45,9 @@ const { t } = useI18n({ unknow: 'Mails with unknow receiver', senderAccess: 'Sender Access Control', sendBox: 'Send Box', + statistics: 'Statistics', maintenance: 'Maintenance', + appearance: 'Appearance', ok: 'OK', }, zh: { @@ -59,7 +62,9 @@ const { t } = useI18n({ unknow: '无收件人邮件', senderAccess: '发件权限控制', sendBox: '发件箱', + statistics: '统计', maintenance: '维护', + appearance: '外观', ok: '确定', } } @@ -85,8 +90,7 @@ onMounted(async () => { - - + @@ -114,9 +118,15 @@ onMounted(async () => { + + + + + + diff --git a/frontend/src/views/Index.vue b/frontend/src/views/Index.vue index afc9b110..28560b47 100644 --- a/frontend/src/views/Index.vue +++ b/frontend/src/views/Index.vue @@ -11,7 +11,7 @@ import SendBox from './index/SendBox.vue'; import SendMail from './index/SendMail.vue'; import AccountSettings from './index/AccountSettings.vue'; -const { localeCache, settings, openSettings, indexTab } = useGlobalState() +const { localeCache, settings, openSettings, indexTab, globalTabplacement } = useGlobalState() const { t } = useI18n({ locale: localeCache.value || 'zh', @@ -45,7 +45,7 @@ const deleteMail = async (curMailId) => {