fix: missing webmention token and use encodeURIComponent to keep share content format

This commit is contained in:
sy
2023-04-01 01:11:40 +08:00
parent 6f85b4d7ce
commit 2ff68a9d47
2 changed files with 4 additions and 3 deletions

View File

@@ -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 || ''
},
// <---- 评论插件

View File

@@ -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 }) => {
<a
target="_blank"
id='tweet-post-url'
href={`https://twitter.com/intent/tweet?text=${encodeURI(tweet)}`}
href={`https://twitter.com/intent/tweet?text=${encodeURIComponent(tweet)}`}
rel="noopener noreferrer"
>tweet this post</a>{' '}
or{' '}