feat(email encrypt): implement base64 encoding for contact email config

Closes #2438
Closes #3319
This commit is contained in:
anime
2025-04-12 03:22:21 +08:00
parent a01d15d883
commit 9973d6bf73
10 changed files with 78 additions and 91 deletions

View File

@@ -1,5 +1,6 @@
import { siteConfig } from '@/lib/config'
import { useEffect, useRef } from 'react'
import { useRef } from 'react'
import { handleEmailClick } from '@/lib/plugins/mailEncrypt'
/**
* 社交联系方式按钮组
@@ -19,12 +20,7 @@ const SocialButton = () => {
const CONTACT_YOUTUBE = siteConfig('CONTACT_YOUTUBE')
const emailIcon = useRef(null)
useEffect(() => {
if (CONTACT_EMAIL && emailIcon.current) {
emailIcon.current.href =
'mailto:' + decodeURIComponent(escape(atob(CONTACT_EMAIL)))
}
}, [CONTACT_EMAIL])
return (
<div className='space-x-3 text-xl text-gray-600 dark:text-gray-400 flex-wrap flex justify-center '>
{CONTACT_GITHUB && (
@@ -83,11 +79,10 @@ const SocialButton = () => {
)}
{CONTACT_EMAIL && (
<a
ref={emailIcon}
target='_blank'
rel='noreferrer'
title={'email'}
href={CONTACT_EMAIL}>
onClick={e => handleEmailClick(e, emailIcon, CONTACT_EMAIL)}
title='email'
className='cursor-pointer'
ref={emailIcon}>
<i className='fas fa-envelope transform hover:scale-125 duration-150 hover:text-green-600' />
</a>
)}