This commit is contained in:
tangly1024
2023-01-06 20:23:14 +08:00
parent bf25721e84
commit 6cfd429ce5
12 changed files with 24 additions and 15 deletions

View File

@@ -3,7 +3,8 @@ import { NotionAPI } from 'notion-client'
import BLOG from '@/blog.config'
import formatDate from '../formatDate'
import { defaultMapImageUrl } from 'react-notion-x'
import { createHash } from 'crypto'
// import { createHash } from 'crypto'
import md5 from 'js-md5'
export default async function getPageProperties(id, block, schema, authToken, tagOptions, siteInfo) {
const rawProperties = Object.entries(block?.[id]?.value?.properties || [])
@@ -91,9 +92,7 @@ export default async function getPageProperties(id, block, schema, authToken, ta
properties.page_cover = getImageUrl(block[id].value?.format?.page_cover, block[id].value) ?? siteInfo?.pageCover
properties.content = value.content ?? []
properties.password = properties.password
? createHash('md5')
.update(properties.slug + properties.password)
.digest('hex').trim().toLowerCase()
? md5(properties.slug + properties.password)
: ''
properties.tagItems = properties?.tags?.map(tag => {
return { name: tag, color: tagOptions?.find(t => t.value === tag)?.color || 'gray' }