From 2ff68a9d474fdffa1d4498bf86cade24ad0a3e38 Mon Sep 17 00:00:00 2001 From: sy Date: Sat, 1 Apr 2023 01:11:40 +0800 Subject: [PATCH] fix: missing webmention token and use encodeURIComponent to keep share content format --- blog.config.js | 3 ++- components/WebMention.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/blog.config.js b/blog.config.js index 6dd3701c..9ab2f139 100644 --- a/blog.config.js +++ b/blog.config.js @@ -181,7 +181,8 @@ const BLOG = { ENABLE: process.env.NEXT_PUBLIC_WEBMENTION_ENABLE || false, AUTH: process.env.NEXT_PUBLIC_WEBMENTION_AUTH || '', HOSTNAME: process.env.NEXT_PUBLIC_WEBMENTION_HOSTNAME || '', - TWITTER_USERNAME: process.env.NEXT_PUBLIC_TWITTER_USERNAME || '' + TWITTER_USERNAME: process.env.NEXT_PUBLIC_TWITTER_USERNAME || '', + TOKEN: process.env.NEXT_PUBLIC_WEBMENTION_TOKEN || '' }, // <---- 评论插件 diff --git a/components/WebMention.js b/components/WebMention.js index ef8b54d6..c993fe22 100644 --- a/components/WebMention.js +++ b/components/WebMention.js @@ -80,7 +80,7 @@ const WebmentionReplies = ({ target }) => { const [mentions, setMentions] = useState([]) const fetchMentions = async (target) => fetch( - `https://webmention.io/api/mentions.jf2?per-page=500&target=${target}` + `https://webmention.io/api/mentions.jf2?per-page=500&target=${target}&token=${BLOG.COMMENT_WEBMENTION.TOKEN}` ).then((response) => (response.json ? response.json() : response)) useEffect(() => { async function getMentions() { @@ -153,7 +153,7 @@ const WebMentionBlock = ({ frontMatter }) => { tweet this post{' '} or{' '}