From f489c60a47d9f49a889b28eaedf3c9cb32a39b86 Mon Sep 17 00:00:00 2001 From: sy Date: Tue, 21 Mar 2023 15:40:30 +0800 Subject: [PATCH 01/14] feat: works on webmention comment system --- blog.config.js | 6 ++++++ components/CommonHead.js | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/blog.config.js b/blog.config.js index f3ed4d7c..f275e85a 100644 --- a/blog.config.js +++ b/blog.config.js @@ -177,6 +177,12 @@ const BLOG = { COMMENT_WALINE_SERVER_URL: process.env.NEXT_PUBLIC_WALINE_SERVER_URL || '', // 请配置完整的Waline评论地址 例如 hhttps://preview-waline.tangly1024.com @see https://waline.js.org/guide/get-started.html COMMENT_WALINE_RECENT: process.env.NEXT_PUBLIC_WALINE_RECENT || false, // 最新评论 + COMMENT_WEBMENTION: { + ENABLE: process.env.WEBMENTION_ENABLE || true, + AUTH: process.env.WEBMENTION_AUTH || 'https://github.com/siygle', + HOSTNAME: process.env.WEBMENTION_HOSTNAME || '0a64-111-254-47-199.jp.ngrok.io' + }, + // <---- 评论插件 // ----> 站点统计 diff --git a/components/CommonHead.js b/components/CommonHead.js index 0f4e0555..8104ea80 100644 --- a/components/CommonHead.js +++ b/components/CommonHead.js @@ -44,6 +44,16 @@ const CommonHead = ({ meta, children }) => { + {BLOG.COMMENT_WEBMENTION.ENABLE && ( + <> + + + + )} + {BLOG.COMMENT_WEBMENTION.ENABLE && BLOG.COMMENT_WEBMENTION.AUTH !== '' && ( + + )} + {JSON.parse(BLOG.ANALYTICS_BUSUANZI_ENABLE) && } {meta?.type === 'Post' && ( <> From a7a6efe1fbc242af6bc632d3a96ea7cbd5b703e7 Mon Sep 17 00:00:00 2001 From: sy Date: Tue, 21 Mar 2023 15:50:35 +0800 Subject: [PATCH 02/14] fix: cleanup --- blog.config.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blog.config.js b/blog.config.js index f275e85a..7befd15f 100644 --- a/blog.config.js +++ b/blog.config.js @@ -178,9 +178,9 @@ const BLOG = { COMMENT_WALINE_RECENT: process.env.NEXT_PUBLIC_WALINE_RECENT || false, // 最新评论 COMMENT_WEBMENTION: { - ENABLE: process.env.WEBMENTION_ENABLE || true, - AUTH: process.env.WEBMENTION_AUTH || 'https://github.com/siygle', - HOSTNAME: process.env.WEBMENTION_HOSTNAME || '0a64-111-254-47-199.jp.ngrok.io' + ENABLE: (process.env.WEBMENTION_ENABLE === 'yes'), + AUTH: process.env.WEBMENTION_AUTH || '', + HOSTNAME: process.env.WEBMENTION_HOSTNAME || '' }, // <---- 评论插件 From fd3b026154c69cfa75cf80e51a32f5c83817a9f5 Mon Sep 17 00:00:00 2001 From: sy Date: Fri, 31 Mar 2023 19:31:14 +0800 Subject: [PATCH 03/14] wip: implment webmention display block --- .env.local | 4 + blog.config.js | 6 +- components/Comment.js | 10 +++ components/CommonHead.js | 1 + components/WebMention.js | 168 +++++++++++++++++++++++++++++++++++++++ styles/globals.css | 69 ++++++++++++++++ 6 files changed, 255 insertions(+), 3 deletions(-) create mode 100644 components/WebMention.js diff --git a/.env.local b/.env.local index 5c68a5c9..5eb0e3a1 100644 --- a/.env.local +++ b/.env.local @@ -1,2 +1,6 @@ # 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables NEXT_PUBLIC_VERSION=3.12.4 +NEXT_PUBLIC_THEME=nobelium +NEXT_PUBLIC_WEBMENTION_ENABLE=yes +NEXT_PUBLIC_WEBMENTION_AUTH=https://github.com/siygle +NEXT_PUBLIC_WEBMENTION_HOSTNAME=chat.sylee.dev \ No newline at end of file diff --git a/blog.config.js b/blog.config.js index 7befd15f..16b043b2 100644 --- a/blog.config.js +++ b/blog.config.js @@ -178,9 +178,9 @@ const BLOG = { COMMENT_WALINE_RECENT: process.env.NEXT_PUBLIC_WALINE_RECENT || false, // 最新评论 COMMENT_WEBMENTION: { - ENABLE: (process.env.WEBMENTION_ENABLE === 'yes'), - AUTH: process.env.WEBMENTION_AUTH || '', - HOSTNAME: process.env.WEBMENTION_HOSTNAME || '' + ENABLE: process.env.NEXT_PUBLIC_WEBMENTION_ENABLE || false, + AUTH: process.env.NEXT_PUBLIC_WEBMENTION_AUTH || '', + HOSTNAME: process.env.NEXT_PUBLIC_WEBMENTION_HOSTNAME || '' }, // <---- 评论插件 diff --git a/components/Comment.js b/components/Comment.js index 570d122d..d624e468 100644 --- a/components/Comment.js +++ b/components/Comment.js @@ -43,6 +43,12 @@ const GiscusComponent = dynamic( }, { ssr: false } ) +const WebMentionComponent = dynamic( + () => { + return import('@/components/WebMention') + }, + { ssr: false } +) const ValineComponent = dynamic(() => import('@/components/ValineComponent'), { ssr: false @@ -100,6 +106,10 @@ const Comment = ({ frontMatter }) => { {BLOG.COMMENT_GITALK_CLIENT_ID && (
)} + + {BLOG.COMMENT_WEBMENTION.ENABLE === 'yes' && (
+ +
)} ) diff --git a/components/CommonHead.js b/components/CommonHead.js index 8104ea80..e4ed9a50 100644 --- a/components/CommonHead.js +++ b/components/CommonHead.js @@ -44,6 +44,7 @@ const CommonHead = ({ meta, children }) => { + {console.log(BLOG)} {BLOG.COMMENT_WEBMENTION.ENABLE && ( <> diff --git a/components/WebMention.js b/components/WebMention.js new file mode 100644 index 00000000..a22a6e60 --- /dev/null +++ b/components/WebMention.js @@ -0,0 +1,168 @@ +import BLOG from '@/blog.config' +import { useEffect, useState } from 'react' +import { useRouter } from 'next/router' + +/** + * 评论插件 + * @param issueTerm + * @param layout + * @returns {JSX.Element} + * @constructor + */ +const WebmentionCount = ({ target }) => { + const initialCounts = { + count: 0, + type: { + like: 0, + mention: 0, + reply: 0, + repost: 0 + } + } + const [counts, setCounts] = useState(initialCounts) + const fetchCounts = async (target) => { + const responseData = await fetch(`https://webmention.io/api/count.json?target=${target}`) + console.log('!!!', responseData) + return (responseData.json) ? await responseData.json() : responseData + } + useEffect(() => { + async function getCounts() { + const responseCounts = await fetchCounts(target) + console.log('rere', responseCounts) + setCounts(responseCounts) + } + getCounts() + }, [target]) + + return ( +
+ {counts + ? ( +
+ + {counts.type.like || 0}Likes + + + {counts.type.reply || 0}Replies + + + + {(counts.type.repost || 0) + (counts.type.mention || 0)} + + Mentions + +
+ ) + : ( +

Failed to fetch Webmention counts

+ ) + } +
+ ) +} + +const Avatar = ({ author }) => ( + + {author.name} + +) + +const WebmentionReplies = ({ target }) => { + const [mentions, setMentions] = useState([]) + const fetchMentions = async (target) => + fetch( + `https://webmention.io/api/mentions.jf2?per-page=500&target=${target}` + ).then((response) => (response.json ? response.json() : response)) + useEffect(() => { + async function getMentions() { + const responseMentions = await fetchMentions(target) + if (responseMentions.children) { + setMentions(responseMentions.children) + } + } + + getMentions() + }, [target]) + + const distinctMentions = [ + ...new Map(mentions.map((item) => [item.author.url, item])).values() + ].sort((a, b) => new Date(a['wm-received']) - new Date(b['wm-received'])) + + const replies = distinctMentions.filter( + (mention) => 'in-reply-to' in mention && 'content' in mention + ) + + return ( +
+

+ {distinctMentions.length > 0 + ? `Already ${distinctMentions.length} people liked, shared or talked about this article:` + : 'Be the first one to share this article!'} +

+
+ {distinctMentions.map((reply) => ( + + ))} +
+ {replies && replies.length + ? ( +
+

Replies

+
    + {replies.map((reply) => ( +
  • +
    + +
    +
    +

    {reply.author.name}

    +

    {reply.content.text}

    +
    +
  • + ))} +
+
+ ) + : null} +
+ ) +} + +const WebMentionBlock = ({ frontMatter }) => { + const router = useRouter() + const url = `https://${BLOG.COMMENT_WEBMENTION.HOSTNAME}/${router.asPath}` + const tweet = `${frontMatter.title} by @siygle ${url}` + + return ( +
+
+ This post is using{' '} + + WebMention.io + {' '} + as the comment system.{' '} + Tweet this post + , the comments will show up here. +
+
+ + +
+
+ ) +} + +export default WebMentionBlock diff --git a/styles/globals.css b/styles/globals.css index 569fbfc6..73e733f6 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -222,4 +222,73 @@ nav { /* twikoo 评论区超链接样式 */ .tk-main a { @apply text-blue-700 +} + +/* Webmention style */ +.post-footer { + background: rgba(0, 116, 222, .2); + padding: 1rem 2rem; + border-radius: 5px; +} + +.webmention { + margin-top: 1rem; + padding-top: 1rem; + border-top: 1px solid rgba(0, 0, 0, 0.2); +} + +.webmention-counts .count { + font-weight: bold; + margin-right: .2rem; +} + +/* .webmention-counts .counts > span { + margin-right: .8rem; +} */ +.webmention-counts .counts>span:not(:last-child):after { + content: " • "; +} + +a.avatar-wrapper { + display: inline-block; + width: 50px; + height: 50px; + position: relative; +} + +.webmention-avatars .avatar-wrapper { + margin-right: -8px; +} + +.avatar { + border-radius: 50%; + margin: 0; + border: 3px solid rgba(0, 116, 222, .5); +} + +.replies { + margin: 0; + padding: 0; +} + +.reply { + list-style: none; + display: flex; + position: relative; + padding: 0; + align-items: flex-start; + margin-top: .6rem; +} + +.reply p { + margin: 0; +} + +.reply .text { + margin-left: 1rem; + font-size: 14px; +} + +.reply-author-name { + font-weight: 500; } \ No newline at end of file From 80b39b4945c8ba5de1d53a9ce079aac46c5b6816 Mon Sep 17 00:00:00 2001 From: sy Date: Fri, 31 Mar 2023 20:52:36 +0800 Subject: [PATCH 04/14] fix: missing component Image and modify block css style --- components/WebMention.js | 8 ++++++-- styles/globals.css | 9 ++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/components/WebMention.js b/components/WebMention.js index a22a6e60..ceee4173 100644 --- a/components/WebMention.js +++ b/components/WebMention.js @@ -1,6 +1,7 @@ import BLOG from '@/blog.config' import { useEffect, useState } from 'react' import { useRouter } from 'next/router' +import Image from 'next/image' /** * 评论插件 @@ -142,8 +143,11 @@ const WebMentionBlock = ({ frontMatter }) => { const tweet = `${frontMatter.title} by @siygle ${url}` return ( -
-
+
+

+ powered by WebMention +

+
This post is using{' '} WebMention.io diff --git a/styles/globals.css b/styles/globals.css index 73e733f6..41a35f37 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -225,12 +225,19 @@ nav { } /* Webmention style */ -.post-footer { +.webmention-block { background: rgba(0, 116, 222, .2); padding: 1rem 2rem; border-radius: 5px; } +.webmention-header { + font-style: italic; + font-weight: 700; + font-size: 16px; + margin-bottom: .5rem; +} + .webmention { margin-top: 1rem; padding-top: 1rem; From 05c4f95f9c5c8b0828ff2662223312b9d9c57cfe Mon Sep 17 00:00:00 2001 From: sy Date: Fri, 31 Mar 2023 23:50:48 +0800 Subject: [PATCH 05/14] chore: modify webmention display block css style --- blog.config.js | 3 ++- components/WebMention.js | 22 +++++++++++++--------- styles/globals.css | 5 +++++ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/blog.config.js b/blog.config.js index 16b043b2..6dd3701c 100644 --- a/blog.config.js +++ b/blog.config.js @@ -180,7 +180,8 @@ const BLOG = { COMMENT_WEBMENTION: { ENABLE: process.env.NEXT_PUBLIC_WEBMENTION_ENABLE || false, AUTH: process.env.NEXT_PUBLIC_WEBMENTION_AUTH || '', - HOSTNAME: process.env.NEXT_PUBLIC_WEBMENTION_HOSTNAME || '' + HOSTNAME: process.env.NEXT_PUBLIC_WEBMENTION_HOSTNAME || '', + TWITTER_USERNAME: process.env.NEXT_PUBLIC_TWITTER_USERNAME || '' }, // <---- 评论插件 diff --git a/components/WebMention.js b/components/WebMention.js index ceee4173..ef8b54d6 100644 --- a/components/WebMention.js +++ b/components/WebMention.js @@ -139,26 +139,30 @@ const WebmentionReplies = ({ target }) => { const WebMentionBlock = ({ frontMatter }) => { const router = useRouter() - const url = `https://${BLOG.COMMENT_WEBMENTION.HOSTNAME}/${router.asPath}` - const tweet = `${frontMatter.title} by @siygle ${url}` + const url = `https://${BLOG.COMMENT_WEBMENTION.HOSTNAME}${router.asPath}` + const tweet = `${frontMatter.title} by @${BLOG.COMMENT_WEBMENTION.TWITTER_USERNAME} ${url}` + console.log('ini', url, tweet, router.asPath) return (

- powered by WebMention + powered by WebMention.io

- This post is using{' '} - - WebMention.io - {' '} - as the comment system.{' '} + You can{' '} Tweet this post + >tweet this post{' '} + or{' '} + discuss it on Twitter , the comments will show up here.
diff --git a/styles/globals.css b/styles/globals.css index 41a35f37..e17e9452 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -238,6 +238,11 @@ nav { margin-bottom: .5rem; } +.webmention-block-intro a { + color: #0000EE; + text-decoration: underline; +} + .webmention { margin-top: 1rem; padding-top: 1rem; From 6f85b4d7ce3aaed9883bd9d0e7fa192d7bd821ff Mon Sep 17 00:00:00 2001 From: sy Date: Sat, 1 Apr 2023 00:10:15 +0800 Subject: [PATCH 06/14] fix: wrong env for webmention controller --- components/Comment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Comment.js b/components/Comment.js index d624e468..e1b1f6bb 100644 --- a/components/Comment.js +++ b/components/Comment.js @@ -107,7 +107,7 @@ const Comment = ({ frontMatter }) => {
)} - {BLOG.COMMENT_WEBMENTION.ENABLE === 'yes' && (
+ {BLOG.COMMENT_WEBMENTION.ENABLE && (
)} From 2ff68a9d474fdffa1d4498bf86cade24ad0a3e38 Mon Sep 17 00:00:00 2001 From: sy Date: Sat, 1 Apr 2023 01:11:40 +0800 Subject: [PATCH 07/14] 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{' '} From 929e0c8c36c56a0f8028b4f7e1d4f9a97f50bb1a Mon Sep 17 00:00:00 2001 From: sy Date: Sat, 1 Apr 2023 01:50:45 +0800 Subject: [PATCH 08/14] fix: encodeURIComponent webmention API target --- components/WebMention.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/WebMention.js b/components/WebMention.js index c993fe22..62896ce1 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}&token=${BLOG.COMMENT_WEBMENTION.TOKEN}` + `https://webmention.io/api/mentions.jf2?per-page=500&target=${encodeURIComponent(target)}&token=${BLOG.COMMENT_WEBMENTION.TOKEN}` ).then((response) => (response.json ? response.json() : response)) useEffect(() => { async function getMentions() { From a0eba116966e0ac84bdb86169a1e99e79d768cf3 Mon Sep 17 00:00:00 2001 From: sy Date: Sat, 1 Apr 2023 02:22:15 +0800 Subject: [PATCH 09/14] fix: wrong class-name --- components/WebMention.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/WebMention.js b/components/WebMention.js index 62896ce1..ed81691e 100644 --- a/components/WebMention.js +++ b/components/WebMention.js @@ -63,7 +63,7 @@ const WebmentionCount = ({ target }) => { } const Avatar = ({ author }) => ( - + Date: Sat, 1 Apr 2023 02:43:52 +0800 Subject: [PATCH 10/14] chore: cleanup dev message --- components/WebMention.js | 5 ++--- styles/globals.css | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/components/WebMention.js b/components/WebMention.js index ed81691e..48f0f5a7 100644 --- a/components/WebMention.js +++ b/components/WebMention.js @@ -22,14 +22,13 @@ const WebmentionCount = ({ target }) => { } const [counts, setCounts] = useState(initialCounts) const fetchCounts = async (target) => { - const responseData = await fetch(`https://webmention.io/api/count.json?target=${target}`) - console.log('!!!', responseData) + const responseData = await fetch(`https://webmention.io/api/count.json?target=${encodeURIComponent(target)}`) return (responseData.json) ? await responseData.json() : responseData } useEffect(() => { async function getCounts() { const responseCounts = await fetchCounts(target) - console.log('rere', responseCounts) + console.log(responseCounts) setCounts(responseCounts) } getCounts() diff --git a/styles/globals.css b/styles/globals.css index e17e9452..6aead9ed 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -249,6 +249,11 @@ nav { border-top: 1px solid rgba(0, 0, 0, 0.2); } +.webmention-counts { + padding: 16px 0; + font-weight: bold; +} + .webmention-counts .count { font-weight: bold; margin-right: .2rem; From 1e307bdfee3d38a1045b31fbfc227d4968d6f4a0 Mon Sep 17 00:00:00 2001 From: sy Date: Sat, 1 Apr 2023 13:15:34 +0800 Subject: [PATCH 11/14] chore: add image setting to next config and update webmention description in blog config file --- blog.config.js | 7 +++++++ next.config.js | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/blog.config.js b/blog.config.js index 9ab2f139..ad68ee11 100644 --- a/blog.config.js +++ b/blog.config.js @@ -177,6 +177,13 @@ const BLOG = { COMMENT_WALINE_SERVER_URL: process.env.NEXT_PUBLIC_WALINE_SERVER_URL || '', // 请配置完整的Waline评论地址 例如 hhttps://preview-waline.tangly1024.com @see https://waline.js.org/guide/get-started.html COMMENT_WALINE_RECENT: process.env.NEXT_PUBLIC_WALINE_RECENT || false, // 最新评论 + // 此评论系统基于WebMention,细节可参考https://webmention.io + // 它是一个基于IndieWeb理念的开放式评论系统,下方COMMENT_WEBMENTION包含的属性皆需配置: + // ENABLE: 是否开启 + // AUTH: Webmention使用的IndieLogin,可使用Twitter或Github个人页面连结 + // HOSTNAME: Webmention绑定之网域,通常即为本站网址 + // TWITTER_USERNAME: 评论显示区域需要的资讯 + // TOKEN: Webmention的API token COMMENT_WEBMENTION: { ENABLE: process.env.NEXT_PUBLIC_WEBMENTION_ENABLE || false, AUTH: process.env.NEXT_PUBLIC_WEBMENTION_AUTH || '', diff --git a/next.config.js b/next.config.js index 65fde6e7..c789c2d0 100644 --- a/next.config.js +++ b/next.config.js @@ -13,7 +13,8 @@ module.exports = withBundleAnalyzer({ 'avatars.githubusercontent.com', 'images.unsplash.com', 'source.unsplash.com', - 'p1.qhimg.com' + 'p1.qhimg.com', + 'webmention.io' ] }, // 默认将feed重定向至 /public/rss/feed.xml From d2a9be2f2da8eb420f551dfc2154262a2a82385e Mon Sep 17 00:00:00 2001 From: sy Date: Sat, 1 Apr 2023 14:23:01 +0800 Subject: [PATCH 12/14] chore: revert content of env.local --- .env.local | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.env.local b/.env.local index 5eb0e3a1..58cdf5d1 100644 --- a/.env.local +++ b/.env.local @@ -1,6 +1,2 @@ # 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables -NEXT_PUBLIC_VERSION=3.12.4 -NEXT_PUBLIC_THEME=nobelium -NEXT_PUBLIC_WEBMENTION_ENABLE=yes -NEXT_PUBLIC_WEBMENTION_AUTH=https://github.com/siygle -NEXT_PUBLIC_WEBMENTION_HOSTNAME=chat.sylee.dev \ No newline at end of file +NEXT_PUBLIC_VERSION=3.13.2 \ No newline at end of file From 3b18b8712256d27674437fb724ac49f284191824 Mon Sep 17 00:00:00 2001 From: sy Date: Sat, 1 Apr 2023 14:26:12 +0800 Subject: [PATCH 13/14] chore: cleanup --- components/CommonHead.js | 1 - components/WebMention.js | 2 -- 2 files changed, 3 deletions(-) diff --git a/components/CommonHead.js b/components/CommonHead.js index e4ed9a50..8104ea80 100644 --- a/components/CommonHead.js +++ b/components/CommonHead.js @@ -44,7 +44,6 @@ const CommonHead = ({ meta, children }) => { - {console.log(BLOG)} {BLOG.COMMENT_WEBMENTION.ENABLE && ( <> diff --git a/components/WebMention.js b/components/WebMention.js index 48f0f5a7..1a3db184 100644 --- a/components/WebMention.js +++ b/components/WebMention.js @@ -28,7 +28,6 @@ const WebmentionCount = ({ target }) => { useEffect(() => { async function getCounts() { const responseCounts = await fetchCounts(target) - console.log(responseCounts) setCounts(responseCounts) } getCounts() @@ -140,7 +139,6 @@ const WebMentionBlock = ({ frontMatter }) => { const router = useRouter() const url = `https://${BLOG.COMMENT_WEBMENTION.HOSTNAME}${router.asPath}` const tweet = `${frontMatter.title} by @${BLOG.COMMENT_WEBMENTION.TWITTER_USERNAME} ${url}` - console.log('ini', url, tweet, router.asPath) return (
From 67cbfb9ed5ec8f199f0ff305af017d4437c01b71 Mon Sep 17 00:00:00 2001 From: sy Date: Sun, 2 Apr 2023 00:23:30 +0800 Subject: [PATCH 14/14] fix: not show comment correct if user liked the post at the same time --- components/WebMention.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/WebMention.js b/components/WebMention.js index 1a3db184..375a0141 100644 --- a/components/WebMention.js +++ b/components/WebMention.js @@ -95,7 +95,7 @@ const WebmentionReplies = ({ target }) => { ...new Map(mentions.map((item) => [item.author.url, item])).values() ].sort((a, b) => new Date(a['wm-received']) - new Date(b['wm-received'])) - const replies = distinctMentions.filter( + const replies = mentions.filter( (mention) => 'in-reply-to' in mention && 'content' in mention )