Repository navigation
新增公开图库:创作者自愿申请、维护者用脚本审核后展示 - #48
Conversation
- 发布对话框新增“同时申请展示到公开图库”,仅“永不过期”的分享可勾选; “我的分享”里可查看图库状态、申请或撤出。 - Worker 新增 GET|PUT|DELETE /api/shares/:id/gallery(凭私人撤销密钥)、 GET /api/gallery(分页列出已通过作品)和 POST /api/shares/:id/report。 撤销分享会立即从图库消失;同一已展示作品被 3 位不同访客举报后自动退回待审。 - 迁移 0007:shared_artworks 增加 gallery_* 字段,新建 share_reports; 健康检查覆盖新表和新字段,定时任务清理已撤销分享的举报。 - 新增 /gallery 页面、分享页举报入口、设置面板入口,文案覆盖 8 种语言。 - 新增 scripts/gallery-review.mjs(npm run gallery:review):通过 wrangler 直接在 D1 上逐条审核、通过、拒绝、清除举报或彻底下架,无需管理接口。 - 文档:分享文档、运维手册、README 和隐私政策同步更新。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FspVTmN6NY7LBGQ6yRxtSP
- 发布流程保持匿名不变。登录状态下发布成功后,浏览器用已保存的撤销密钥 证明所有权,调用 POST /api/me/shares/claim 把分享绑定到账号 (迁移 0008 新增 owner_user_id)。 - 新增账号接口:GET /api/me/shares 列出作品,DELETE /api/me/shares/:id 无需密钥即可撤销,PUT|DELETE /api/me/shares/:id/gallery 申请或撤出图库。 原先凭密钥操作图库的 /api/shares/:id/gallery 已移除。 - “我的分享”和账户页新增“我的作品”,换设备也能查看和撤销;当前浏览器里 未登录时发布的作品可一键并入账号。 - 申请入库必须登录;审核脚本显示提交账号和邮箱,只通过属于账号的作品。 - 匿名用户的撤销密钥备份按钮收进“备份撤销密钥”折叠项,相关提示改为 “可随时在此浏览器撤销”,8 种语言同步。 - 文档、运维手册、README 和隐私政策同步更新。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FspVTmN6NY7LBGQ6yRxtSP
mingzhangyang
left a comment
There was a problem hiding this comment.
GPR review — HEAD 7c496fb
Scope: Initial targeted audit of the gallery/ownership APIs, account and publish UI, visitor-report lifecycle, D1 migrations, moderation SQL/CLI, docs and relevant test coverage.
Findings: 0 P0, 0 P1, 3 P2, 0 P3. Two findings are inline; the third is below.
[P2] Make the report threshold transition atomic or repairable on retry — worker/gallery.ts, reportShare, if (inserted.meta.changes === 1). The INSERT commits separately from the status UPDATE. If the third distinct report is persisted but the UPDATE throws (or the invocation terminates), a retry from the same visitor gets zero inserted rows and skips the UPDATE, returning 202 while the artwork remains listed with three reports. Use an atomic D1 batch/trigger for insertion and conditional hide, or always re-evaluate the threshold on duplicate retries. Add a regression simulating persisted threshold reports with status still listed, then retrying an existing reporter.
Verification: Isolated local SQLite reproductions of the account list cap and no-op approval deleting reports both reproduced; simulated interrupted report write also reproduced the skipped hide on duplicate retry. These are SQL-level reproductions, not full D1/browser integration tests. No prior inline threads in the snapshot.
Limits: The local runtime could not resolve github.com for a checkout; npm run verify and browser tests were not run. Full 38-file coverage (including localization and complete CLI) is not verified. This is a partial comment review, not an approval. No CI triggered.
- /api/me/shares 改为游标分页(默认 50、最多 100 条,返回 nextCursor), 列表新增“加载更多”,超过 200 件的作品也都能找到、撤销和撤出图库。 - 新增 POST /api/me/shares/owned,按 ID 查询哪些分享属于当前账号(不分状态), 本地分享是否已并入账号不再依赖当前显示的那一页。 - 举报不再在审核时删除:通过、拒绝、下架或清除举报都会记录 gallery_reviewed_at,之前的举报视为已处理,之后的仍有效。approve 成为 单条原子 UPDATE,只影响本次真正通过的作品;对已展示作品重复执行 approve 不会抹掉新举报。举报被处理过的访客可以再次举报。定时任务清理已处理的举报。 - 新增回归测试:205 件作品分页、跨页归属查询、已展示作品+新举报、 混合批量 approve、dismiss 与清理。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FspVTmN6NY7LBGQ6yRxtSP
mingzhangyang
left a comment
There was a problem hiding this comment.
GPR incremental re-review: dc96d8b. Pagination and independent ownership lookup address the first thread; single conditional approve UPDATE addresses the no-op approval thread. Prior P2 remains: worker/gallery.ts reportShare still commits INSERT separately and gates the hide UPDATE on inserted.meta.changes === 1. Duplicate retry cannot repair an interrupted threshold transition. New P2 inline. Partial audit: full suite not independently run; prior full-file coverage incomplete. No CI triggered.
- 迁移 0009:shared_artworks 新增 gallery_review_generation,share_reports 新增 review_generation。每次审核(通过、拒绝、下架、清除举报)在同一条 UPDATE 中递增代次;举报记录提交时的代次,两者相等即为未处理。由写入顺序 决定、不受秒级 CURRENT_TIMESTAMP 影响;迁移按原时间规则回填已处理的举报。 - 举报写入与阈值检查放进同一个原子 D1 batch,且每次举报都重新检查阈值, 重复举报可补完此前中断的隐藏操作。 - 测试去掉时间回拨,新增同一秒内“举报→审核→再举报”的顺序测试、 中断后重试补完阈值的回归测试,以及迁移 0009 回填的单元测试。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FspVTmN6NY7LBGQ6yRxtSP
mingzhangyang
left a comment
There was a problem hiding this comment.
GPR incremental re-review — ef44b10. Both outstanding P2 findings verified fixed by inspection: report insertion and unconditional threshold check now share an atomic D1 batch; generation-based review ordering is consistent across moderation SQL, upsert, threshold, maintenance and migration. Regression tests cover same-second ordering, duplicate retry repair and migration backfill. No new actionable findings in inspected delta (0 P0/P1/P2/P3). Prior pagination and no-op approval fixes remain intact. Partial review: repository-wide coverage and full test execution not independently verified; PR reports 349 frontend and 69 Worker tests passing. No CI triggered.
- 举报者标识与举报限流键改为以 SHARE_REPORT_SECRET 为密钥的 HMAC-SHA-256; 密钥缺失或短于 32 字符时举报返回 503,/api/health/sharing 报告 SHARE_REPORTS_UNCONFIGURED - IPv6 地址按 /64 计为同一访客,阈值与限流都按网络计算 - 定时清理删除超过 90 天的未处理举报;隐私页同步说明 - 认领接口返回 ownedElsewhere;浏览器记住已归属其他账号的作品, 不再反复提示并入,并复查既未并入也不属于他人的作品状态 - 0007、0008 尚未上线,把审核代次字段并入 0007,删除 0009 及其回填测试 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- 导航轨标签改为屏幕阅读器文字,仍作为标签页和标签面板的可访问名称; 悬停或键盘聚焦时显示完整标题提示。导航轨宽度由 72px 收窄到 64px。 - 导航轨底部新增公开图库链接。它会离开编辑器,所以放在标签列表之外, 是链接而不是标签页。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FspVTnR4EfSetCMXy2wz6z
…-ynn8rs # Conflicts: # README.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FspVTnR4EfSetCMXy2wz6z
mingzhangyang
left a comment
There was a problem hiding this comment.
GPR incremental re-review of HEAD 20de3a48 (previous ef44b10). The prior pagination/ownership, no-op approve, same-second generation ordering and interrupted threshold transition issues remain addressed by inspection. HMAC reporter IDs, IPv6 /64 grouping and retention cleanup are implemented; migration generation fields are now in 0007. Three existing inline threads are already resolved. Two new findings below (1 P2, 1 P3; no P0/P1). Partial review: the local runtime cannot resolve github.com, so no independent full suite/browser tests were run. PR description reports 360 frontend and 72 Worker tests passing; CI run 46084155743 was in progress when inspected. No CI triggered.
Review findings repair report — code delivered; full validation pending
|
mingzhangyang
left a comment
There was a problem hiding this comment.
Incremental GPR re-review of f8a38b4: both previous findings are verified fixed. Recovery now completes the original account/gallery intent, with session checks and mutually guarded revoke/retry. Local ownership filtering is scoped to the active account, with keyed account list. Three new Playwright regressions cover recovery, account switch and failed ownership lookup/sign-out. No new actionable findings in the delta. Static review only; tests not independently executed, CI 46087486266 in progress. Prior full-audit limitations remain. No CI triggered.
|
Fixed CI lint failure in abf6307: removed redundant initial assignment of |
概要
新增公开图库(
/gallery),并让登录用户发布的分享归属到账号,可以在任何设备上管理。匿名发布保留,撤销密钥的提示被弱化;申请进入图库必须登录,所有投稿由维护者用脚本审核后才会展示。另外,桌面导航轨改为只显示图标,并在底部加入公开图库入口。登录用户:分享归属账号
POST /api/me/shares/claim把分享绑定到账号(新增字段owner_user_id)。GET /api/me/shares?cursor=&limit=:分页列出作品,默认 50 件、最多 100 件,返回nextCursorPOST /api/me/shares/owned:按 ID 查询哪些分享属于当前账号,与当前显示哪一页无关POST /api/me/shares/claim:用撤销密钥认领分享,每次最多 50 件;返回claimed和ownedElsewhere(密钥匹配但已归属其他账号)DELETE /api/me/shares/:id:撤销分享PUT|DELETE /api/me/shares/:id/gallery:申请或撤出图库匿名用户
公开图库
GET /api/gallery:分页列出已通过的作品,缩略图使用现有的card.jpg。作品被撤销后会立即从图库消失。/gallery页面,桌面导航轨底部、设置面板和分享页底部都有入口。POST /api/shares/:id/report),按网络限流,每位访客对同一作品只计一次。访客按 IPv4 地址或 IPv6 的 /64 网段计算;存储的举报者标识和限流键都是以 Worker 密钥SHARE_REPORT_SECRET为密钥的 HMAC,无法通过逐个试算地址还原 IP。桌面导航轨:只显示图标
审核脚本
npm run gallery:review通过 wrangler 直接读写 D1,不需要任何管理接口:pending/listed/reports/show:查看列表或单件作品approve/reject/dismiss/remove:批量操作脚本会显示每件投稿来自哪个账号及其邮箱,只通过属于账号的作品。打印前会去掉标题和作者中的终端控制字符。
部署前
/api/health/sharing报告SHARE_REPORTS_UNCONFIGURED:openssl rand -hex 32 | npx wrangler secret put SHARE_REPORT_SECRET0007_share_gallery.sql:在shared_artworks上新增gallery_*字段和审核代次gallery_review_generation,新建share_reports表(含review_generation)0008_share_owners.sql:新增owner_user_id及索引两个迁移都只新增、不修改已有结构。
/api/health/sharing的健康检查已覆盖新字段和新表,迁移未执行时会报告未就绪。已处理的审查意见
owned接口,不再依赖当前显示的页。approve会误删新举报:审核时不再删除举报,approve改为单条原子 UPDATE,只影响本次真正通过的作品。ownedElsewhere,浏览器记住并提示;既未并入也不属于他人的作品会重新检查状态。测试
main(装饰可贴近画布边缘:按可见内容交互,留白只约束文字 #47),解决了 README 冲突。npm run verify通过:前端单元测试 360 个,Worker 测试 72 个。approve、同一秒内的举报与审核顺序、中断后重试补完阈值、dismiss与定时清理。审核脚本的 SQL 直接在迁移后的 D1 上执行测试。ownedElsewhere只在密钥匹配时返回。public-gallery.spec.ts,覆盖匿名发布、登录发布并入库、加载更多、并入账号和图库页面,以及“作品归属其他账号时,认领一次后不再提示”。sidebar-navigation.spec.ts新增两个用例:标签文字不占可见空间、悬停和键盘聚焦都显示完整标题且提示浮在面板之上;图库链接在标签列表之外、位于设置下方并能打开/gallery。sidebar-navigation、public-gallery、share-links、editor-draft-safety、custom-template-save-navigation、seal-*合计 102 个通过,26 个手机端重复用例按设计跳过。/gallery展示 → 举报”的完整流程,并在桌面、412 px 和 360 px 宽度下截图检查。审核脚本也在本地 D1 上跑过。导航轨在 1280 px 宽度下用英文和中文截图检查。文档
docs/shareable-artwork-links.md(含图库入口位置)、docs/operations-runbook.md(新增“Public gallery review”一节)、README 和隐私政策页均已同步更新。🤖 Generated with Claude Code
https://claude.ai/code/session_01FspVTmN6NY7LBGQ6yRxtSP
https://claude.ai/code/session_01FspVTnR4EfSetCMXy2wz6z