From 960bf97adea1434d891c718ff64cb5a6053e2293 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Wed, 1 Nov 2023 22:04:21 +0800 Subject: [PATCH 1/2] v4.0.18 --- .env.local | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.local b/.env.local index 8fb4ae71..48b76dc9 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.17 \ No newline at end of file +NEXT_PUBLIC_VERSION=4.0.18 \ No newline at end of file diff --git a/package.json b/package.json index 586f98cf..6164cbb4 100644 --- a/package.json +++ b/package.json @@ -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": { From 13608c6461d22264b573748e65c84839d907a110 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Wed, 1 Nov 2023 23:15:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix=20=E5=9B=BE=E7=89=87emoji?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/mapImage.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/notion/mapImage.js b/lib/notion/mapImage.js index 0406507f..8d8c7434 100644 --- a/lib/notion/mapImage.js +++ b/lib/notion/mapImage.js @@ -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 }