mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
Merge branch 'main' into feat/notion-config
This commit is contained in:
@@ -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
|
||||
@@ -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 }
|
||||
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user