gabrielcsapo / gabrielcsapo/node-git-server

Keeping context between calbacks

Đang mở
#94 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
262
Fork
81
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Bắt đầu bằng cách theo dõi callback authenticate được truyền vào hàm khởi tạo Git và listener của sự kiện push ở bước sau, tập trung vào GitAuthenticateOptions cùng dữ liệu context hoặc req được đề xuất. Xác định cách trạng thái dành riêng cho từng request nên được truyền giữa các callback này, sau đó xác minh rằng việc xác thực và xử lý push có thể liên kết cùng một request mà không thay đổi các thao tác Git không liên quan.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
git, nodejs, typescript
Lĩnh vực
api, backend
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.