From e24b8cfe3ae6d38081e93cf03fd88ae6c3c94bf5 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 1 Nov 2023 14:28:22 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=8F=E6=9C=BA=E5=9B=BE=E7=89=87=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/mapImage.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/notion/mapImage.js b/lib/notion/mapImage.js index f25eda99..0406507f 100644 --- a/lib/notion/mapImage.js +++ b/lib/notion/mapImage.js @@ -67,13 +67,10 @@ const mapImgUrl = (img, block, type = 'block', from) => { ret = BLOG.NOTION_HOST + '/image/' + encodeURIComponent(ret) + '?table=' + type + '&id=' + block.id } - // UnSplash 随机图片接口优化 - if (ret.includes('source.unsplash.com/random')) { - // 检查原始URL是否已经包含参数 - const separator = ret.includes('?') ? '&' : '?' - // 拼接唯一识别参数,防止请求的图片被缓存 - ret = `${ret}${separator}random=${block.id}` - } + // 随机图片接口优化 防止因url一致而随机结果相同 + const separator = ret.includes('?') ? '&' : '?' + // 拼接唯一识别参数,防止请求的图片被缓存 + ret = `${ret.trim()}${separator}t=${block.id}` // 文章封面 if (from === 'pageCoverThumbnail') {