feat(mailEncrypt): add email encryption/decryption functions

- refactor email handling logic in handleEmailClick
- add new encryptEmail and decryptEmail utility functions
- improve error handling for decryption process
- simplify the email click handler implementation
This commit is contained in:
anime
2025-07-07 17:32:26 +08:00
parent 9973d6bf73
commit bdd109381a
2 changed files with 18 additions and 8 deletions

View File

@@ -10,6 +10,7 @@ import { getDateValue, getTextContent } from 'notion-utils'
import { deepClone } from '../utils'
import getAllPageIds from './getAllPageIds'
import { getPage } from './getPostBlocks'
import { encryptEmail } from '@/lib/plugins/mailEncrypt'
/**
* 从Notion中读取Config配置表
@@ -159,7 +160,7 @@ export async function getConfigMapFromConfigPage(allPages) {
// console.log('[Notion配置]', config.key, config.value)
if (config.key === 'CONTACT_EMAIL') {
notionConfig[config.key] =
(config.value && btoa(unescape(encodeURIComponent(config.value)))) || null
(config.value && encryptEmail(config.value)) || null
} else {
notionConfig[config.key] =
parseTextToJson(config.value) || config.value || null