diff --git a/README.md b/README.md index b6c611c8..ee665cc7 100644 --- a/README.md +++ b/README.md @@ -132,9 +132,13 @@ PREFIX = "tmp" # 要处理的邮箱名称前缀 # PASSWORDS = ["123", "456"] # admin 控制台密码, 不配置则不允许访问控制台 # ADMIN_PASSWORDS = ["123", "456"] +# admin 联系方式,不配置则不显示,可配置任意字符串 +# ADMIN_CONTACT = "xx@xx.xxx" DOMAINS = ["xxx.xxx1" , "xxx.xxx2"] # 你的域名 JWT_SECRET = "xxx" # 用于生成 jwt 的密钥 BLACK_LIST = "" # 黑名单,用于过滤发件人,逗号分隔 +# 默认发送邮件余额,如果不设置,将为 0 +# DEFAULT_SEND_BALANCE = 1 # dkim config # DKIM_SELECTOR = "mailchannels" # 参考 DKIM 部分 mailchannels._domainkey 的 mailchannels # DKIM_PRIVATE_KEY = "" # 参考 DKIM 部分 priv_key.txt 的内容 diff --git a/frontend/src/api/index.js b/frontend/src/api/index.js index dfbab668..e8a9a441 100644 --- a/frontend/src/api/index.js +++ b/frontend/src/api/index.js @@ -57,7 +57,8 @@ const getOpenSettings = async (message) => { label: domain, value: domain } - }) + }), + adminContact: res["adminContact"] || "", }; if (openSettings.value.needAuth) { showAuth.value = true; diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index 25dd7be1..b15d1dd8 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -10,6 +10,7 @@ export const useGlobalState = createGlobalState( const openSettings = ref({ prefix: '', needAuth: false, + adminContact: '', domains: [{ label: 'test.com', value: 'test.com' diff --git a/frontend/src/views/Admin.vue b/frontend/src/views/Admin.vue index db39e0ef..aa38c4e3 100644 --- a/frontend/src/views/Admin.vue +++ b/frontend/src/views/Admin.vue @@ -13,7 +13,7 @@ import MailsUnknow from './admin/MailsUnknow.vue'; import Maintenance from './admin/Maintenance.vue'; const { - localeCache, adminAuth, showAdminAuth, adminTab + localeCache, adminAuth, showAdminAuth, adminTab, loading } = useGlobalState() const message = useMessage() @@ -71,7 +71,7 @@ onMounted(async () => {

{{ t('accessTip') }}

diff --git a/frontend/src/views/Header.vue b/frontend/src/views/Header.vue index 1a859fcc..7219ec5e 100644 --- a/frontend/src/views/Header.vue +++ b/frontend/src/views/Header.vue @@ -6,6 +6,7 @@ import { useRoute, useRouter } from 'vue-router' import { useIsMobile } from '../utils/composables' import { DarkModeFilled, LightModeFilled, MenuFilled, AdminPanelSettingsFilled, SendFilled } from '@vicons/material' import { GithubAlt, Language, User, Home, Copy } from '@vicons/fa' +import AdminContact from './admin/AdminContact.vue' import { useGlobalState } from '../store' import { api } from '../api' @@ -14,7 +15,7 @@ const message = useMessage() const { jwt, localeCache, toggleDark, isDark, - showAuth, adminAuth, auth + showAuth, adminAuth, auth, loading } = useGlobalState() const { showLogin, openSettings, settings } = useGlobalState() const route = useRoute() @@ -22,6 +23,7 @@ const router = useRouter() const isMobile = useIsMobile() const isAdminRoute = computed(() => route.path.includes('admin')) +const showMobileMenu = ref(false) const showNewEmail = ref(false) const showLogout = ref(false) const showDelteAccount = ref(false) @@ -85,7 +87,8 @@ const { t } = useI18n({ getNewEmailTip3: 'You can choose a domain from the dropdown list.', yourAddress: 'Your email address is', password: 'Password', - passwordTip: 'Please copy the password and you can use it to login to your email account.', cancel: 'Cancel', + passwordTip: 'Please copy the password and you can use it to login to your email account.', + cancel: 'Cancel', ok: 'OK', copy: 'Copy', copied: 'Copied', @@ -138,10 +141,10 @@ const menuOptions = computed(() => [ label: () => h( NButton, { - bordered: false, - ghost: true, + text: true, size: "small", - onClick: () => router.push('/') + style: "width: 100%", + onClick: () => { router.push('/'); showMobileMenu.value = false; } }, { default: () => t('home'), @@ -154,10 +157,10 @@ const menuOptions = computed(() => [ label: () => h( NButton, { - bordered: false, - ghost: true, + text: true, size: "small", - onClick: () => router.push('/admin') + style: "width: 100%", + onClick: () => { router.push('/admin'); showMobileMenu.value = false; } }, { default: () => "Admin", @@ -171,9 +174,9 @@ const menuOptions = computed(() => [ label: () => h( NButton, { - bordered: false, - ghost: true, + text: true, size: "small", + style: "width: 100%", }, { default: () => t('user'), @@ -187,10 +190,10 @@ const menuOptions = computed(() => [ label: () => h( NButton, { - bordered: false, - ghost: true, + text: true, size: "small", - onClick: () => router.push('/sendbox') + style: "width: 100%", + onClick: () => { router.push('/sendbox'); showMobileMenu.value = false; } }, { default: () => t('sendbox') } ), @@ -200,10 +203,10 @@ const menuOptions = computed(() => [ label: () => h( NButton, { - bordered: false, - ghost: true, + text: true, size: "small", - onClick: () => { showPassword.value = true } + style: "width: 100%", + onClick: () => { showPassword.value = true; showMobileMenu.value = false; } }, { default: () => t('showPassword') } ), @@ -213,10 +216,10 @@ const menuOptions = computed(() => [ label: () => h( NButton, { - bordered: false, - ghost: true, + text: true, size: "small", - onClick: () => { router.push('/settings') } + style: "width: 100%", + onClick: () => { router.push('/settings'); showMobileMenu.value = false; } }, { default: () => t('settings') } ), @@ -226,10 +229,10 @@ const menuOptions = computed(() => [ label: () => h( NButton, { - bordered: false, - ghost: true, + text: true, size: "small", - onClick: () => { showLogout.value = true } + style: "width: 100%", + onClick: () => { showLogout.value = true; showMobileMenu.value = false; } }, { default: () => t('logout') } ), @@ -239,10 +242,10 @@ const menuOptions = computed(() => [ label: () => h( NButton, { - bordered: false, - ghost: true, + text: true, size: "small", - onClick: () => { showDelteAccount.value = true } + style: "width: 100%", + onClick: () => { showDelteAccount.value = true; showMobileMenu.value = false; } }, { default: () => t('delteAccount') } ), @@ -254,10 +257,10 @@ const menuOptions = computed(() => [ label: () => h( NButton, { - bordered: false, - ghost: true, + text: true, size: "small", - onClick: () => toggleDark() + style: "width: 100%", + onClick: () => { toggleDark(); showMobileMenu.value = false; } }, { default: () => isDark.value ? t('light') : t('dark'), @@ -272,10 +275,13 @@ const menuOptions = computed(() => [ label: () => h( NButton, { - bordered: false, - ghost: true, + text: true, size: "small", - onClick: () => localeCache.value == 'zh' ? changeLocale('en') : changeLocale('zh') + style: "width: 100%", + onClick: () => { + localeCache.value == 'zh' ? changeLocale('en') : changeLocale('zh'); + showMobileMenu.value = false; + } }, { default: () => localeCache.value == 'zh' ? "English" : "中文", @@ -290,9 +296,9 @@ const menuOptions = computed(() => [ label: () => h( NButton, { - bordered: !isMobile.value, - ghost: true, + text: true, size: "small", + style: "width: 100%", tag: "a", target: "_blank", href: "https://github.com/dreamhunter2333/cloudflare_temp_email", @@ -306,21 +312,6 @@ const menuOptions = computed(() => [ } ]); -const menuOptionsMobile = computed(() => [ - { - label: t('menu'), - icon: () => h( - NIcon, - { - component: MenuFilled - } - ), - key: "menu", - children: menuOptions.value - }, -]); - - const copy = async () => { try { await toClipboard(settings.value.address) @@ -384,13 +375,30 @@ onMounted(async () => { @@ -482,11 +490,12 @@ onMounted(async () => { + @@ -497,7 +506,7 @@ onMounted(async () => {

{{ t('logoutConfirm') }}

@@ -508,7 +517,7 @@ onMounted(async () => {

{{ t('delteAccountConfirm') }}

@@ -523,7 +532,7 @@ onMounted(async () => { minRows: 3 }" /> @@ -538,6 +547,11 @@ onMounted(async () => { justify-content: space-between; } +.mobile-menu-button { + width: 100%; + text-align: left; +} + .n-alert { margin-top: 10px; margin-bottom: 10px; diff --git a/frontend/src/views/MailBox.vue b/frontend/src/views/MailBox.vue index 73f21573..d2bda08a 100644 --- a/frontend/src/views/MailBox.vue +++ b/frontend/src/views/MailBox.vue @@ -127,7 +127,7 @@ onMounted(async () => {