mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-16 23:16:48 +00:00
feat(email encrypt): implement base64 encoding for contact email config, only supports HEO theme
This commit is contained in:
@@ -157,9 +157,14 @@ export async function getConfigMapFromConfigPage(allPages) {
|
||||
// 只导入生效的配置
|
||||
if (config.enable) {
|
||||
// console.log('[Notion配置]', config.key, config.value)
|
||||
notionConfig[config.key] =
|
||||
parseTextToJson(config.value) || config.value || null
|
||||
// 配置不能是undefined,至少是null
|
||||
if (config.key === 'CONTACT_EMAIL') {
|
||||
notionConfig[config.key] =
|
||||
(config.value && btoa(unescape(encodeURIComponent(config.value)))) || null
|
||||
} else {
|
||||
notionConfig[config.key] =
|
||||
parseTextToJson(config.value) || config.value || null
|
||||
// 配置不能是undefined,至少是null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
12
lib/plugins/mailEncrypt.js
Normal file
12
lib/plugins/mailEncrypt.js
Normal file
@@ -0,0 +1,12 @@
|
||||
export const handleEmailClick = (e, emailIcon, CONTACT_EMAIL) => {
|
||||
if (CONTACT_EMAIL && emailIcon && !emailIcon.current.href) {
|
||||
e.preventDefault()
|
||||
try {
|
||||
const email = decodeURIComponent(escape(atob(CONTACT_EMAIL)))
|
||||
emailIcon.current.href = `mailto:${email}`
|
||||
emailIcon.current.click()
|
||||
} catch (error) {
|
||||
console.error('解密邮箱失败:', error)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user