diff --git a/app/composables/useGlobalConfig.ts b/app/composables/useGlobalConfig.ts index 9aa8436..c3e03a1 100644 --- a/app/composables/useGlobalConfig.ts +++ b/app/composables/useGlobalConfig.ts @@ -3,6 +3,13 @@ import { request, unwrapApiBody, type ApiResponse } from '../utils/http/factory' export type GlobalConfig = { siteName: string allowRegister: boolean + commentEmailNotifyEnabled: boolean + commentMailFromEmail: string + commentSmtpHost: string + commentSmtpPort: number + commentSmtpSecure: boolean + commentSmtpUser: string + commentSmtpPass: string } type GlobalConfigResult = { @@ -12,6 +19,13 @@ type GlobalConfigResult = { const DEFAULT_GLOBAL_CONFIG: GlobalConfig = { siteName: 'Person Panel', allowRegister: true, + commentEmailNotifyEnabled: false, + commentMailFromEmail: '', + commentSmtpHost: '', + commentSmtpPort: 465, + commentSmtpSecure: true, + commentSmtpUser: '', + commentSmtpPass: '', } export function useGlobalConfig() { diff --git a/app/pages/me/admin/config/index.vue b/app/pages/me/admin/config/index.vue index e1e48ba..46efdcd 100644 --- a/app/pages/me/admin/config/index.vue +++ b/app/pages/me/admin/config/index.vue @@ -9,6 +9,13 @@ type GlobalConfigPayload = { allowRegister: boolean mediaOrphanAutoSweepEnabled: boolean mediaOrphanAutoSweepIntervalMinutes: number + commentEmailNotifyEnabled: boolean + commentMailFromEmail: string + commentSmtpHost: string + commentSmtpPort: number + commentSmtpSecure: boolean + commentSmtpUser: string + commentSmtpPass: string } } @@ -23,6 +30,13 @@ const siteName = ref('') const allowRegister = ref(true) const mediaOrphanAutoSweepEnabled = ref(false) const mediaOrphanAutoSweepIntervalMinutes = ref(60) +const commentEmailNotifyEnabled = ref(false) +const commentMailFromEmail = ref('') +const commentSmtpHost = ref('') +const commentSmtpPort = ref(465) +const commentSmtpSecure = ref(true) +const commentSmtpUser = ref('') +const commentSmtpPass = ref('') async function ensureAdmin() { await refresh(true) @@ -39,6 +53,13 @@ async function load() { allowRegister.value = cfg.allowRegister mediaOrphanAutoSweepEnabled.value = cfg.mediaOrphanAutoSweepEnabled mediaOrphanAutoSweepIntervalMinutes.value = cfg.mediaOrphanAutoSweepIntervalMinutes + commentEmailNotifyEnabled.value = cfg.commentEmailNotifyEnabled + commentMailFromEmail.value = cfg.commentMailFromEmail + commentSmtpHost.value = cfg.commentSmtpHost + commentSmtpPort.value = cfg.commentSmtpPort + commentSmtpSecure.value = cfg.commentSmtpSecure + commentSmtpUser.value = cfg.commentSmtpUser + commentSmtpPass.value = cfg.commentSmtpPass } finally { loading.value = false } @@ -63,6 +84,13 @@ async function save() { await putKey('allowRegister', allowRegister.value) await putKey('mediaOrphanAutoSweepEnabled', mediaOrphanAutoSweepEnabled.value) await putKey('mediaOrphanAutoSweepIntervalMinutes', mediaOrphanAutoSweepIntervalMinutes.value) + await putKey('commentEmailNotifyEnabled', commentEmailNotifyEnabled.value) + await putKey('commentMailFromEmail', commentMailFromEmail.value.trim()) + await putKey('commentSmtpHost', commentSmtpHost.value.trim()) + await putKey('commentSmtpPort', commentSmtpPort.value) + await putKey('commentSmtpSecure', commentSmtpSecure.value) + await putKey('commentSmtpUser', commentSmtpUser.value.trim()) + await putKey('commentSmtpPass', commentSmtpPass.value.trim()) await load() await refreshGlobalConfig() toast.add({ title: '配置已保存', color: 'success' }) @@ -78,7 +106,7 @@ async function save() { 应用配置

- 全局设置:站点名称、开放注册与媒体孤儿自动清扫。 + 全局设置:站点名称、开放注册、媒体孤儿自动清扫与评论通知邮件。

@@ -121,5 +149,67 @@ async function save() { + + + +
+ 加载中… +
+
+ + + + + + + + + + + + + + + + + + + + + + + 保存 + +
+