Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Feb 3, 2025
2 parents f09360a + a424cf2 commit afb07fb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
8 changes: 4 additions & 4 deletions lib/db/getSiteData.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 基础
Expand Down Expand Up @@ -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()
}
Expand Down
13 changes: 8 additions & 5 deletions lib/notion/mapImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 +
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "notion-next",
"version": "4.8.2",
"version": "4.8.3",
"homepage": "https://github.com/tangly1024/NotionNext.git",
"license": "MIT",
"repository": {
Expand Down

0 comments on commit afb07fb

Please sign in to comment.