mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
Merge branch 'main' of https://github.com/tangly1024/NotionNext into main
This commit is contained in:
@@ -3,7 +3,7 @@ import { NotionAPI } from 'notion-client'
|
||||
import BLOG from '@/blog.config'
|
||||
import formatDate from '../formatDate'
|
||||
import { defaultMapImageUrl } from 'react-notion-x'
|
||||
import md5 from 'js-md5'
|
||||
import { createHash } from 'crypto'
|
||||
|
||||
export default async function getPageProperties(id, block, schema, authToken, tagOptions, siteInfo) {
|
||||
const rawProperties = Object.entries(block?.[id]?.value?.properties || [])
|
||||
@@ -90,7 +90,11 @@ export default async function getPageProperties(id, block, schema, authToken, ta
|
||||
properties.pageIcon = getImageUrl(block[id].value?.format?.page_icon, block[id].value) ?? ''
|
||||
properties.page_cover = getImageUrl(block[id].value?.format?.page_cover, block[id].value) ?? siteInfo?.pageCover
|
||||
properties.content = value.content ?? []
|
||||
properties.password = properties.password ? md5(properties.slug + properties.password) : ''
|
||||
properties.password = properties.password
|
||||
? createHash('md5')
|
||||
.update(properties.slug + properties.password)
|
||||
.digest('hex').trim().toLowerCase()
|
||||
: ''
|
||||
properties.tagItems = properties?.tags?.map(tag => {
|
||||
return { name: tag, color: tagOptions?.find(t => t.value === tag)?.color || 'gray' }
|
||||
}) || []
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
"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",
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ export const ArticleLock = props => {
|
||||
return <div id='container' className='w-full flex justify-center items-center h-96 font-sans'>
|
||||
<div className='text-center space-y-3'>
|
||||
<div className='font-bold'>{locale.COMMON.ARTICLE_LOCK_TIPS}</div>
|
||||
<div className='flex'>
|
||||
<div className='flex mx-4'>
|
||||
<input id="password" type='password' className='w-full text-sm pl-5 rounded-l transition font-light leading-10 text-black dark:bg-gray-500 bg-gray-50'></input>
|
||||
<div onClick={submitPassword} className="px-3 whitespace-nowrap cursor-pointer items-center justify-center py-2 rounded-r duration-300 bg-gray-300" >
|
||||
<i className={'duration-200 cursor-pointer fas fa-key dark:text-black'} > {locale.COMMON.SUBMIT}</i>
|
||||
|
||||
@@ -27,7 +27,7 @@ export const ArticleLock = props => {
|
||||
<div className="w-full flex justify-center items-center h-96 font-sans">
|
||||
<div className="text-center space-y-3">
|
||||
<div className='font-bold'>{locale.COMMON.ARTICLE_LOCK_TIPS}</div>
|
||||
<div className="flex">
|
||||
<div className="flex mx-4">
|
||||
<input
|
||||
id="password" type='password'
|
||||
className="w-full text-sm pl-5 rounded-l transition focus:shadow-lg dark:text-gray-300 font-light leading-10 text-black bg-gray-100 dark:bg-gray-500"
|
||||
|
||||
@@ -24,7 +24,7 @@ export const ArticleLock = props => {
|
||||
return <div id='container' className='w-full flex justify-center items-center h-96 '>
|
||||
<div className='text-center space-y-3'>
|
||||
<div className='font-bold'>{locale.COMMON.ARTICLE_LOCK_TIPS}</div>
|
||||
<div className='flex'>
|
||||
<div className='flex mx-4'>
|
||||
<input id="password" type='password' className='w-full text-sm pl-5 rounded-l transition focus:shadow-lg dark:text-gray-300 font-light leading-10 text-black bg-gray-100 dark:bg-gray-500'></input>
|
||||
<div onClick={submitPassword} className="px-3 whitespace-nowrap cursor-pointer items-center justify-center py-2 bg-indigo-500 hover:bg-indigo-400 text-white rounded-r duration-300" >
|
||||
<i className={'duration-200 cursor-pointer fas fa-key'} > {locale.COMMON.SUBMIT}</i>
|
||||
|
||||
@@ -25,7 +25,7 @@ export const ArticleLock = props => {
|
||||
return <div id='container' className='w-full flex justify-center items-center h-96 font-sans'>
|
||||
<div className='text-center space-y-3'>
|
||||
<div className='font-bold'>{locale.COMMON.ARTICLE_LOCK_TIPS}</div>
|
||||
<div className='flex'>
|
||||
<div className='flex mx-4'>
|
||||
<input id="password" type='password' className='w-full text-sm pl-5 rounded-l transition focus:shadow-lg dark:text-gray-300 font-light leading-10 text-black bg-gray-100 dark:bg-gray-500'></input>
|
||||
<div onClick={submitPassword} className="px-3 whitespace-nowrap cursor-pointer items-center justify-center py-2 bg-green-500 hover:bg-green-400 text-white rounded-r duration-300" >
|
||||
<i className={'duration-200 cursor-pointer fas fa-key'} > {locale.COMMON.SUBMIT}</i>
|
||||
|
||||
@@ -27,7 +27,7 @@ export const ArticleLock = props => {
|
||||
<div className="w-full flex justify-center items-center h-96 font-sans">
|
||||
<div className="text-center space-y-3">
|
||||
<div className='font-bold'>{locale.COMMON.ARTICLE_LOCK_TIPS}</div>
|
||||
<div className="flex">
|
||||
<div className="flex mx-4">
|
||||
<input
|
||||
id="password" type='password'
|
||||
className="w-full text-sm pl-5 transition focus:shadow-lg dark:text-gray-300 font-light leading-10 text-black bg-gray-100 dark:bg-gray-500"
|
||||
|
||||
@@ -25,7 +25,7 @@ export const Footer = (props) => {
|
||||
<div className="my-4 text-sm leading-6">
|
||||
<div className="flex align-baseline justify-between flex-wrap">
|
||||
<p>
|
||||
© {BLOG.author} {copyrightDate}
|
||||
© {BLOG.AUTHOR} {copyrightDate}
|
||||
</p>
|
||||
<Vercel />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user