mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-01 23:16:51 +00:00
package
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user