From 444e236ca6f0faf1de28ab980cba59c93511270f Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Sun, 10 Mar 2024 13:08:18 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=95=B4=E7=90=86lib=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Busuanzi.js | 2 +- components/Gtag.js | 2 +- components/NotionPage.js | 2 +- .../getNotionData.js => db/getSiteData.js} | 19 +++++++++++-------- lib/lang.js | 2 +- lib/memorize.js | 0 lib/notion.js | 2 -- lib/notion/getAllPosts.js | 2 +- lib/notion/getNotion.js | 2 +- lib/notion/getPageProperties.js | 2 +- lib/{ => plugins}/algolia.js | 0 lib/{ => plugins}/busuanzi.js | 0 lib/{ => plugins}/gtag.js | 0 lib/{ => plugins}/mailchimp.js | 0 lib/{ => plugins}/mhchem.js | 0 lib/{ => plugins}/wow.js | 2 +- lib/rss.js | 2 +- lib/{ => utils}/formatDate.js | 0 lib/{utils.js => utils/index.js} | 0 pages/404.js | 2 +- pages/[prefix]/[slug]/[...suffix].js | 5 ++--- pages/[prefix]/[slug]/index.js | 5 ++--- pages/[prefix]/index.js | 5 ++--- pages/api/subscribe.js | 2 +- pages/archive/index.js | 4 ++-- pages/category/[category]/index.js | 2 +- pages/category/[category]/page/[page].js | 2 +- pages/category/index.js | 2 +- pages/index.js | 3 +-- pages/page/[page].js | 3 +-- pages/search/[keyword]/index.js | 2 +- pages/search/[keyword]/page/[page].js | 2 +- pages/search/index.js | 2 +- pages/signin.js | 2 +- pages/signup.js | 2 +- pages/sitemap.xml.js | 2 +- pages/tag/[tag]/index.js | 2 +- pages/tag/[tag]/page/[page].js | 2 +- pages/tag/index.js | 2 +- themes/example/components/ArticleInfo.js | 2 +- themes/fukasawa/components/ArticleDetail.js | 2 +- themes/fukasawa/components/MailChimpForm.js | 2 +- themes/heo/components/PostHeader.js | 2 +- themes/heo/index.js | 2 +- themes/hexo/components/BlogPostCardInfo.js | 2 +- themes/hexo/components/PostHeader.js | 2 +- themes/landing/components/Footer.js | 2 +- themes/landing/components/Newsletter.js | 2 +- themes/matery/components/ArticleInfo.js | 2 +- themes/matery/components/BlogPostCard.js | 2 +- themes/next/components/ArticleDetail.js | 2 +- themes/next/components/BlogPostCard.js | 2 +- themes/simple/components/ArticleInfo.js | 2 +- themes/simple/components/BlogItem.js | 2 +- themes/starter/index.js | 2 +- 55 files changed, 60 insertions(+), 64 deletions(-) rename lib/{notion/getNotionData.js => db/getSiteData.js} (95%) delete mode 100644 lib/memorize.js delete mode 100644 lib/notion.js rename lib/{ => plugins}/algolia.js (100%) rename lib/{ => plugins}/busuanzi.js (100%) rename lib/{ => plugins}/gtag.js (100%) rename lib/{ => plugins}/mailchimp.js (100%) rename lib/{ => plugins}/mhchem.js (100%) rename lib/{ => plugins}/wow.js (89%) rename lib/{ => utils}/formatDate.js (100%) rename lib/{utils.js => utils/index.js} (100%) diff --git a/components/Busuanzi.js b/components/Busuanzi.js index cbeb54da..ebdab36f 100644 --- a/components/Busuanzi.js +++ b/components/Busuanzi.js @@ -1,4 +1,4 @@ -import busuanzi from '@/lib/busuanzi' +import busuanzi from '@/lib/plugins/busuanzi' import { useRouter } from 'next/router' import { useGlobal } from '@/lib/global' // import { useRouter } from 'next/router' diff --git a/components/Gtag.js b/components/Gtag.js index 0314b55f..445b6e1e 100644 --- a/components/Gtag.js +++ b/components/Gtag.js @@ -1,6 +1,6 @@ import { useEffect } from 'react' import { useRouter } from 'next/router' -import * as gtag from '@/lib/gtag' +import * as gtag from '@/lib/plugins/gtag' const Gtag = () => { const router = useRouter() diff --git a/components/NotionPage.js b/components/NotionPage.js index b3be2174..0a3c44d5 100644 --- a/components/NotionPage.js +++ b/components/NotionPage.js @@ -17,7 +17,7 @@ const Code = dynamic(() => const Equation = dynamic(() => import('@/components/Equation').then(async (m) => { // 化学方程式 - await import('@/lib/mhchem') + await import('@/lib/plugins/mhchem') return m.Equation }), { ssr: false } ) diff --git a/lib/notion/getNotionData.js b/lib/db/getSiteData.js similarity index 95% rename from lib/notion/getNotionData.js rename to lib/db/getSiteData.js index 814f4076..aac3b9f5 100755 --- a/lib/notion/getNotionData.js +++ b/lib/db/getSiteData.js @@ -2,16 +2,19 @@ import BLOG from '@/blog.config' import { getDataFromCache, setDataToCache } from '@/lib/cache/cache_manager' import { getPostBlocks, getSingleBlock } from '@/lib/notion/getPostBlocks' import { idToUuid } from 'notion-utils' -import { deepClone } from '../utils' -import { getAllCategories } from './getAllCategories' -import getAllPageIds from './getAllPageIds' -import { getAllTags } from './getAllTags' -import getPageProperties from './getPageProperties' -import { compressImage, mapImgUrl } from './mapImage' -import { getConfigMapFromConfigPage } from './getNotionConfig' +import { deepClone } from '@/lib/utils' +import { getAllCategories } from '@/lib/notion/getAllCategories' +import getAllPageIds from '@/lib/notion/getAllPageIds' +import { getAllTags } from '@/lib/notion/getAllTags' +import getPageProperties from '@/lib/notion/getPageProperties' +import { compressImage, mapImgUrl } from '@/lib/notion/mapImage' +import { getConfigMapFromConfigPage } from '@/lib/notion/getNotionConfig' + +export { getAllTags } from '../notion/getAllTags' +export { getPostBlocks } from '../notion/getPostBlocks' /** - * 获取博客数据 + * 获取博客数据; 基于Notion实现 * @param {*} pageId * @param {*} from * @param latestPostCount 截取最新文章数量 diff --git a/lib/lang.js b/lib/lang.js index eb6a8890..60b80882 100644 --- a/lib/lang.js +++ b/lib/lang.js @@ -5,7 +5,7 @@ import zhTW from './lang/zh-TW' import frFR from './lang/fr-FR' import trTR from './lang/tr-TR' import jaJP from './lang/ja-JP' -import { getQueryVariable, isBrowser, mergeDeep } from './utils' +import { getQueryVariable, isBrowser, mergeDeep } from '@/lib/utils' /** * 在这里配置所有支持的语言 diff --git a/lib/memorize.js b/lib/memorize.js deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/notion.js b/lib/notion.js deleted file mode 100644 index 0042487f..00000000 --- a/lib/notion.js +++ /dev/null @@ -1,2 +0,0 @@ -export { getAllTags } from './notion/getAllTags' -export { getPostBlocks } from './notion/getPostBlocks' diff --git a/lib/notion/getAllPosts.js b/lib/notion/getAllPosts.js index 5d63107a..dd221234 100644 --- a/lib/notion/getAllPosts.js +++ b/lib/notion/getAllPosts.js @@ -1,7 +1,7 @@ import BLOG from '@/blog.config' import getAllPageIds from './getAllPageIds' import getPageProperties from './getPageProperties' -import { getNotionPageData } from '@/lib/notion/getNotionData' +import { getNotionPageData } from '@/lib/db/getSiteData' import { delCacheData } from '@/lib/cache/cache_manager' /** diff --git a/lib/notion/getNotion.js b/lib/notion/getNotion.js index aad65379..20208158 100644 --- a/lib/notion/getNotion.js +++ b/lib/notion/getNotion.js @@ -1,6 +1,6 @@ import BLOG from '@/blog.config' import { idToUuid } from 'notion-utils' -import formatDate from '../formatDate' +import formatDate from '../utils/formatDate' import { getPostBlocks } from './getPostBlocks' import { defaultMapImageUrl } from 'react-notion-x' diff --git a/lib/notion/getPageProperties.js b/lib/notion/getPageProperties.js index 5caf9368..0a96ce1d 100644 --- a/lib/notion/getPageProperties.js +++ b/lib/notion/getPageProperties.js @@ -1,7 +1,7 @@ import { getTextContent, getDateValue } from 'notion-utils' import { NotionAPI } from 'notion-client' import BLOG from '@/blog.config' -import formatDate from '../formatDate' +import formatDate from '../utils/formatDate' // import { createHash } from 'crypto' import md5 from 'js-md5' import { mapImgUrl } from './mapImage' diff --git a/lib/algolia.js b/lib/plugins/algolia.js similarity index 100% rename from lib/algolia.js rename to lib/plugins/algolia.js diff --git a/lib/busuanzi.js b/lib/plugins/busuanzi.js similarity index 100% rename from lib/busuanzi.js rename to lib/plugins/busuanzi.js diff --git a/lib/gtag.js b/lib/plugins/gtag.js similarity index 100% rename from lib/gtag.js rename to lib/plugins/gtag.js diff --git a/lib/mailchimp.js b/lib/plugins/mailchimp.js similarity index 100% rename from lib/mailchimp.js rename to lib/plugins/mailchimp.js diff --git a/lib/mhchem.js b/lib/plugins/mhchem.js similarity index 100% rename from lib/mhchem.js rename to lib/plugins/mhchem.js diff --git a/lib/wow.js b/lib/plugins/wow.js similarity index 89% rename from lib/wow.js rename to lib/plugins/wow.js index 7b09d2c3..af0b4920 100644 --- a/lib/wow.js +++ b/lib/plugins/wow.js @@ -1,4 +1,4 @@ -const { loadExternalResource } = require('./utils'); +const { loadExternalResource } = require('../utils'); /** * WOWjs动画,结合animate.css使用很方便 diff --git a/lib/rss.js b/lib/rss.js index fff81f7c..5757b0f8 100644 --- a/lib/rss.js +++ b/lib/rss.js @@ -2,7 +2,7 @@ import fs from 'fs' import { Feed } from 'feed' import BLOG from '@/blog.config' import ReactDOMServer from 'react-dom/server' -import { getPostBlocks } from './notion' +import { getPostBlocks } from '@/lib/db/getSiteData' import NotionPage from '@/components/NotionPage' /** diff --git a/lib/formatDate.js b/lib/utils/formatDate.js similarity index 100% rename from lib/formatDate.js rename to lib/utils/formatDate.js diff --git a/lib/utils.js b/lib/utils/index.js similarity index 100% rename from lib/utils.js rename to lib/utils/index.js diff --git a/pages/404.js b/pages/404.js index 49ec11df..a4746405 100644 --- a/pages/404.js +++ b/pages/404.js @@ -1,4 +1,4 @@ -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData } from '@/lib/db/getSiteData' import { useRouter } from 'next/router' import { getLayoutByTheme } from '@/themes/theme' import { siteConfig } from '@/lib/config' diff --git a/pages/[prefix]/[slug]/[...suffix].js b/pages/[prefix]/[slug]/[...suffix].js index 7fc2b0a1..8983f419 100644 --- a/pages/[prefix]/[slug]/[...suffix].js +++ b/pages/[prefix]/[slug]/[...suffix].js @@ -1,10 +1,9 @@ import BLOG from '@/blog.config' -import { getPostBlocks } from '@/lib/notion' -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData, getPostBlocks } from '@/lib/db/getSiteData' import { idToUuid } from 'notion-utils' import { getNotion } from '@/lib/notion/getNotion' import Slug, { getRecommendPost } from '..' -import { uploadDataToAlgolia } from '@/lib/algolia' +import { uploadDataToAlgolia } from '@/lib/plugins/algolia' import { checkContainHttp } from '@/lib/utils' /** diff --git a/pages/[prefix]/[slug]/index.js b/pages/[prefix]/[slug]/index.js index 9eefb1a9..3f6b81fe 100644 --- a/pages/[prefix]/[slug]/index.js +++ b/pages/[prefix]/[slug]/index.js @@ -1,10 +1,9 @@ import BLOG from '@/blog.config' -import { getPostBlocks } from '@/lib/notion' -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData, getPostBlocks } from '@/lib/db/getSiteData' import { idToUuid } from 'notion-utils' import { getNotion } from '@/lib/notion/getNotion' import Slug, { getRecommendPost } from '..' -import { uploadDataToAlgolia } from '@/lib/algolia' +import { uploadDataToAlgolia } from '@/lib/plugins/algolia' import { checkContainHttp } from '@/lib/utils' /** diff --git a/pages/[prefix]/index.js b/pages/[prefix]/index.js index 91f1ec76..5c56f7e0 100644 --- a/pages/[prefix]/index.js +++ b/pages/[prefix]/index.js @@ -1,6 +1,5 @@ import BLOG from '@/blog.config' -import { getPostBlocks } from '@/lib/notion' -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData, getPostBlocks } from '@/lib/db/getSiteData' import { useEffect, useState } from 'react' import { idToUuid } from 'notion-utils' import { useRouter } from 'next/router' @@ -9,7 +8,7 @@ import { getPageTableOfContents } from '@/lib/notion/getPageTableOfContents' import { getLayoutByTheme } from '@/themes/theme' import md5 from 'js-md5' import { checkContainHttp } from '@/lib/utils' -import { uploadDataToAlgolia } from '@/lib/algolia' +import { uploadDataToAlgolia } from '@/lib/plugins/algolia' import { siteConfig } from '@/lib/config' /** diff --git a/pages/api/subscribe.js b/pages/api/subscribe.js index 86adddf9..d2d77894 100644 --- a/pages/api/subscribe.js +++ b/pages/api/subscribe.js @@ -1,4 +1,4 @@ -import subscribeToMailchimpApi from '@/lib/mailchimp' +import subscribeToMailchimpApi from '@/lib/plugins/mailchimp' /** * 接受邮件订阅 diff --git a/pages/archive/index.js b/pages/archive/index.js index bbcc718c..13bc905b 100644 --- a/pages/archive/index.js +++ b/pages/archive/index.js @@ -1,10 +1,10 @@ -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData } from '@/lib/db/getSiteData' import { useEffect } from 'react' import BLOG from '@/blog.config' import { useRouter } from 'next/router' import { getLayoutByTheme } from '@/themes/theme' import { isBrowser } from '@/lib/utils' -import { formatDateFmt } from '@/lib/formatDate' +import { formatDateFmt } from '@/lib/utils/formatDate' import { siteConfig } from '@/lib/config' const ArchiveIndex = props => { diff --git a/pages/category/[category]/index.js b/pages/category/[category]/index.js index 4056e9a1..203d429a 100644 --- a/pages/category/[category]/index.js +++ b/pages/category/[category]/index.js @@ -1,4 +1,4 @@ -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData } from '@/lib/db/getSiteData' import React from 'react' import BLOG from '@/blog.config' import { useRouter } from 'next/router' diff --git a/pages/category/[category]/page/[page].js b/pages/category/[category]/page/[page].js index 85ee8e69..97ddf764 100644 --- a/pages/category/[category]/page/[page].js +++ b/pages/category/[category]/page/[page].js @@ -1,4 +1,4 @@ -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData } from '@/lib/db/getSiteData' import React from 'react' import BLOG from '@/blog.config' import { useRouter } from 'next/router' diff --git a/pages/category/index.js b/pages/category/index.js index bd32e187..e4532cbc 100644 --- a/pages/category/index.js +++ b/pages/category/index.js @@ -1,4 +1,4 @@ -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData } from '@/lib/db/getSiteData' import React from 'react' import BLOG from '@/blog.config' import { useRouter } from 'next/router' diff --git a/pages/index.js b/pages/index.js index 83f13da0..451d8026 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,6 +1,5 @@ import BLOG from '@/blog.config' -import { getPostBlocks } from '@/lib/notion' -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData, getPostBlocks } from '@/lib/db/getSiteData' import { generateRss } from '@/lib/rss' import { generateRobotsTxt } from '@/lib/robots.txt' import { getLayoutByTheme } from '@/themes/theme' diff --git a/pages/page/[page].js b/pages/page/[page].js index 57e61068..6033655f 100644 --- a/pages/page/[page].js +++ b/pages/page/[page].js @@ -1,6 +1,5 @@ import BLOG from '@/blog.config' -import { getPostBlocks } from '@/lib/notion' -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData, getPostBlocks } from '@/lib/db/getSiteData' import { useRouter } from 'next/router' import { getLayoutByTheme } from '@/themes/theme' import { siteConfig } from '@/lib/config' diff --git a/pages/search/[keyword]/index.js b/pages/search/[keyword]/index.js index 22a33eda..cfbedefe 100644 --- a/pages/search/[keyword]/index.js +++ b/pages/search/[keyword]/index.js @@ -1,4 +1,4 @@ -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData } from '@/lib/db/getSiteData' import { getDataFromCache } from '@/lib/cache/cache_manager' import BLOG from '@/blog.config' import { useRouter } from 'next/router' diff --git a/pages/search/[keyword]/page/[page].js b/pages/search/[keyword]/page/[page].js index 6fcd3be8..68cfca62 100644 --- a/pages/search/[keyword]/page/[page].js +++ b/pages/search/[keyword]/page/[page].js @@ -1,4 +1,4 @@ -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData } from '@/lib/db/getSiteData' import { getDataFromCache } from '@/lib/cache/cache_manager' import BLOG from '@/blog.config' import { useRouter } from 'next/router' diff --git a/pages/search/index.js b/pages/search/index.js index 43695ed5..e41da00b 100644 --- a/pages/search/index.js +++ b/pages/search/index.js @@ -1,4 +1,4 @@ -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData } from '@/lib/db/getSiteData' import { useRouter } from 'next/router' import BLOG from '@/blog.config' import { getLayoutByTheme } from '@/themes/theme' diff --git a/pages/signin.js b/pages/signin.js index 9abfb1f8..0fc037bc 100644 --- a/pages/signin.js +++ b/pages/signin.js @@ -1,5 +1,5 @@ import BLOG from '@/blog.config' -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData } from '@/lib/db/getSiteData' import { useRouter } from 'next/router' import { getLayoutByTheme } from '@/themes/theme' import { siteConfig } from '@/lib/config' diff --git a/pages/signup.js b/pages/signup.js index d570d46b..1fccbe8b 100644 --- a/pages/signup.js +++ b/pages/signup.js @@ -1,5 +1,5 @@ import BLOG from '@/blog.config' -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData } from '@/lib/db/getSiteData' import { useRouter } from 'next/router' import { getLayoutByTheme } from '@/themes/theme' import { siteConfig } from '@/lib/config' diff --git a/pages/sitemap.xml.js b/pages/sitemap.xml.js index 58c9a846..a0967ede 100644 --- a/pages/sitemap.xml.js +++ b/pages/sitemap.xml.js @@ -1,6 +1,6 @@ // pages/sitemap.xml.js import { getServerSideSitemap } from 'next-sitemap' -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData } from '@/lib/db/getSiteData' import BLOG from '@/blog.config' export const getServerSideProps = async (ctx) => { diff --git a/pages/tag/[tag]/index.js b/pages/tag/[tag]/index.js index f1da323e..8c65dbd9 100644 --- a/pages/tag/[tag]/index.js +++ b/pages/tag/[tag]/index.js @@ -1,4 +1,4 @@ -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData } from '@/lib/db/getSiteData' import BLOG from '@/blog.config' import { useRouter } from 'next/router' import { getLayoutByTheme } from '@/themes/theme' diff --git a/pages/tag/[tag]/page/[page].js b/pages/tag/[tag]/page/[page].js index ce2951ab..ebe85718 100644 --- a/pages/tag/[tag]/page/[page].js +++ b/pages/tag/[tag]/page/[page].js @@ -1,4 +1,4 @@ -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData } from '@/lib/db/getSiteData' import BLOG from '@/blog.config' import { useRouter } from 'next/router' import { getLayoutByTheme } from '@/themes/theme' diff --git a/pages/tag/index.js b/pages/tag/index.js index 5866b978..2141242d 100644 --- a/pages/tag/index.js +++ b/pages/tag/index.js @@ -1,4 +1,4 @@ -import { getGlobalData } from '@/lib/notion/getNotionData' +import { getGlobalData } from '@/lib/db/getSiteData' import BLOG from '@/blog.config' import { useRouter } from 'next/router' import { getLayoutByTheme } from '@/themes/theme' diff --git a/themes/example/components/ArticleInfo.js b/themes/example/components/ArticleInfo.js index 825fc774..b502a9c9 100644 --- a/themes/example/components/ArticleInfo.js +++ b/themes/example/components/ArticleInfo.js @@ -1,6 +1,6 @@ import Link from 'next/link' import { useGlobal } from '@/lib/global' -import { formatDateFmt } from '@/lib/formatDate' +import { formatDateFmt } from '@/lib/utils/formatDate' export const ArticleInfo = (props) => { const { post } = props diff --git a/themes/fukasawa/components/ArticleDetail.js b/themes/fukasawa/components/ArticleDetail.js index a378af5a..544d80de 100644 --- a/themes/fukasawa/components/ArticleDetail.js +++ b/themes/fukasawa/components/ArticleDetail.js @@ -7,7 +7,7 @@ import Link from 'next/link' import ArticleAround from './ArticleAround' import { AdSlot } from '@/components/GoogleAdsense' import LazyImage from '@/components/LazyImage' -import { formatDateFmt } from '@/lib/formatDate' +import { formatDateFmt } from '@/lib/utils/formatDate' import WWAds from '@/components/WWAds' import NotionIcon from '@/components/NotionIcon' diff --git a/themes/fukasawa/components/MailChimpForm.js b/themes/fukasawa/components/MailChimpForm.js index f2e990e5..8e70c09d 100644 --- a/themes/fukasawa/components/MailChimpForm.js +++ b/themes/fukasawa/components/MailChimpForm.js @@ -1,5 +1,5 @@ import { useEffect, useRef, useState } from 'react' -import { subscribeToNewsletter } from '@/lib/mailchimp' +import { subscribeToNewsletter } from '@/lib/plugins/mailchimp' import { siteConfig } from '@/lib/config' import CONFIG from '../config' import { useGlobal } from '@/lib/global' diff --git a/themes/heo/components/PostHeader.js b/themes/heo/components/PostHeader.js index d0a20578..925c8040 100644 --- a/themes/heo/components/PostHeader.js +++ b/themes/heo/components/PostHeader.js @@ -5,7 +5,7 @@ import WavesArea from './WavesArea' import { HashTag } from '@/components/HeroIcons' import WordCount from '@/components/WordCount' import LazyImage from '@/components/LazyImage' -import { formatDateFmt } from '@/lib/formatDate' +import { formatDateFmt } from '@/lib/utils/formatDate' export default function PostHeader({ post, siteInfo }) { if (!post) { diff --git a/themes/heo/index.js b/themes/heo/index.js index 2f09e60b..36f84b1f 100644 --- a/themes/heo/index.js +++ b/themes/heo/index.js @@ -40,7 +40,7 @@ import WWAds from '@/components/WWAds' import { AdSlot } from '@/components/GoogleAdsense' import { siteConfig } from '@/lib/config' import { isBrowser } from '@/lib/utils' -import { loadWowJS } from '@/lib/wow' +import { loadWowJS } from '@/lib/plugins/wow' /** * 基础布局 采用上中下布局,移动端使用顶部侧边导航栏 diff --git a/themes/hexo/components/BlogPostCardInfo.js b/themes/hexo/components/BlogPostCardInfo.js index 6ab5eda7..2232a6e8 100644 --- a/themes/hexo/components/BlogPostCardInfo.js +++ b/themes/hexo/components/BlogPostCardInfo.js @@ -3,7 +3,7 @@ import Link from 'next/link' import TagItemMini from './TagItemMini' import TwikooCommentCount from '@/components/TwikooCommentCount' import { siteConfig } from '@/lib/config' -import { formatDateFmt } from '@/lib/formatDate' +import { formatDateFmt } from '@/lib/utils/formatDate' import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' import NotionIcon from '@/components/NotionIcon' diff --git a/themes/hexo/components/PostHeader.js b/themes/hexo/components/PostHeader.js index 9266f181..6441d942 100644 --- a/themes/hexo/components/PostHeader.js +++ b/themes/hexo/components/PostHeader.js @@ -3,7 +3,7 @@ import TagItemMini from './TagItemMini' import { useGlobal } from '@/lib/global' import NotionIcon from '@/components/NotionIcon' import LazyImage from '@/components/LazyImage' -import { formatDateFmt } from '@/lib/formatDate' +import { formatDateFmt } from '@/lib/utils/formatDate' import { siteConfig } from '@/lib/config' export default function PostHeader({ post, siteInfo }) { diff --git a/themes/landing/components/Footer.js b/themes/landing/components/Footer.js index 2673aa38..3f27b76f 100644 --- a/themes/landing/components/Footer.js +++ b/themes/landing/components/Footer.js @@ -1,4 +1,4 @@ -import { subscribeToNewsletter } from '@/lib/mailchimp' +import { subscribeToNewsletter } from '@/lib/plugins/mailchimp' import Link from 'next/link' import { useEffect, useRef, useState } from 'react' import CONFIG from '../config' diff --git a/themes/landing/components/Newsletter.js b/themes/landing/components/Newsletter.js index 3288905f..de356738 100644 --- a/themes/landing/components/Newsletter.js +++ b/themes/landing/components/Newsletter.js @@ -1,4 +1,4 @@ -import { subscribeToNewsletter } from '@/lib/mailchimp' +import { subscribeToNewsletter } from '@/lib/plugins/mailchimp' import { useEffect, useRef, useState } from 'react' import CONFIG from '../config' import { siteConfig } from '@/lib/config' diff --git a/themes/matery/components/ArticleInfo.js b/themes/matery/components/ArticleInfo.js index d8507686..af3fa823 100644 --- a/themes/matery/components/ArticleInfo.js +++ b/themes/matery/components/ArticleInfo.js @@ -2,7 +2,7 @@ import Link from 'next/link' import { useGlobal } from '@/lib/global' import TagItemMiddle from './TagItemMiddle' import WordCount from './WordCount' -import { formatDateFmt } from '@/lib/formatDate' +import { formatDateFmt } from '@/lib/utils/formatDate' export const ArticleInfo = (props) => { const { post } = props diff --git a/themes/matery/components/BlogPostCard.js b/themes/matery/components/BlogPostCard.js index 9ecdf6f0..21e7b717 100644 --- a/themes/matery/components/BlogPostCard.js +++ b/themes/matery/components/BlogPostCard.js @@ -4,7 +4,7 @@ import TagItemMini from './TagItemMini' import CONFIG from '../config' import TwikooCommentCount from '@/components/TwikooCommentCount' import LazyImage from '@/components/LazyImage' -import { formatDateFmt } from '@/lib/formatDate' +import { formatDateFmt } from '@/lib/utils/formatDate' import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' import NotionIcon from '@/components/NotionIcon' diff --git a/themes/next/components/ArticleDetail.js b/themes/next/components/ArticleDetail.js index 232a1f08..64200117 100644 --- a/themes/next/components/ArticleDetail.js +++ b/themes/next/components/ArticleDetail.js @@ -12,7 +12,7 @@ import NotionPage from '@/components/NotionPage' import CONFIG from '../config' import NotionIcon from '@/components/NotionIcon' import LazyImage from '@/components/LazyImage' -import { formatDateFmt } from '@/lib/formatDate' +import { formatDateFmt } from '@/lib/utils/formatDate' import { siteConfig } from '@/lib/config' import WWAds from '@/components/WWAds' diff --git a/themes/next/components/BlogPostCard.js b/themes/next/components/BlogPostCard.js index 53cc4ee3..8b3f4a5b 100644 --- a/themes/next/components/BlogPostCard.js +++ b/themes/next/components/BlogPostCard.js @@ -7,7 +7,7 @@ import CONFIG from '../config' import NotionPage from '@/components/NotionPage' import NotionIcon from '@/components/NotionIcon' import TwikooCommentCount from '@/components/TwikooCommentCount' -import { formatDateFmt } from '@/lib/formatDate' +import { formatDateFmt } from '@/lib/utils/formatDate' import { siteConfig } from '@/lib/config' import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' diff --git a/themes/simple/components/ArticleInfo.js b/themes/simple/components/ArticleInfo.js index 98777244..9ec3da91 100644 --- a/themes/simple/components/ArticleInfo.js +++ b/themes/simple/components/ArticleInfo.js @@ -2,7 +2,7 @@ import Link from 'next/link' import { useGlobal } from '@/lib/global' import CONFIG from '../config' import { siteConfig } from '@/lib/config' -import { formatDateFmt } from '@/lib/formatDate' +import { formatDateFmt } from '@/lib/utils/formatDate' import NotionIcon from '@/components/NotionIcon' /** diff --git a/themes/simple/components/BlogItem.js b/themes/simple/components/BlogItem.js index befcd3d8..897bd83e 100644 --- a/themes/simple/components/BlogItem.js +++ b/themes/simple/components/BlogItem.js @@ -1,7 +1,7 @@ import Link from 'next/link' import CONFIG from '../config' import TwikooCommentCount from '@/components/TwikooCommentCount' -import { formatDateFmt } from '@/lib/formatDate' +import { formatDateFmt } from '@/lib/utils/formatDate' import { siteConfig } from '@/lib/config' import LazyImage from '@/components/LazyImage' import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' diff --git a/themes/starter/index.js b/themes/starter/index.js index f899904a..7b7275ed 100644 --- a/themes/starter/index.js +++ b/themes/starter/index.js @@ -36,7 +36,7 @@ import { Banner } from './components/Banner' import { SignInForm } from './components/SignInForm' import { SignUpForm } from './components/SignUpForm' import Link from 'next/link' -import { loadWowJS } from '@/lib/wow' +import { loadWowJS } from '@/lib/plugins/wow' /** * 布局框架 From c71fe8c350bcdc79830169875d61052616bcb5f7 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Sun, 10 Mar 2024 13:08:59 +0800 Subject: [PATCH 2/3] v4.3.2 --- .env.local | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.local b/.env.local index 4d556f6c..8a2ae88c 100644 --- a/.env.local +++ b/.env.local @@ -1,5 +1,5 @@ # 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables -NEXT_PUBLIC_VERSION=4.3.1 +NEXT_PUBLIC_VERSION=4.3.2 # 可在此添加环境变量,去掉最左边的(# )注释即可 diff --git a/package.json b/package.json index 69a231e2..0ccd17e1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "notion-next", - "version": "4.3.1", + "version": "4.3.2", "homepage": "https://github.com/tangly1024/NotionNext.git", "license": "MIT", "repository": { From 11d9eca881c5a1abc8b88c7f2b48f98b45fd36dd Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Sun, 10 Mar 2024 13:16:17 +0800 Subject: [PATCH 3/3] Comment --- lib/notion/getPostBlocks.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/notion/getPostBlocks.js b/lib/notion/getPostBlocks.js index 9210e0d1..c9652370 100644 --- a/lib/notion/getPostBlocks.js +++ b/lib/notion/getPostBlocks.js @@ -27,6 +27,12 @@ export async function getPostBlocks(id, from, slice) { return pageBlock } +/** + * 针对在getDataBaseInfoByNotionAPI=>getPostBlocks中获取不到的溢出的block-id,用此方法另外抓取 + * @param {*} id + * @param {*} from + * @returns + */ export async function getSingleBlock(id, from) { const cacheKey = 'single_block_' + id let pageBlock = await getDataFromCache(cacheKey)