Merge branch 'main' into pr/Olimiya/1723

This commit is contained in:
tangly1024.com
2024-01-30 18:34:19 +08:00
60 changed files with 985 additions and 684 deletions

View File

@@ -81,8 +81,10 @@ export async function getPageWithRetry(id, from, retryAttempts = 3) {
}
/**
* 获取到的blockMap删除不需要的字段
* 并且对于页面内容进行特殊处理比如文件url格式化
* 获取到的页面BLOCK特殊处理
* 1.删除冗余字段
* 2.比如文件、视频、音频、url格式化
* 3.代码块等元素兼容
* @param {*} id 页面ID
* @param {*} pageBlock 页面元素
* @param {*} slice 截取数量
@@ -121,7 +123,10 @@ function filterPostBlocks(id, pageBlock, slice) {
}
// 如果是文件或嵌入式PDF需要重新加密签名
if ((b?.value?.type === 'file' || b?.value?.type === 'pdf' || b?.value?.type === 'video') && b?.value?.properties?.source?.[0][0]) {
if ((b?.value?.type === 'file' || b?.value?.type === 'pdf' || b?.value?.type === 'video' || b?.value?.type === 'audio') &&
b?.value?.properties?.source?.[0][0] &&
b?.value?.properties?.source?.[0][0].indexOf('amazonaws.com') > 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