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

@@ -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

View File

@@ -45,6 +45,7 @@ export async function getStaticProps() {
})
props.archivePosts = archivePosts
delete props.allPages
return {
props,

View File

@@ -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

View File

@@ -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,

View File

@@ -54,6 +54,7 @@ export async function getStaticProps({ params: { page } }) {
}
}
delete props.allPages
return {
props,
revalidate: BLOG.NEXT_REVALIDATE_SECOND

View File

@@ -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

View File

@@ -41,6 +41,7 @@ export async function getStaticProps({ params: { tag } }) {
}
props.tag = tag
delete props.allPages
return {
props,
revalidate: BLOG.NEXT_REVALIDATE_SECOND

View File

@@ -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