From 1c2013d8e67d402b992db7b4ebf76410f22986b1 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Sun, 2 Feb 2025 13:58:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E3=80=81=E6=97=B6=E9=97=B4=E6=88=B3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/db/getSiteData.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/db/getSiteData.js b/lib/db/getSiteData.js index 66aa1f8d..ff9f6bf7 100755 --- a/lib/db/getSiteData.js +++ b/lib/db/getSiteData.js @@ -359,12 +359,12 @@ function handleDataBeforeReturn(db) { const currentTimestamp = Date.now() const startTimestamp = getTimestamp( p.date.start_date, - p.date.start_time, + p.date.start_time || '00:00', p.date.time_zone ) const endTimestamp = getTimestamp( p.date.end_date, - p.date.end_time, + p.date.end_time || '23:59', p.date.time_zone ) console.log( @@ -694,7 +694,7 @@ function isInRange(title, date = {}) { * @param {string} timeZone - 时区名称(如 "Asia/Shanghai") * @returns {Date} - 转换后的 Date 对象(UTC 时间) */ -function convertToUTC(dateStr, timeZone) { +function convertToUTC(dateStr, timeZone = 'Asia/Shanghai') { // 维护一个时区偏移映射(以小时为单位) const timeZoneOffsets = { // UTC 基础 @@ -766,7 +766,7 @@ function convertToUTC(dateStr, timeZone) { } // 辅助函数:生成指定日期时间的时间戳(基于目标时区) -function getTimestamp(date, time, time_zone) { +function getTimestamp(date, time ='00:00', time_zone) { if (!date) return null return convertToUTC(`${date} ${time}:00`, time_zone).getTime() } From 280bb79e7b45fa53d07ab0e99a2e0a200d7bbdef Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Sun, 2 Feb 2025 13:58:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?Notion=E6=96=B0=E5=9B=BE=E5=BA=8A=E5=85=BC?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/mapImage.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/notion/mapImage.js b/lib/notion/mapImage.js index 5bb1e9b1..85ed4e30 100644 --- a/lib/notion/mapImage.js +++ b/lib/notion/mapImage.js @@ -23,18 +23,21 @@ const mapImgUrl = (img, block, type = 'block', needCompress = true) => { ret = img } - // Notion 图床转换为永久地址 const hasConverted = - ret.indexOf('https://www.notion.so/image') === 0 || - ret.includes('notion.site/images/page-cover/') + ret.indexOf('https://www.notion.so/image') === 0 || + ret.includes('notion.site/images/page-cover/') + // 需要转化的URL ; 识别aws图床地址,或者bookmark类型的外链图片 + // Notion新图床资源 格式为 attachment:${id}:${name} const needConvert = !hasConverted && (block.type === 'bookmark' || ret.includes('secure.notion-static.com') || - ret.includes('prod-files-secure')) + ret.includes('prod-files-secure')) || + ret.indexOf('attachment')===0 - // 使用Notion图传 + + // Notion旧图床 if (needConvert) { ret = BLOG.NOTION_HOST +