Repository navigation
fix(oauth): 客户端元数据文档只在精确地址提供,缓存 5 分钟 - #87
Merged
Merged
Conversation
- /oauth/clients/* 的 Cache-Control 改为 public, max-age=300(原为 Vercel 默认的 max-age=0)。 - 末尾带斜杠的地址 308 到精确地址,不再直接返回文档。 - 新增 oauth-client-metadata-plugin:构建非默认语言时删除 static/ 复制进来的 oauth/ 副本,/en/oauth/clients/... 返回 404。 文档 URL 本身就是公开的 client_id,别名地址不是身份(desirecore/desirecore#5724、ADR-341)。
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明 / Description
/oauth/clients/desirecore-desktop-v1.json是 DesireCore 桌面端的 MCP OAuth 客户端元数据文档(CIMD):文档的 URL 本身就是公开的 client_id,授权服务器按这个精确地址读取(desirecore/desirecore#5724、ADR-341)。本 PR 只处理站点上这条路径,不改文档内容、不改其他页面。/oauth/clients/:file的Cache-Control由 Vercel 默认的public, max-age=0, must-revalidate改为public, max-age=300(vercel.json的headers)。/oauth/clients/<文件>/现在 308 到不带斜杠的精确地址,不再直接返回 200 文档(vercel.json的redirects,只匹配这一层路径,不影响站点其他 URL 的斜杠行为)。/en/副本:Docusaurus 构建每个非默认语言时会把static/原样复制进build/<locale>/,所以/en/oauth/clients/...也返回同一份文档。新增plugins/oauth-client-metadata-plugin.ts,只在非默认语言的postBuild删除输出目录里的oauth/(路径断言在输出目录内),这些地址改为 404。The CIMD document URL is the public client_id, so aliases are not identities. This PR sets
Cache-Control: public, max-age=300for/oauth/clients/:file, 308-redirects the trailing-slash variant to the exact URL, and removes theoauth/copy that Docusaurus places into non-default locale builds so/en/oauth/clients/...returns 404. Document content is unchanged.测试方式 / Test Plan
node_modules的 Docusaurus 3.9.2 搭最小双语站点(zh-Hans + en,只挂本插件),docusaurus build --no-minify成功:日志已从 en 输出移除 /oauth/ 副本,build/oauth/clients/desirecore-desktop-v1.json保留且 MD5 仍为aaf561fbedc1628a4edfee1a63a6b375,build/en/下没有oauth/。vercel.json按https://openapi.vercel.sh/vercel.json官方 Schema 校验通过。application/json、438 字节、MD5 不变、Cache-Control: public, max-age=300;带斜杠地址 308 到精确地址;/en/地址 404。预览部署有访问保护,匿名 curl 看不到内容,所以只能在生产核对。Verified with a minimal bilingual Docusaurus 3.9.2 site using this plugin (en copy removed, default copy byte-identical) and the official Vercel schema. Production headers will be re-checked after merge because preview deployments are access-protected.
检查清单 / Checklist
跟踪 / Tracking https://github.com/desirecore/desirecore/issues/5724