From cd4661a57c9dc9da16d1fd62c878483a49e48996 Mon Sep 17 00:00:00 2001 From: Ghlerrix Date: Wed, 16 Aug 2023 10:32:07 +0800 Subject: [PATCH 01/36] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=99=BE=E5=BA=A6?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E5=92=8C=E6=96=B0=E5=A2=9E=E5=BF=85=E5=BA=94?= =?UTF-8?q?=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflows/{baidupush.yml => pushUrl.yml} | 13 ++-- baidupush.py | 18 ------ baidupush.sh | 12 ---- package.json | 3 +- pushUrl.py | 64 +++++++++++++++++++ 5 files changed, 73 insertions(+), 37 deletions(-) rename .github/workflows/{baidupush.yml => pushUrl.yml} (78%) delete mode 100644 baidupush.py delete mode 100644 baidupush.sh create mode 100644 pushUrl.py diff --git a/.github/workflows/baidupush.yml b/.github/workflows/pushUrl.yml similarity index 78% rename from .github/workflows/baidupush.yml rename to .github/workflows/pushUrl.yml index 2541e38f..e71f7ec2 100644 --- a/.github/workflows/baidupush.yml +++ b/.github/workflows/pushUrl.yml @@ -1,16 +1,16 @@ ## 利用GitHub Actions每天定时给百度推送链接,提高收录率 ## -name: baidupush +name: pushUrl # 两种触发方式:一、push代码,二、每天国际标准时间23点(北京时间+8即早上7点)运行 on: - # push: + push: schedule: - cron: '0 23 * * *' # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#scheduled-events-schedule workflow_dispatch: inputs: unconditional-invoking: - description: 'baidupush unconditionally' + description: 'push url unconditionally' type: boolean required: true default: true @@ -35,5 +35,8 @@ jobs: - name: install requests run: pip install requests - - name: baidupush - run: npm run baidupush \ No newline at end of file + - name: baiduPush + run: python pushUrl.py ${{ secrets.URL }} --baidu_token ${{ secrets.BAIDU_TOKEN }} + + - name: bingPush + run: python pushUrl.py ${{ secrets.URL }} --bing_api_key ${{ secrets.BING_API_KEY }} \ No newline at end of file diff --git a/baidupush.py b/baidupush.py deleted file mode 100644 index 9d0c0130..00000000 --- a/baidupush.py +++ /dev/null @@ -1,18 +0,0 @@ -import re -import ssl -import requests -import argparse - - -if __name__ == '__main__': - ssl._create_default_https_context = ssl._create_unverified_context - parser = argparse.ArgumentParser(description='parse sitemap') - parser.add_argument('url', help='The url of your website') - args = parser.parse_args() - url = f'https://{args.url}/sitemap.xml' - result = requests.get(url) - big = re.findall('(.*?)', result.content.decode('utf-8'), re.S) - for i in big: - # print(i) - op_xml_txt = open('urls.txt', 'a') - op_xml_txt.write('%s\n' % i) diff --git a/baidupush.sh b/baidupush.sh deleted file mode 100644 index 7901c56a..00000000 --- a/baidupush.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env sh - -# 确保脚本抛出遇到的错误 -set -e - -# 解析sitemap.xml, 记得换成你自己的域名,注意检查是否包含‘www’ -python baidupush.py 'www.ghlerrix.cn' - -# 百度链接推送,换成自己的token和域名 -curl -H 'Content-Type:text/plain' --data-binary @urls.txt "http://data.zz.baidu.com/urls?site=https://www.ghlerrix.cn&token=oUldnU4HZvSTlh0e" - -rm -rf urls.txt # 删除文件 \ No newline at end of file diff --git a/package.json b/package.json index 4ef4c221..60da82a0 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,7 @@ "start": "next start", "post-build": "next-sitemap --config next-sitemap.config.js", "export": "next build && next-sitemap --config next-sitemap.config.js && next export", - "bundle-report": "ANALYZE=true yarn build", - "baidupush": "bash baidupush.sh" + "bundle-report": "ANALYZE=true yarn build" }, "dependencies": { "@giscus/react": "^2.2.6", diff --git a/pushUrl.py b/pushUrl.py new file mode 100644 index 00000000..dc6e73bf --- /dev/null +++ b/pushUrl.py @@ -0,0 +1,64 @@ +import re +import ssl +import requests +import argparse + +ssl._create_default_https_context = ssl._create_unverified_context + + +def parse_stiemap(site): + site = f'{site}/sitemap.xml' + result = requests.get(site) + big = re.findall('(.*?)', result.content.decode('utf-8'), re.S) + return list(big) + + +def push_to_bing(site, urls, api_key): + endpoint = f"https://ssl.bing.com/webmaster/api.svc/json/SubmitUrlbatch?apikey={api_key}" + + payload = { + "siteUrl": site, + "urlList": urls + } + + try: + response = requests.post(endpoint, json=payload) + result = response.json() + if response.status_code == 200: + print("successfully submitted to Bing.") + elif "ErrorCode" in result: + print("Error pushing URLs to Bing:", result["Message"]) + except Exception as e: + print("An error occurred:", e) + + +def push_to_baidu(site, urls, token): + api_url = f"http://data.zz.baidu.com/urls?site={site}&token={token}" + + payload = "\n".join(urls) + headers = {"Content-Type": "text/plain"} + + try: + response = requests.post(api_url, data=payload, headers=headers) + result = response.json() + if "success" in result and result["success"]: + print("URLs successfully pushed to Baidu.") + elif "error" in result: + print("Error pushing URLs to Baidu:", result["message"]) + else: + print("Unknown response from Baidu:", result) + except Exception as e: + print("An error occurred:", e) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='parse sitemap') + parser.add_argument('url', type=str, help='The url of your website') + parser.add_argument('--bing_api_key', type=str, default=None, help='your bing api key') + parser.add_argument('--baidu_token', type=str, default=None, help='Your baidu push token') + args = parser.parse_args() + urls = parse_stiemap(args.url) + if args.bing_api_key: + push_to_bing(args.url, urls, args.bing_api_key) + if args.baidu_token: + push_to_baidu(args.url, urls, args.baidu_token) From 669ca7646e4ada94e5f0230ab0cdc3d526d49c1e Mon Sep 17 00:00:00 2001 From: Ghlerrix Date: Thu, 24 Aug 2023 09:46:08 +0800 Subject: [PATCH 02/36] =?UTF-8?q?[fix]=20=E4=BF=AE=E5=A4=8D=E6=9C=AA?= =?UTF-8?q?=E9=85=8D=E7=BD=AEAction=20Secrets=E6=AF=8F=E6=97=A5=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E6=8E=A8=E9=80=81=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当用户未配置Action Secrets中的URL时每日定时推送会报错,github会发送一条邮件,可能会带来一些不便。 修复后,未配置Action Secrets则相关代码就不会执行。 具体如下: 未配置URL:则啥也不干 未配置Bing API KEY:则不推送至Bing 未配置Baidu Token:则不推送至百度 --- .github/workflows/pushUrl.yml | 4 ++-- pushUrl.py | 33 +++++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pushUrl.yml b/.github/workflows/pushUrl.yml index e71f7ec2..f8c2f60d 100644 --- a/.github/workflows/pushUrl.yml +++ b/.github/workflows/pushUrl.yml @@ -36,7 +36,7 @@ jobs: run: pip install requests - name: baiduPush - run: python pushUrl.py ${{ secrets.URL }} --baidu_token ${{ secrets.BAIDU_TOKEN }} + run: python pushUrl.py --url ${{ secrets.URL }} --baidu_token ${{ secrets.BAIDU_TOKEN }} - name: bingPush - run: python pushUrl.py ${{ secrets.URL }} --bing_api_key ${{ secrets.BING_API_KEY }} \ No newline at end of file + run: python pushUrl.py --url ${{ secrets.URL }} --bing_api_key ${{ secrets.BING_API_KEY }} \ No newline at end of file diff --git a/pushUrl.py b/pushUrl.py index dc6e73bf..e25f86c5 100644 --- a/pushUrl.py +++ b/pushUrl.py @@ -8,8 +8,11 @@ ssl._create_default_https_context = ssl._create_unverified_context def parse_stiemap(site): site = f'{site}/sitemap.xml' + print('解析站点地图中,请稍后……') result = requests.get(site) big = re.findall('(.*?)', result.content.decode('utf-8'), re.S) + print('当前已有url:') + print(list(big)) return list(big) @@ -25,9 +28,9 @@ def push_to_bing(site, urls, api_key): response = requests.post(endpoint, json=payload) result = response.json() if response.status_code == 200: - print("successfully submitted to Bing.") + print("成功推送到Bing.") elif "ErrorCode" in result: - print("Error pushing URLs to Bing:", result["Message"]) + print("推送到Bing出现错误,错误信息为:", result["Message"]) except Exception as e: print("An error occurred:", e) @@ -42,9 +45,9 @@ def push_to_baidu(site, urls, token): response = requests.post(api_url, data=payload, headers=headers) result = response.json() if "success" in result and result["success"]: - print("URLs successfully pushed to Baidu.") + print("成功推送到百度.") elif "error" in result: - print("Error pushing URLs to Baidu:", result["message"]) + print("推送到百度出现错误,错误信息为:", result["message"]) else: print("Unknown response from Baidu:", result) except Exception as e: @@ -53,12 +56,22 @@ def push_to_baidu(site, urls, token): if __name__ == '__main__': parser = argparse.ArgumentParser(description='parse sitemap') - parser.add_argument('url', type=str, help='The url of your website') + parser.add_argument('--url', type=str, help='The url of your website') parser.add_argument('--bing_api_key', type=str, default=None, help='your bing api key') parser.add_argument('--baidu_token', type=str, default=None, help='Your baidu push token') args = parser.parse_args() - urls = parse_stiemap(args.url) - if args.bing_api_key: - push_to_bing(args.url, urls, args.bing_api_key) - if args.baidu_token: - push_to_baidu(args.url, urls, args.baidu_token) + if args.url: + urls = parse_stiemap(args.url) + if args.bing_api_key: + push_to_bing(args.url, urls, args.bing_api_key) + else: + print('未配置 Bing API Key') + print('详情参见: https://ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9') + if args.baidu_token: + push_to_baidu(args.url, urls, args.baidu_token) + else: + print('未配置 Baidu Token') + print('详情参见: https://ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9') + else: + print('请前往 Github Action Secrets 配置 URL') + print('详情参见: https://ghlcode.cn/fe032806-5362-4d82-b746-a0b26ce8b9d9') From 9113feb7c365765cb95ef712b9a5694181199fe8 Mon Sep 17 00:00:00 2001 From: Ghlerrix Date: Thu, 24 Aug 2023 10:14:07 +0800 Subject: [PATCH 03/36] =?UTF-8?q?[fix]=20=E4=BF=AE=E5=A4=8D=E6=9C=AA?= =?UTF-8?q?=E9=85=8D=E7=BD=AEAction=20Secrets=E6=AF=8F=E6=97=A5=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E6=8E=A8=E9=80=81=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当用户未配置Action Secrets中的URL时每日定时推送会报错,github会发送一条邮件,可能会带来一些不便。 修复后,未配置Action Secrets则相关代码就不会执行。 具体如下: 未配置URL:则啥也不干 未配置Bing API KEY:则不推送至Bing 未配置Baidu Token:则不推送至百度 --- .github/workflows/pushUrl.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pushUrl.yml b/.github/workflows/pushUrl.yml index f8c2f60d..14a05b90 100644 --- a/.github/workflows/pushUrl.yml +++ b/.github/workflows/pushUrl.yml @@ -32,11 +32,8 @@ jobs: with: python-version: 3.8 - - name: install requests + - name: Install requests run: pip install requests - - name: baiduPush - run: python pushUrl.py --url ${{ secrets.URL }} --baidu_token ${{ secrets.BAIDU_TOKEN }} - - - name: bingPush - run: python pushUrl.py --url ${{ secrets.URL }} --bing_api_key ${{ secrets.BING_API_KEY }} \ No newline at end of file + - name: Push + run: python pushUrl.py --url ${{ secrets.URL }} --baidu_token ${{ secrets.BAIDU_TOKEN }} --bing_api_key ${{ secrets.BING_API_KEY }} \ No newline at end of file From 8aa2e58c36712cc1f2b34d13daa7d4af5b11fd10 Mon Sep 17 00:00:00 2001 From: LooseLi <1329307562@qq.com> Date: Fri, 25 Aug 2023 15:51:51 +0800 Subject: [PATCH 04/36] =?UTF-8?q?style:=20=E4=BC=98=E5=8C=96=E6=96=87?= =?UTF-8?q?=E7=AB=A0=E8=BE=B9=E8=B7=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/next/components/ArticleDetail.js | 4 ++-- themes/next/style.js | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/themes/next/components/ArticleDetail.js b/themes/next/components/ArticleDetail.js index a4f575ec..f26b6691 100644 --- a/themes/next/components/ArticleDetail.js +++ b/themes/next/components/ArticleDetail.js @@ -34,7 +34,7 @@ export default function ArticleDetail(props) { data-aos-duration="300" data-aos-once="true" data-aos-anchor-placement="top-bottom" - className="subpixel-antialiased overflow-y-hidden py-10 px-5 lg:pt-24 md:px-24 dark:border-gray-700 bg-white dark:bg-hexo-black-gray" + className="subpixel-antialiased overflow-y-hidden py-10 px-5 lg:pt-24 md:px-24 dark:border-gray-700 bg-white dark:bg-hexo-black-gray article-padding" > {showArticleInfo &&
@@ -78,7 +78,7 @@ export default function ArticleDetail(props) {
} {/* Notion内容主体 */} -
+
{post && ()}
diff --git a/themes/next/style.js b/themes/next/style.js index d01b13b3..aaf580ad 100644 --- a/themes/next/style.js +++ b/themes/next/style.js @@ -15,6 +15,10 @@ const Style = () => { background-color: black; } + .article-padding { + padding: 40px; + } + `} } From 9a23443375929d4a9c090d2f70d52dcdcbf1c2bd Mon Sep 17 00:00:00 2001 From: LooseLi <1329307562@qq.com> Date: Fri, 25 Aug 2023 16:02:58 +0800 Subject: [PATCH 05/36] =?UTF-8?q?style:=20=E7=BB=9F=E4=B8=80=E5=8F=B3?= =?UTF-8?q?=E4=BE=A7=E5=88=86=E7=B1=BB=E5=92=8C=E6=A0=87=E7=AD=BE=E7=9A=84?= =?UTF-8?q?=E6=9B=B4=E5=A4=9Atag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/next/components/SideAreaRight.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/next/components/SideAreaRight.js b/themes/next/components/SideAreaRight.js index e23759c4..ee694d35 100644 --- a/themes/next/components/SideAreaRight.js +++ b/themes/next/components/SideAreaRight.js @@ -62,7 +62,7 @@ const SideAreaRight = (props) => { passHref className='text-gray-400 hover:text-black dark:text-gray-400 dark:hover:text-white hover:underline cursor-pointer'> - {locale.COMMON.MORE} + {locale.COMMON.MORE} From 718da30c50224cc84d7ec69d62142c490a20378c Mon Sep 17 00:00:00 2001 From: LooseLi <1329307562@qq.com> Date: Fri, 25 Aug 2023 17:11:55 +0800 Subject: [PATCH 06/36] =?UTF-8?q?style:=20=E8=8F=9C=E5=8D=95=E4=B8=8B?= =?UTF-8?q?=E5=88=92=E7=BA=BF=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/next/components/BlogPostCard.js | 12 ++++++------ themes/next/style.js | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/themes/next/components/BlogPostCard.js b/themes/next/components/BlogPostCard.js index 050b33c2..90224ecd 100644 --- a/themes/next/components/BlogPostCard.js +++ b/themes/next/components/BlogPostCard.js @@ -28,10 +28,10 @@ const BlogPostCard = ({ post, showSummary }) => { data-aos-duration="500" data-aos-once="true" data-aos-anchor-placement="top-bottom" - className={`cursor-pointer hover:underline text-3xl ${showPreview ? 'text-center' : '' + className={`cursor-pointer text-3xl ${showPreview ? 'text-center' : '' } leading-tight text-gray-700 dark:text-gray-100 hover:text-blue-500 dark:hover:text-blue-400`}> - {post.title} + {post.title} @@ -48,10 +48,10 @@ const BlogPostCard = ({ post, showSummary }) => { + className="hover:text-blue-500 dark:hover:text-blue-400 cursor-pointer font-light text-sm transform"> - {post.category} + {post.category} | @@ -60,8 +60,8 @@ const BlogPostCard = ({ post, showSummary }) => { - {post.date?.start_date} + className="hover:text-blue-500 dark:hover:text-blue-400 font-light cursor-pointer text-sm leading-4 mr-3"> + {post.date?.start_date} diff --git a/themes/next/style.js b/themes/next/style.js index aaf580ad..daf6af46 100644 --- a/themes/next/style.js +++ b/themes/next/style.js @@ -19,6 +19,20 @@ const Style = () => { padding: 40px; } + // 菜单下划线动画 + #theme-next .menu-link { + text-decoration: none; + background-image: linear-gradient(#4e80ee, #4e80ee); + background-repeat: no-repeat; + background-position: bottom center; + background-size: 0 2px; + transition: background-size 100ms ease-in-out; + } + #theme-next .menu-link:hover { + background-size: 100% 2px; + color: #4e80ee; + } + `} } From 5d6de069f3d1dcd6e38ee5c0d60ea6078ca7d419 Mon Sep 17 00:00:00 2001 From: LooseLi <1329307562@qq.com> Date: Fri, 25 Aug 2023 17:41:31 +0800 Subject: [PATCH 07/36] =?UTF-8?q?fix:=20eslint=E4=B8=8D=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E7=BB=93=E5=B0=BE=E5=88=86=E5=8F=B7=E4=BB=A5=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.js b/.eslintrc.js index bab5ea27..9836da77 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -26,6 +26,7 @@ module.exports = { } }, rules: { + semi: 0, 'react/no-unknown-property': 'off', // + } + `} + ) } export { Style } From 64dbf4dc73efbde63d0f997ca84a1558c6ba6c65 Mon Sep 17 00:00:00 2001 From: real-jacket <1762982273@qq.com> Date: Tue, 5 Sep 2023 00:07:26 +0800 Subject: [PATCH 28/36] fix(heo): fix heo category selected style --- themes/heo/components/CategoryBar.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/themes/heo/components/CategoryBar.js b/themes/heo/components/CategoryBar.js index ee0a7a0c..eccd9685 100644 --- a/themes/heo/components/CategoryBar.js +++ b/themes/heo/components/CategoryBar.js @@ -28,6 +28,7 @@ export default function CategoryBar(props) { setScrollRight(!scrollRight) } } + return
@@ -54,7 +55,8 @@ export default function CategoryBar(props) { */ const MenuItem = ({ href, name }) => { const router = useRouter() - const selected = router.pathname === href + const { category } = router.query + const selected = category === name return
{name}
From 5535ebeca3ea217e3ed3ebf6201d171c3d2322b4 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Thu, 7 Sep 2023 14:15:03 +0800 Subject: [PATCH 29/36] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E5=8F=91=E5=B8=83=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/getNotionData.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js index 20f47be3..4d73bc99 100644 --- a/lib/notion/getNotionData.js +++ b/lib/notion/getNotionData.js @@ -49,8 +49,8 @@ function getLatestPosts({ allPages, from, latestPostCount }) { const allPosts = allPages?.filter(page => page.type === 'Post' && page.status === 'Published') const latestPosts = Object.create(allPosts).sort((a, b) => { - const dateA = new Date(a?.lastEditedDay || a?.publishDate) - const dateB = new Date(b?.lastEditedDay || b?.publishDate) + const dateA = new Date(a?.lastEditedDate || a?.publishDate) + const dateB = new Date(b?.lastEditedDate || b?.publishDate) return dateB - dateA }) return latestPosts.slice(0, latestPostCount) From b5fd54a72ac64cea1556843c5c883bfd8d528ff6 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Thu, 7 Sep 2023 15:54:57 +0800 Subject: [PATCH 30/36] =?UTF-8?q?=E5=B9=BF=E5=91=8A=E4=BD=8D=E9=AB=98?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/WWAds.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/WWAds.js b/components/WWAds.js index f2290a75..87901f39 100644 --- a/components/WWAds.js +++ b/components/WWAds.js @@ -13,6 +13,6 @@ export default function WWAds({ orientation = 'vertical', sticky = false, classN } return ( -
+
) } From 9b29c0d82d3adfc80f74440bbff0934929c7a7b5 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Thu, 7 Sep 2023 16:00:54 +0800 Subject: [PATCH 31/36] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=B0=E7=89=88Notio?= =?UTF-8?q?n=E4=B8=AD=E9=99=84=E4=BB=B6=E6=96=87=E4=BB=B6=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=89=93=E5=BC=80=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/getPostBlocks.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/notion/getPostBlocks.js b/lib/notion/getPostBlocks.js index ca3090dd..be228594 100644 --- a/lib/notion/getPostBlocks.js +++ b/lib/notion/getPostBlocks.js @@ -63,6 +63,7 @@ export async function getPageWithRetry(id, from, retryAttempts = 3) { /** * 获取到的blockMap删除不需要的字段 + * 并且对于页面内容进行特殊处理,比如文件url格式化 * @param {*} id 页面ID * @param {*} pageBlock 页面元素 * @param {*} slice 截取数量 @@ -72,6 +73,7 @@ function filterPostBlocks(id, pageBlock, slice) { const clonePageBlock = deepClone(pageBlock) let count = 0 + // 循环遍历文档的每个block for (const i in clonePageBlock?.block) { const b = clonePageBlock?.block[i] if (slice && slice > 0 && count > slice) { @@ -99,6 +101,13 @@ function filterPostBlocks(id, pageBlock, slice) { } } + // 如果是文件,需要重新加密签名 + if (b?.value?.type === 'file' && b?.value?.properties?.source?.[0][0]) { + const oldUrl = b?.value?.properties?.source?.[0][0] + const newUrl = `https://notion.so/signed/${encodeURIComponent(oldUrl)}?table=block&id=${b?.value?.id}` + b.value.properties.source[0][0] = newUrl + } + delete b?.role delete b?.value?.version delete b?.value?.created_by_table From 66ce9b9411dda05df2f2da2b45d5eac20fe90f37 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Thu, 7 Sep 2023 16:10:48 +0800 Subject: [PATCH 32/36] =?UTF-8?q?PDF=20=E5=B5=8C=E5=85=A5BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/getPostBlocks.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/notion/getPostBlocks.js b/lib/notion/getPostBlocks.js index be228594..a9e3a757 100644 --- a/lib/notion/getPostBlocks.js +++ b/lib/notion/getPostBlocks.js @@ -101,8 +101,8 @@ function filterPostBlocks(id, pageBlock, slice) { } } - // 如果是文件,需要重新加密签名 - if (b?.value?.type === 'file' && b?.value?.properties?.source?.[0][0]) { + // 如果是文件,或嵌入式PDF,需要重新加密签名 + if ((b?.value?.type === 'file' || b?.value?.type === 'pdf') && b?.value?.properties?.source?.[0][0]) { const oldUrl = b?.value?.properties?.source?.[0][0] const newUrl = `https://notion.so/signed/${encodeURIComponent(oldUrl)}?table=block&id=${b?.value?.id}` b.value.properties.source[0][0] = newUrl From 232d2aade518276e2d63e1f954343e976079821d Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Thu, 7 Sep 2023 16:12:43 +0800 Subject: [PATCH 33/36] 4.0.15 --- .env.local | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.local b/.env.local index 98021d01..ad3056e7 100644 --- a/.env.local +++ b/.env.local @@ -1,2 +1,2 @@ # 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables -NEXT_PUBLIC_VERSION=4.0.14 \ No newline at end of file +NEXT_PUBLIC_VERSION=4.0.15 \ No newline at end of file diff --git a/package.json b/package.json index 805747eb..690ff400 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "notion-next", - "version": "4.0.14", + "version": "4.0.15", "homepage": "https://github.com/tangly1024/NotionNext.git", "license": "MIT", "repository": { From 801898d1765da2583b02643c7f2e3e3204d1c083 Mon Sep 17 00:00:00 2001 From: real-jacket <1762982273@qq.com> Date: Thu, 7 Sep 2023 22:00:08 +0800 Subject: [PATCH 34/36] =?UTF-8?q?style(heo):=20=E4=BF=AE=E5=A4=8D=E5=9C=A8?= =?UTF-8?q?=E8=BE=83=E5=B0=8F=E5=B1=8F=E5=B9=95=E5=B0=BA=E5=AF=B8=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=96=87=E7=AB=A0=E5=AE=BD=E5=BA=A6=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/heo/index.js | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/themes/heo/index.js b/themes/heo/index.js index 01f23a27..778fbb48 100644 --- a/themes/heo/index.js +++ b/themes/heo/index.js @@ -1,7 +1,7 @@ import CONFIG from './config' import CommonHead from '@/components/CommonHead' -import { useEffect } from 'react' +import { useEffect, useState } from 'react' import Footer from './components/Footer' import SideRight from './components/SideRight' import NavBar from './components/NavBar' @@ -123,11 +123,13 @@ const LayoutIndex = props => {
{/* 文章分类条 */} - {BLOG.POST_LIST_STYLE === 'page' ? ( + {BLOG.POST_LIST_STYLE === 'page' + ? ( - ) : ( + ) + : ( - )} + )}
) @@ -155,11 +157,13 @@ const LayoutPostList = props => {
{/* 文章分类条 */} - {BLOG.POST_LIST_STYLE === 'page' ? ( + {BLOG.POST_LIST_STYLE === 'page' + ? ( - ) : ( + ) + : ( - )} + )}
) @@ -206,17 +210,21 @@ const LayoutSearch = props => { headerSlot={headerSlot} >
- {!currentSearch ? ( + {!currentSearch + ? ( - ) : ( + ) + : (
- {BLOG.POST_LIST_STYLE === 'page' ? ( + {BLOG.POST_LIST_STYLE === 'page' + ? ( - ) : ( + ) + : ( - )} + )}
- )} + )}
) @@ -272,6 +280,13 @@ const LayoutSlug = props => { const { post, lock, validPassword } = props const { locale } = useGlobal() + const [hasCode, setHasCode] = useState(false) + + useEffect(() => { + const hasCode = document.querySelectorAll('[class^="language-"]').length > 0 + setHasCode(hasCode) + }, []) + // 右侧栏 const slotRight = const headerSlot = ( @@ -298,7 +313,7 @@ const LayoutSlug = props => { showTag={false} slotRight={slotRight} > -
+
{lock && } {!lock && ( From 303045e1073aa5773dc2a965b0d3eecf9487b3b7 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Thu, 14 Sep 2023 11:58:05 +0800 Subject: [PATCH 35/36] =?UTF-8?q?PLOG=20=E4=B8=BB=E9=A2=98=E9=80=82?= =?UTF-8?q?=E9=85=8D=E6=B5=85=E8=89=B2=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/plog/components/BlogPost.js | 4 ++-- themes/plog/components/BottomNav.js | 2 +- themes/plog/index.js | 21 ++------------------- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/themes/plog/components/BlogPost.js b/themes/plog/components/BlogPost.js index 9ea34720..a75fa8d5 100644 --- a/themes/plog/components/BlogPost.js +++ b/themes/plog/components/BlogPost.js @@ -36,10 +36,10 @@ const BlogPost = (props) => { -

+

{post?.title}

- {post?.category &&
+ {post?.category &&
{post?.category} diff --git a/themes/plog/components/BottomNav.js b/themes/plog/components/BottomNav.js index 91efb30d..7af88fba 100644 --- a/themes/plog/components/BottomNav.js +++ b/themes/plog/components/BottomNav.js @@ -13,7 +13,7 @@ import LogoBar from './LogoBar' */ const BottomNav = props => { return <> -