mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
v4.2.4
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables
|
||||
NEXT_PUBLIC_VERSION=4.2.3
|
||||
NEXT_PUBLIC_VERSION=4.2.4
|
||||
|
||||
|
||||
# 可在此添加环境变量,去掉最左边的(# )注释即可
|
||||
|
||||
@@ -18,10 +18,7 @@ export async function getPostBlocks(id, from, slice) {
|
||||
return filterPostBlocks(id, pageBlock, slice)
|
||||
}
|
||||
|
||||
const start = new Date().getTime()
|
||||
pageBlock = await getPageWithRetry(id, from)
|
||||
const end = new Date().getTime()
|
||||
console.log('[API耗时]', `${end - start}ms`)
|
||||
|
||||
if (pageBlock) {
|
||||
await setDataToCache(cacheKey, pageBlock)
|
||||
@@ -38,10 +35,7 @@ export async function getSingleBlock(id, from) {
|
||||
return pageBlock
|
||||
}
|
||||
|
||||
const start = new Date().getTime()
|
||||
pageBlock = await getPageWithRetry(id, from)
|
||||
const end = new Date().getTime()
|
||||
console.log('[API耗时]', `${end - start}ms`)
|
||||
|
||||
if (pageBlock) {
|
||||
await setDataToCache(cacheKey, pageBlock)
|
||||
@@ -56,16 +50,17 @@ export async function getSingleBlock(id, from) {
|
||||
*/
|
||||
export async function getPageWithRetry(id, from, retryAttempts = 3) {
|
||||
if (retryAttempts && retryAttempts > 0) {
|
||||
console.log('[请求API]', `from:${from}`, `id:${id}`, retryAttempts < 3 ? `剩余重试次数:${retryAttempts}` : '')
|
||||
console.log('[API-->>请求]', `from:${from}`, `id:${id}`, retryAttempts < 3 ? `剩余重试次数:${retryAttempts}` : '')
|
||||
try {
|
||||
const authToken = BLOG.NOTION_ACCESS_TOKEN || null
|
||||
const api = new NotionAPI({ authToken, userTimeZone: Intl.DateTimeFormat().resolvedOptions().timeZone })
|
||||
const start = new Date().getTime()
|
||||
const pageData = await api.getPage(id)
|
||||
// console.log('stringfy', JSON.stringify(pageData))
|
||||
console.info('[响应成功]:', `from:${from}`)
|
||||
const end = new Date().getTime()
|
||||
console.log('[API<<--响应]', `耗时:${end - start}ms - from:${from}`)
|
||||
return pageData
|
||||
} catch (e) {
|
||||
console.warn('[响应异常]:', e)
|
||||
console.warn('[API<<--异常]:', e)
|
||||
await delay(1000)
|
||||
const cacheKey = 'page_block_' + id
|
||||
const pageBlock = await getDataFromCache(cacheKey)
|
||||
|
||||
@@ -94,7 +94,7 @@ module.exports = withBundleAnalyzer({
|
||||
// }
|
||||
// 动态主题:添加 resolve.alias 配置,将动态路径映射到实际路径
|
||||
if (!isServer) {
|
||||
console.log('加载默认主题', path.resolve(__dirname, 'themes', THEME))
|
||||
console.log('[加载主题]', path.resolve(__dirname, 'themes', THEME))
|
||||
}
|
||||
config.resolve.alias['@theme-components'] = path.resolve(__dirname, 'themes', THEME)
|
||||
return config
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "notion-next",
|
||||
"version": "4.2.3",
|
||||
"version": "4.2.4",
|
||||
"homepage": "https://github.com/tangly1024/NotionNext.git",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
Reference in New Issue
Block a user