gabrielcsapo / gabrielcsapo/node-git-server
Keeping context between calbacks
- 主要语言
- TypeScript
- 星标
- 262
- 派生
- 81
- PR 合并指标
- 30 天内没有已合并 PR
描述
We have a `get-user-repo-access-info` procedure which is asynchronous - we run this in the `authenticate` callback as passed into the `Git` constructor. We do this to deny access to users before this library even looks for a git repo to use. However when we then get to the `push` event listener we're struggling to see how we can equate the original request with this specific callback. There is no shared state passed into the listener.
Would you be willing to help us rectify this? Honestly I'd be fine with just adding `http.IncomingMessage` to the `GitAuthenticateOptions` as `req` - I can then just add a property to that object :shrug:
It looks as though you've maybe kept the `authenticate` callback to accept the bare minimum of information though - if there's a specific reason for that perhaps we could add an empty `context` object to the `authenticate` callback which can then be passed to later event handlers. Avoiding giving the authenticate method any additional data to be mis-understood or used.
Thanks for the very helpful library, happy to open a PR for this, just wanted an idea of what is more likely to be merged.
贡献指南
这个仓库没有索引到贡献指南
调研方向
首先跟踪传递给 Git 构造函数的 authenticate 回调以及后续的 push 事件监听器,重点关注 GitAuthenticateOptions 和提议的 context 或 req 数据。定义请求特定状态应如何在这些回调之间传递,然后验证身份验证和 push 处理能够关联同一个请求,同时不改变无关的 Git 操作。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- git, nodejs, typescript
- 领域
- api, backend
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100