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/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 ( -
+
) } diff --git a/lib/notion/getPostBlocks.js b/lib/notion/getPostBlocks.js index ca3090dd..a9e3a757 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) { } } + // 如果是文件,或嵌入式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 + } + delete b?.role delete b?.value?.version delete b?.value?.created_by_table 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": {