主题,加密

This commit is contained in:
tangly1024
2022-12-24 19:08:10 +08:00
parent e9fc7b9ea3
commit ef4daf4cf6
8 changed files with 16 additions and 10 deletions

View File

@@ -8,8 +8,8 @@ import { idToUuid } from 'notion-utils'
import Router from 'next/router'
import { isBrowser } from '@/lib/utils'
import { getNotion } from '@/lib/notion/getNotion'
import md5 from 'js-md5'
import { getPageTableOfContents } from '@/lib/notion/getPageTableOfContents'
import { createHash } from 'crypto'
/**
* 根据notion的slug访问页面
@@ -59,7 +59,10 @@ const Slug = props => {
* @param {*} result
*/
const validPassword = passInput => {
if (passInput && md5(post.slug + passInput) === post.password) {
const encrypt = createHash('md5')
.update(post.slug + passInput)
.digest('hex').trim().toLowerCase()
if (passInput && encrypt === post.password) {
setLock(false)
return true
}