Skip to content

Commit afd1771

Browse files
committed
Merge branch 'main' into release/4.8.3
2 parents d260c09 + d3643de commit afd1771

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

lib/db/getSiteData.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -359,12 +359,12 @@ function handleDataBeforeReturn(db) {
359359
const currentTimestamp = Date.now()
360360
const startTimestamp = getTimestamp(
361361
p.date.start_date,
362-
p.date.start_time,
362+
p.date.start_time || '00:00',
363363
p.date.time_zone
364364
)
365365
const endTimestamp = getTimestamp(
366366
p.date.end_date,
367-
p.date.end_time,
367+
p.date.end_time || '23:59',
368368
p.date.time_zone
369369
)
370370
console.log(
@@ -694,7 +694,7 @@ function isInRange(title, date = {}) {
694694
* @param {string} timeZone - 时区名称(如 "Asia/Shanghai")
695695
* @returns {Date} - 转换后的 Date 对象(UTC 时间)
696696
*/
697-
function convertToUTC(dateStr, timeZone) {
697+
function convertToUTC(dateStr, timeZone = 'Asia/Shanghai') {
698698
// 维护一个时区偏移映射(以小时为单位)
699699
const timeZoneOffsets = {
700700
// UTC 基础
@@ -766,7 +766,7 @@ function convertToUTC(dateStr, timeZone) {
766766
}
767767

768768
// 辅助函数:生成指定日期时间的时间戳(基于目标时区)
769-
function getTimestamp(date, time, time_zone) {
769+
function getTimestamp(date, time ='00:00', time_zone) {
770770
if (!date) return null
771771
return convertToUTC(`${date} ${time}:00`, time_zone).getTime()
772772
}

lib/notion/mapImage.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,21 @@ const mapImgUrl = (img, block, type = 'block', needCompress = true) => {
2323
ret = img
2424
}
2525

26-
// Notion 图床转换为永久地址
2726
const hasConverted =
28-
ret.indexOf('https://www.notion.so/image') === 0 ||
29-
ret.includes('notion.site/images/page-cover/')
27+
ret.indexOf('https://www.notion.so/image') === 0 ||
28+
ret.includes('notion.site/images/page-cover/')
29+
3030
// 需要转化的URL ; 识别aws图床地址,或者bookmark类型的外链图片
31+
// Notion新图床资源 格式为 attachment:${id}:${name}
3132
const needConvert =
3233
!hasConverted &&
3334
(block.type === 'bookmark' ||
3435
ret.includes('secure.notion-static.com') ||
35-
ret.includes('prod-files-secure'))
36+
ret.includes('prod-files-secure')) ||
37+
ret.indexOf('attachment')===0
38+
3639

37-
// 使用Notion图传
40+
// Notion旧图床
3841
if (needConvert) {
3942
ret =
4043
BLOG.NOTION_HOST +

0 commit comments

Comments
 (0)