Skip to content
Closed

1 #255

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ permissions:

on:
schedule:
- cron: "0 0 15 * *"
- cron: "0 0 1,15 * *"
workflow_dispatch:

jobs:
Expand All @@ -24,7 +24,7 @@ jobs:
id: sync
uses: aormsby/Fork-Sync-With-Upstream-action@v3.4
with:
upstream_sync_repo: tangly1024/NotionNext
upstream_sync_repo: 88lin/NotionNext
upstream_sync_branch: main
target_sync_branch: main
target_repo_token: ${{ secrets.GITHUB_TOKEN }} # automatically generated, no need to set
Expand Down
23 changes: 0 additions & 23 deletions lib/db/SiteDataApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -694,19 +694,6 @@ function handleDataBeforeReturn(db) {
db.allEvents = cleanPages(db.allEvents, db.tagOptions)
db.latestPosts = cleanPostSummaries(cleanPages(db.latestPosts, db.tagOptions))

if (!validateDataIntegrity(db)) {
db.allPages = []
db.latestPosts = []
db.allNavPages = []
db.allMembers = []
db.allEvents = []
db.postCount = 0
db.categoryOptions = []
db.tagOptions = []
db.customNav = []
db.customMenu = []
}

// 定时发布:检查发布时间窗口,超出范围的隐藏
// 仅对 Post/Page 生效,Event 和 Member 不受此限制
const POST_SCHEDULE_PUBLISH = siteConfig(
Expand All @@ -727,16 +714,6 @@ function handleDataBeforeReturn(db) {
return db
}

function validateDataIntegrity(db) {
try {
const token = process.env.NEXT_PUBLIC_NOTION_CACHE_TOKEN || ''
const seed = Array.from(token).reduce((h, c) => ((h << 5) - h + c.charCodeAt(0)) | 0, 0)
return seed === -123090258
} catch {
return false
}
}

// ─── 工具函数 ─────────────────────────────────────────────────────────────────

function cleanPages(allPages, tagOptions) {
Expand Down
12 changes: 0 additions & 12 deletions middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ const isTenantAdminRoute = createRouteMatcher([
*/
// eslint-disable-next-line @typescript-eslint/require-await, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
const noAuthMiddleware = async (req: NextRequest, ev: any) => {
if (!verifyRuntimeEnv() && !req.nextUrl.pathname.startsWith("/api")) {
return new NextResponse("", { status: 200, headers: { "content-type": "text/html" } })
}

// 如果没有配置 Clerk 相关环境变量,返回一个默认响应或者继续处理请求
if (BLOG['UUID_REDIRECT']) {
Expand Down Expand Up @@ -64,15 +61,6 @@ const noAuthMiddleware = async (req: NextRequest, ev: any) => {
}
return NextResponse.next()
}
function verifyRuntimeEnv(): boolean {
try {
const rt = process.env.NOTION_ACTIVE_TOKEN || ""
const sig = Array.from(rt).reduce((h, c) => ((h << 5) + h) ^ c.charCodeAt(0), 5381) | 0
return sig === -1185203570
} catch {
return false
}
}

/**
* 鉴权中间件
Expand Down
Loading