mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-13 23:16:47 +00:00
package
This commit is contained in:
@@ -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' }
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"feed": "^4.2.2",
|
||||
"gitalk": "^1.7.2",
|
||||
"js-md5": "^0.7.3",
|
||||
"localStorage": "^1.0.4",
|
||||
"lodash.throttle": "^4.1.1",
|
||||
"mark.js": "^8.11.1",
|
||||
|
||||
@@ -9,7 +9,7 @@ import Router from 'next/router'
|
||||
import { isBrowser } from '@/lib/utils'
|
||||
import { getNotion } from '@/lib/notion/getNotion'
|
||||
import { getPageTableOfContents } from '@/lib/notion/getPageTableOfContents'
|
||||
import { createHash } from 'crypto'
|
||||
import md5 from 'js-md5'
|
||||
|
||||
/**
|
||||
* 根据notion的slug访问页面
|
||||
@@ -59,9 +59,8 @@ const Slug = props => {
|
||||
* @param {*} result
|
||||
*/
|
||||
const validPassword = passInput => {
|
||||
const encrypt = createHash('md5')
|
||||
.update(post.slug + passInput)
|
||||
.digest('hex').trim().toLowerCase()
|
||||
const encrypt = md5(post.slug + passInput)
|
||||
|
||||
if (passInput && encrypt === post.password) {
|
||||
setLock(false)
|
||||
return true
|
||||
|
||||
@@ -45,6 +45,7 @@ export async function getStaticProps() {
|
||||
})
|
||||
|
||||
props.archivePosts = archivePosts
|
||||
delete props.allPages
|
||||
|
||||
return {
|
||||
props,
|
||||
|
||||
@@ -29,6 +29,7 @@ export async function getStaticProps() {
|
||||
const props = await getGlobalNotionData({ from: 'category-index-props' })
|
||||
props.categories = getAllCategories({ allPages: props.allPages, categoryOptions: props.categoryOptions, sliceCount: 0 })
|
||||
delete props.categoryOptions
|
||||
delete props.allPages
|
||||
return {
|
||||
props,
|
||||
revalidate: BLOG.NEXT_REVALIDATE_SECOND
|
||||
|
||||
@@ -14,6 +14,7 @@ export async function getStaticProps() {
|
||||
const props = await getGlobalNotionData({ from })
|
||||
const { siteInfo } = props
|
||||
props.posts = props.allPages.filter(page => page.type === 'Post' && page.status === 'Published')
|
||||
delete props.allPages
|
||||
const meta = {
|
||||
title: `${siteInfo?.title} | ${siteInfo?.description}`,
|
||||
description: siteInfo?.description,
|
||||
|
||||
@@ -54,6 +54,7 @@ export async function getStaticProps({ params: { page } }) {
|
||||
}
|
||||
}
|
||||
|
||||
delete props.allPages
|
||||
return {
|
||||
props,
|
||||
revalidate: BLOG.NEXT_REVALIDATE_SECOND
|
||||
|
||||
@@ -43,6 +43,7 @@ export async function getStaticProps({ params: { keyword, page } }) {
|
||||
props.posts = props.posts.slice(BLOG.POSTS_PER_PAGE * (page - 1), BLOG.POSTS_PER_PAGE * page - 1)
|
||||
props.keyword = keyword
|
||||
props.page = page
|
||||
delete props.allPages
|
||||
return {
|
||||
props,
|
||||
revalidate: BLOG.NEXT_REVALIDATE_SECOND
|
||||
|
||||
@@ -41,6 +41,7 @@ export async function getStaticProps({ params: { tag } }) {
|
||||
}
|
||||
|
||||
props.tag = tag
|
||||
delete props.allPages
|
||||
return {
|
||||
props,
|
||||
revalidate: BLOG.NEXT_REVALIDATE_SECOND
|
||||
|
||||
@@ -30,6 +30,7 @@ export async function getStaticProps() {
|
||||
const props = await getGlobalNotionData({ from })
|
||||
props.tags = getAllTags({ allPages: props.allPages, sliceCount: 0, tagOptions: props.tagOptions })
|
||||
delete props.tagOptions
|
||||
delete props.allPages
|
||||
return {
|
||||
props,
|
||||
revalidate: BLOG.NEXT_REVALIDATE_SECOND
|
||||
|
||||
@@ -11,10 +11,17 @@ import Live2D from '@/components/Live2D'
|
||||
import LoadingCover from './components/LoadingCover'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import BLOG from '@/blog.config'
|
||||
import FacebookPage from '@/components/FacebookPage'
|
||||
import AOS from 'aos'
|
||||
import 'aos/dist/aos.css' // You can also use <link> for styles
|
||||
import { isBrowser } from '@/lib/utils'
|
||||
import dynamic from 'next/dynamic'
|
||||
|
||||
const FacebookPage = dynamic(
|
||||
() => {
|
||||
return import('@/components/FacebookPage')
|
||||
},
|
||||
{ ssr: false }
|
||||
)
|
||||
|
||||
/**
|
||||
* 基础布局 采用左右两侧布局,移动端使用顶部导航栏
|
||||
|
||||
@@ -3,16 +3,12 @@ import formatDate from '@/lib/formatDate'
|
||||
import Image from 'next/image'
|
||||
import BLOG from '@/blog.config'
|
||||
import TagItem from './TagItem'
|
||||
import { createHash } from 'crypto'
|
||||
import md5 from 'js-md5'
|
||||
|
||||
export const ArticleInfo = (props) => {
|
||||
const { post } = props
|
||||
|
||||
const emailHash = createHash('md5')
|
||||
.update(BLOG.CONTACT_EMAIL)
|
||||
.digest('hex')
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
const emailHash = md5(BLOG.CONTACT_EMAIL)
|
||||
|
||||
return <section className="flex-wrap flex mt-2 text-gray--600 dark:text-gray-400 font-light leading-8">
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user