Skip to content

feat(article-lock): SHA256 文章锁摘要,兼容旧 md5(承接 #3389)#4022

Merged
tangly1024 merged 1 commit into
mainfrom
feat/article-password-sha256-3389
May 9, 2026
Merged

feat(article-lock): SHA256 文章锁摘要,兼容旧 md5(承接 #3389)#4022
tangly1024 merged 1 commit into
mainfrom
feat/article-password-sha256-3389

Conversation

@tangly1024
Copy link
Copy Markdown
Collaborator

背景

承接 PR #3389(分支过久冲突):在原意图上重新实现并兼容主线。

行为说明

  • 同步侧(getPageProperties):Notion 内为明文时,写入页面的 \password\ 为 SHA256(明文) hex;若字段已是 64 位 hex 则视为预填摘要;若为 32 位 hex 则视为旧 md5(slug+明文) 摘要并保留。
  • 校验侧(\pages/[prefix]/index.js\):依次比对 SHA256(输入)md5(slug+输入),旧文章无需改密码即可解锁。
  • localStorage:写入键改为 仅 pathname(\getPasswordStoragePath\),与 \getPasswordQuery\ 读取一致,修复 URL 带 ?\ / #\ 时无法自动解锁的问题。
  • Gravatar:Nobelium/Plog 等处仍使用 md5(email),未改为 SHA256(避免破坏头像 URL)。

依赖

  • 新增 \js-sha256\(轻量、同步 API)。

关联

请在合并 #3389 前在其下留言说明已由本 PR 承接。

Made with Cursor

- Notion 明文密码同步为 SHA256(hex);支持字段内直接填 64 位 SHA256;保留 32 位 md5 串视为旧摘要\n- 前台校验:同时尝试 SHA256(明文) 与 md5(slug+明文)\n- localStorage 键改为 pathname only,与 getPasswordQuery 一致\n- 新增依赖 js-sha256;Gravatar 等仍使用 md5(email),未改动

Co-authored-by: Cursor <cursoragent@cursor.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 8, 2026

Deploying notionnext-seo-lesson with  Cloudflare Pages  Cloudflare Pages

Latest commit: 54c61f5
Status: ✅  Deploy successful!
Preview URL: https://d9a8319a.notionnext-seo-lesson.pages.dev
Branch Preview URL: https://feat-article-password-sha256.notionnext-seo-lesson.pages.dev

View logs

@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
notion-next-home Ready Ready Preview, Comment May 8, 2026 1:58pm
notion-next-preview Ready Ready Preview, Comment May 8, 2026 1:58pm

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying notionnext-blog with  Cloudflare Pages  Cloudflare Pages

Latest commit: 54c61f5
Status: ✅  Deploy successful!
Preview URL: https://786560f3.notionnext-db5.pages.dev
Branch Preview URL: https://feat-article-password-sha256.notionnext-db5.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying notionnext-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 54c61f5
Status: ✅  Deploy successful!
Preview URL: https://7de9ed13.notionnext-docs.pages.dev
Branch Preview URL: https://feat-article-password-sha256.notionnext-docs.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying notionnext-movie with  Cloudflare Pages  Cloudflare Pages

Latest commit: 54c61f5
Status: ✅  Deploy successful!
Preview URL: https://58892041.notionnext-movie.pages.dev
Branch Preview URL: https://feat-article-password-sha256.notionnext-movie.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying notionnext-game with  Cloudflare Pages  Cloudflare Pages

Latest commit: 54c61f5
Status:🚫  Build failed.

View logs

@tangly1024 tangly1024 merged commit 3b1437a into main May 9, 2026
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant