Repository navigation
实现抓取节点令牌的管理 - #93
Merged
Merged
实现抓取节点令牌的管理#93
Conversation
线上的抓取节点令牌要由站长在系统设置里生成和作废,不能只靠本地的 pnpm crawler-token(总体设计 §6.2)。
- 接口 GET、POST /admin/crawler-tokens,POST /admin/crawler-tokens/{id}/revoke:只有站长能调;生成时令牌只返回这一次,作废马上生效;生成和作废记进操作日志
- 页面 /admin/settings 的「抓取节点令牌」一节:生成后把令牌显示一次,作废前在页面上确认;站长的导航里有「系统设置」
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.
关联
Closes #39
改了什么
抓取节点用令牌调网站的接口(接口 §6)。线上的令牌要由站长在系统设置里生成和作废,不能只靠本地的
pnpm crawler-token(总体设计 §6.2)。GET /admin/crawler-tokens:名字、生成时间、上次来领活、作废时间,新的在前。POST /admin/crawler-tokens:写个名字(用在哪个抓取节点),返回的令牌只出现这一次,库里只存 SHA-256。POST /admin/crawler-tokens/{id}/revoke:作废,马上生效:抓取节点每个请求都按令牌查一次,作废后的请求返回 401。已经作废的返回409 already_revoked。audit_log(target_type是crawler_token,带名字)。pnpm crawler-token是本地用的,没有登录的人,不记日志。/admin/settings:「抓取节点令牌」一节。?revoke=显示确认,不用浏览器的弹窗)。crawler_tokens归ingest,函数在ingest/service.ts,接口在ingest/token-routes.ts。怎么验证的
pnpm check全部通过。新测试覆盖:pnpm openapi后openapi/crawler.json没变。影响