Remove duplicate Vimeo DI registration; use NimblePros.Vimeo AddVimeoServices and upgrade package
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
Bắt đầu trong src/DevBetterWeb.Infrastructure/VimeoServiceCollectionExtensions.cs và Program.cs tại lời gọi AddInfrastructureServices(...) (~dòng 92) và AddVimeoServices (~dòng 148), cùng với factory Autofac đã bị chú thích ở dòng 45. Xóa tệp phần mở rộng cục bộ, bỏ lời gọi RegisterVimeoServicesDependencies và mọi tham số vimeoToken hiện không còn dùng, sau đó build và smoke test các luồng video quản trị (tải lên theo chunk, cập nhật mô tả, xóa, chi tiết, oEmbed). Hoàn tất nghĩa là chỉ có một đường đăng ký và không có client được đặt tên hay header trùng lặp; việc nâng cấp package lên 2.2.1 vẫn bị chặn bởi khóa API NuGet.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Background
When Autofac was removed (#1358), devBetter added its own IServiceCollection version of RegisterVimeoServicesDependencies in src/DevBetterWeb.Infrastructure/VimeoServiceCollectionExtensions.cs. NimblePros.Vimeo already ships the equivalent registration, services.AddVimeoServices(token). It wasn't documented, which is how NimblePros/NimblePros.Vimeo#16 came about. NimblePros/NimblePros.Vimeo#19 adds the documentation and tests.
devBetter currently runs both registrations:
Program.cs:92→AddInfrastructureServices(...)→ the localservices.RegisterVimeoServicesDependencies(vimeoToken)Program.cs:148→builder.Services.AddVimeoServices(vimeoSettings.Token)
Effects of the duplicate registration
- Named
HttpClients are configured twice.VimeoApi,VimeoOEmbedandVimeoTusApiare each registered by both methods, and both configure actions run. Default headers are added twice:Accepton every client, andTus-Resumableon the Tus client. - Two
ClientApiConfigurationssingletons. The last one registered wins, which is the one fromAddVimeoServices. The local configuration (default JSON settings, token on the Tus client) is effectively dead code. - The tus services are registered twice.
ISleepService,IUploadVideoSessionServiceandIUploadVideoTusServiceare each registered twice with the same implementation. This is harmless, but it's noise. AuthHeaderHandlerinVimeoServiceCollectionExtensions.csis never used. The bearer token is actually added byAddVimeoServices, on theVimeoApiclient only.
AddVimeoServices on its own registers everything devBetter needs:
- every Vimeo service, such as
GetVideoService,GetOEmbedVideoServiceandUploadVideoChunkService; - the NimblePros.ApiClient HTTP services;
- the three named clients, with the token attached to
VimeoApi; - the tus services and logging.
Tasks
- Delete
src/DevBetterWeb.Infrastructure/VimeoServiceCollectionExtensions.cs, including the unusedAuthHeaderHandler. - Remove
services.RegisterVimeoServicesDependencies(vimeoToken);fromAddInfrastructureServices, along with thevimeoTokenparameter if nothing else uses it. KeepAddVimeoServices(vimeoSettings.Token)inProgram.cs. - Remove the commented-out
AutofacServiceProviderFactoryline inProgram.cs:45. - Upgrade
NimblePros.Vimeofrom 2.1.2 to 2.2.1 once it is published (see below). The new version:- adds net10.0 and net11.0 targets (devBetter targets net11.0);
- updates dependencies;
- pins a patched
Microsoft.AspNetCore.WebUtilities(NimblePros.ApiClient 2.2.0 pulls in 9.0.4, which is affected by GHSA-x33c-w48q-qrgc); - makes the
VimeoTusApiclient set its base address andAcceptheader.
- Smoke test the admin video flows: chunked upload (
UploadChunkEndpoint), update description, delete, video details and oEmbed.
Behavior notes
Removing the local registration shouldn't change runtime behavior, apart from dropping the duplicated default headers:
- The JSON settings from
AddVimeoServices(NullValueHandling.Ignore) already win today. - The Tus client already sends no bearer token. Tus upload links are signed, so it isn't needed.
The package still depends on Autofac transitively, because AutofacExtensions ships in NimblePros.Vimeo. That's tracked as a possible follow-up there.
Blocker for the package upgrade
The NimblePros.Vimeo publish workflow is failing. nuget push returns 403: The specified API key is invalid, has expired, or does not have permission, so 2.2.0 was never published and nuget.org still has 2.1.2. The NUGET_API_KEY secret in NimblePros/NimblePros.Vimeo needs to be regenerated before the upgrade task can be done. The registration cleanup tasks don't depend on the upgrade and can be done now.
- Ngôn ngữ chính
- C#
- Star
- 157
- Fork
- 59
- Merge trung bình
- 3 giờ 12 phút
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DevBetterCom/DevBetterWeb
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
DevBetterCom/DevBetterWeb#1472 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
DevBetterCom/DevBetterWeb#1393 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
DevBetterCom/DevBetterWeb#1392 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
.NET enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
DevBetterCom/DevBetterWeb#1380 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
New Members Subscription Should Not Have End DateCó thể đã có người làm @ShadyNagy đã nhận 585 ngày trước. Đang mởbug
DevBetterCom/DevBetterWeb#1334 · 4 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của DevBetterCom/DevBetterWeb
Issue tương tự
-
[中] 更新器下载缓存从不清理Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NimblePros/eShopOnWeb#333 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Natvs/Nt.Automaton#33 ·
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Remove old asp.net core examplesĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100