Skip to content

Commit 23d1709

Browse files
feat: support admin create address && add ENABLE_USER_CREATE_EMAIL config (#175)
1 parent 6ce7e2e commit 23d1709

16 files changed

Lines changed: 306 additions & 153 deletions

File tree

.github/workflows/docs_deploy.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
push:
55
paths:
66
- "vitepress-docs/**"
7-
branches:
8-
- main
97
tags:
108
- "*"
119
workflow_dispatch:

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# CHANGE LOG
22

3+
## main branch to be released
4+
5+
- `ENABLE_USER_CREATE_EMAIL` 是否允许用户创建邮件
6+
- 允许 admin 创建无前缀的邮件
7+
38
## v0.3.0
49

5-
### Breaking Changes:
10+
### Breaking Changes
611

712
`address` 表的前缀将从代码中迁移到 db 中,请将下面 sql 中的 `tmp` 替换为你的前缀,然后执行。
813
如果你的数据很重要,请先备份数据库。

frontend/src/api/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const getOpenSettings = async (message) => {
5959
}
6060
}),
6161
adminContact: res["adminContact"] || "",
62+
enableUserCreateEmail: res["enableUserCreateEmail"] || false,
6263
enableUserDeleteEmail: res["enableUserDeleteEmail"] || false,
6364
enableAutoReply: res["enableAutoReply"] || false,
6465
};

frontend/src/components/MailBox.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup>
2-
import { watch, onMounted, ref } from "vue";
2+
import { watch, onMounted, ref, onBeforeUnmount } from "vue";
33
import { useMessage } from 'naive-ui'
44
import { useI18n } from 'vue-i18n'
55
import { useGlobalState } from '../store'
@@ -149,6 +149,10 @@ const deleteMail = async () => {
149149
onMounted(async () => {
150150
await refresh();
151151
});
152+
153+
onBeforeUnmount(() => {
154+
clearInterval(timer.value)
155+
})
152156
</script>
153157

154158
<template>

frontend/src/store/index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ export const useGlobalState = createGlobalState(
1111
prefix: '',
1212
needAuth: false,
1313
adminContact: '',
14+
enableUserCreateEmail: false,
1415
enableUserDeleteEmail: false,
1516
enableAutoReply: false,
16-
domains: [{
17-
label: 'test.com',
18-
value: 'test.com'
19-
}]
17+
domains: []
2018
})
2119
const settings = ref({
2220
fetched: false,
@@ -38,7 +36,6 @@ export const useGlobalState = createGlobalState(
3836
const jwt = useStorage('jwt', '');
3937
const localeCache = useStorage('locale', 'zh');
4038
const themeSwitch = useStorage('themeSwitch', false);
41-
const showLogin = ref(false);
4239
const adminTab = ref("account");
4340
const adminMailTabAddress = ref("");
4441
const adminSendBoxTabAddress = ref("");
@@ -55,7 +52,6 @@ export const useGlobalState = createGlobalState(
5552
themeSwitch,
5653
adminAuth,
5754
showAdminAuth,
58-
showLogin,
5955
adminTab,
6056
adminMailTabAddress,
6157
adminSendBoxTabAddress,

frontend/src/views/Admin.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import SenderAccess from './admin/SenderAccess.vue'
88
import Statistics from "./admin/Statistics.vue"
99
import SendBox from './admin/SendBox.vue';
1010
import Account from './admin/Account.vue';
11+
import CreateAccount from './admin/CreateAccount.vue';
1112
import Mails from './admin/Mails.vue';
1213
import MailsUnknow from './admin/MailsUnknow.vue';
1314
import Maintenance from './admin/Maintenance.vue';
@@ -33,6 +34,7 @@ const { t } = useI18n({
3334
accessTip: 'Please enter the admin password',
3435
mails: 'Emails',
3536
account: 'Account',
37+
account_create: 'Create Account',
3638
unknow: 'Mails with unknow receiver',
3739
senderAccess: 'Sender Access Control',
3840
sendBox: 'Send Box',
@@ -44,6 +46,7 @@ const { t } = useI18n({
4446
accessTip: '请输入 Admin 密码',
4547
mails: '邮件',
4648
account: '账号',
49+
account_create: '创建账号',
4750
unknow: '无收件人邮件',
4851
senderAccess: '发件权限控制',
4952
sendBox: '发件箱',
@@ -64,10 +67,7 @@ onMounted(async () => {
6467
<template>
6568
<div>
6669
<n-modal v-model:show="showAdminAuth" :closable="false" :closeOnEsc="false" :maskClosable="false" preset="dialog"
67-
title="Dialog">
68-
<template #header>
69-
<div>{{ t('accessHeader') }}</div>
70-
</template>
70+
:title="t('accessHeader')">
7171
<p>{{ t('accessTip') }}</p>
7272
<n-input v-model:value="adminAuth" type="textarea" :autosize="{ minRows: 3 }" />
7373
<template #action>
@@ -81,6 +81,9 @@ onMounted(async () => {
8181
<n-tab-pane name="account" :tab="t('account')">
8282
<Account />
8383
</n-tab-pane>
84+
<n-tab-pane name="account_create" :tab="t('account_create')">
85+
<CreateAccount />
86+
</n-tab-pane>
8487
<n-tab-pane name="mails" :tab="t('mails')">
8588
<Mails />
8689
</n-tab-pane>

0 commit comments

Comments
 (0)