Merge branch 'main' into feat/notion-config

This commit is contained in:
tangly1024.com
2023-11-02 09:29:03 +08:00
3 changed files with 13 additions and 6 deletions

View File

@@ -1,2 +1,2 @@
# 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables
NEXT_PUBLIC_VERSION=4.0.17
NEXT_PUBLIC_VERSION=4.0.18

View File

@@ -67,10 +67,12 @@ const mapImgUrl = (img, block, type = 'block', from) => {
ret = BLOG.NOTION_HOST + '/image/' + encodeURIComponent(ret) + '?table=' + type + '&id=' + block.id
}
// 随机图片接口优化 防止因url一致而随机结果相同
const separator = ret.includes('?') ? '&' : '?'
// 拼接唯一识别参数,防止请求的图片被缓存
ret = `${ret.trim()}${separator}t=${block.id}`
if (!isEmoji(ret)) {
// 随机图片接口优化 防止因url一致而随机结果相同
const separator = ret.includes('?') ? '&' : '?'
// 拼接唯一识别参数,防止请求的图片被缓存
ret = `${ret.trim()}${separator}t=${block.id}`
}
// 文章封面
if (from === 'pageCoverThumbnail') {
@@ -80,4 +82,9 @@ const mapImgUrl = (img, block, type = 'block', from) => {
return ret
}
function isEmoji(str) {
const emojiRegex = /[\u{1F300}-\u{1F6FF}\u{1F1E0}-\u{1F1FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}\u{1F900}-\u{1F9FF}\u{1F018}-\u{1F270}]/u;
return emojiRegex.test(str);
}
export { mapImgUrl, compressImage }

View File

@@ -1,6 +1,6 @@
{
"name": "notion-next",
"version": "4.0.17",
"version": "4.0.18",
"homepage": "https://github.com/tangly1024/NotionNext.git",
"license": "MIT",
"repository": {