+
@@ -211,14 +211,14 @@ onMounted(async () => {
{{ t('autoRefresh') }}
-
+
{{ t('refresh') }}
clickRow(row)">
-
+
ID: {{ row.id }}
@@ -303,6 +303,10 @@ onMounted(async () => {
text-align: left;
}
+.center {
+ text-align: center;
+}
+
.overlay {
width: 100%;
height: 100%;
diff --git a/frontend/src/views/admin/Account.vue b/frontend/src/views/admin/Account.vue
index c5f85b19..9d846b46 100644
--- a/frontend/src/views/admin/Account.vue
+++ b/frontend/src/views/admin/Account.vue
@@ -8,7 +8,7 @@ import { NMenu } from 'naive-ui';
import { MenuFilled } from '@vicons/material'
const {
- localeCache, adminAuth, showAdminAuth,
+ localeCache, adminAuth, showAdminAuth, loading,
adminTab, adminMailTabAddress, adminSendBoxTabAddress
} = useGlobalState()
const message = useMessage()
@@ -218,7 +218,7 @@ onMounted(async () => {
{{ t('deleteTip') }}
-
+
{{ t('delteAccount') }}
diff --git a/frontend/src/views/admin/AdminContact.vue b/frontend/src/views/admin/AdminContact.vue
new file mode 100644
index 00000000..2cd1e48c
--- /dev/null
+++ b/frontend/src/views/admin/AdminContact.vue
@@ -0,0 +1,23 @@
+
+
+
+
+ {{ t('adminContact', { msg: openSettings.adminContact }) }}
+
+
diff --git a/frontend/src/views/admin/SenderAccess.vue b/frontend/src/views/admin/SenderAccess.vue
index a88d876d..395ac433 100644
--- a/frontend/src/views/admin/SenderAccess.vue
+++ b/frontend/src/views/admin/SenderAccess.vue
@@ -5,7 +5,7 @@ import { useI18n } from 'vue-i18n'
import { useGlobalState } from '../../store'
import { api } from '../../api'
-const { localeCache } = useGlobalState()
+const { localeCache, loading } = useGlobalState()
const message = useMessage()
const { t } = useI18n({
@@ -161,7 +161,7 @@ onMounted(async () => {
-
+
{{ t('ok') }}
diff --git a/frontend/src/views/admin/Statistics.vue b/frontend/src/views/admin/Statistics.vue
index 5c88eebf..98442b33 100644
--- a/frontend/src/views/admin/Statistics.vue
+++ b/frontend/src/views/admin/Statistics.vue
@@ -59,34 +59,36 @@ onMounted(async () => {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/views/send/SendMail.vue b/frontend/src/views/send/SendMail.vue
index 732393ff..2511390b 100644
--- a/frontend/src/views/send/SendMail.vue
+++ b/frontend/src/views/send/SendMail.vue
@@ -5,6 +5,7 @@ import { DomEditor } from '@wangeditor/editor'
import { useI18n } from 'vue-i18n'
import { onMounted, onBeforeUnmount, ref, shallowRef } from 'vue'
import { useStorage } from '@vueuse/core'
+import AdminContact from '../admin/AdminContact.vue'
import { useGlobalState } from '../../store'
import { api } from '../../api'
@@ -143,7 +144,6 @@ onBeforeUnmount(() => {
const handleCreated = (editor) => {
editorRef.value = editor;
- console.log(editor.getAllMenuKeys())
}
onMounted(async () => {
@@ -160,6 +160,7 @@ onMounted(async () => {
{{ t('requestAccess') }}
+
@@ -208,7 +209,6 @@ onMounted(async () => {
-
diff --git a/vitepress-docs/docs/en/cli.md b/vitepress-docs/docs/en/cli.md
index d16c8495..5179ff39 100644
--- a/vitepress-docs/docs/en/cli.md
+++ b/vitepress-docs/docs/en/cli.md
@@ -68,9 +68,13 @@ PREFIX = "tmp" # The mailbox name prefix to be processed
# PASSWORDS = ["123", "456"]
# admin console password, if not configured, access to the console is not allowed
# ADMIN_PASSWORDS = ["123", "456"]
+# admin contact information. If not configured, it will not be displayed. Any string can be configured.
+# ADMIN_CONTACT = "xx@xx.xxx"
DOMAINS = ["xxx.xxx1" , "xxx.xxx2"] # your domain name
JWT_SECRET = "xxx" # Key used to generate jwt
BLACK_LIST = "" # Blacklist, used to filter senders, comma separated
+# default send balance, if not set, it will be 0
+# DEFAULT_SEND_BALANCE = 1
# dkim config
# DKIM_SELECTOR = "mailchannels" # Refer to the DKIM section mailchannels._domainkey for mailchannels
# DKIM_PRIVATE_KEY = "" # Refer to the contents of priv_key.txt in the DKIM section
diff --git a/vitepress-docs/docs/zh/guide/cli/worker.md b/vitepress-docs/docs/zh/guide/cli/worker.md
index 7fc4d0ef..f8721fa9 100644
--- a/vitepress-docs/docs/zh/guide/cli/worker.md
+++ b/vitepress-docs/docs/zh/guide/cli/worker.md
@@ -26,9 +26,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 的密钥
+JWT_SECRET = "xxx" # 用于生成 jwt 的密钥, 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/worker/src/router.js b/worker/src/router.js
index a9da11f7..e08fee94 100644
--- a/worker/src/router.js
+++ b/worker/src/router.js
@@ -146,6 +146,7 @@ api.get('/open_api/settings', async (c) => {
"prefix": c.env.PREFIX,
"domains": getDomains(c),
"needAuth": needAuth,
+ "adminContact": c.env.ADMIN_CONTACT,
});
})
diff --git a/worker/src/send_mail_api.js b/worker/src/send_mail_api.js
index daab884b..3999bbcf 100644
--- a/worker/src/send_mail_api.js
+++ b/worker/src/send_mail_api.js
@@ -8,9 +8,12 @@ api.post('/api/requset_send_mail_access', async (c) => {
return c.text("No address", 400)
}
try {
+ const default_balance = c.env.DEFAULT_SEND_BALANCE || 0;
const { success } = await c.env.DB.prepare(
- `INSERT INTO address_sender (address, balance, enabled) VALUES (?, 1, 1)`
- ).bind(address).run();
+ `INSERT INTO address_sender (address, balance, enabled) VALUES (?, ?, ?)`
+ ).bind(
+ address, default_balance, default_balance > 0 ? 1 : 0
+ ).run();
if (!success) {
return c.text("Failed to request send mail access", 500)
}
diff --git a/worker/src/utils.js b/worker/src/utils.js
index 87e28153..990fbdfd 100644
--- a/worker/src/utils.js
+++ b/worker/src/utils.js
@@ -23,13 +23,14 @@ export const getPasswords = (c) => {
// check if PASSWORDS is an array, if not use json.parse
if (!Array.isArray(c.env.PASSWORDS)) {
try {
- return JSON.parse(c.env.PASSWORDS);
+ let res = JSON.parse(c.env.PASSWORDS);
+ return res.filter((item) => item.length > 0);
} catch (e) {
console.error("Failed to parse PASSWORDS", e);
return [];
}
}
- return c.env.PASSWORDS;
+ return c.env.PASSWORDS.filter((item) => item.length > 0);
}
export const getAdminPasswords = (c) => {
diff --git a/worker/wrangler.toml.template b/worker/wrangler.toml.template
index 194c6bf7..d5cbcbe0 100644
--- a/worker/wrangler.toml.template
+++ b/worker/wrangler.toml.template
@@ -13,9 +13,12 @@ PREFIX = "tmp"
# PASSWORDS = ["123", "456"]
# For admin panel
# ADMIN_PASSWORDS = ["123", "456"]
+# ADMIN CONTACT, CAN BE ANY STRING
+# ADMIN_CONTACT = "xx@xx.xxx"
DOMAINS = ["xxx.xxx1" , "xxx.xxx2"]
JWT_SECRET = "xxx"
BLACK_LIST = ""
+# DEFAULT_SEND_BALANCE = 1 # default send balance, if not set, it will be 0
# dkim config
# DKIM_SELECTOR = ""
# DKIM_PRIVATE_KEY = ""