Remove duplicate Vimeo DI registration; use NimblePros.Vimeo AddVimeoServices and upgrade package
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 src/DevBetterWeb.Infrastructure/VimeoServiceCollectionExtensions.cs 和 Program.cs 中的 AddInfrastructureServices(...) 调用(约第 92 行)以及 AddVimeoServices(约第 148 行)开始,另外还有第 45 行被注释掉的 Autofac 工厂。删除本地扩展文件,去掉 RegisterVimeoServicesDependencies 调用以及任何现在不再使用的 vimeoToken 参数,然后构建并对管理端视频流程(分块上传、描述更新、删除、详情、oEmbed)进行冒烟测试。完成意味着只有一条注册路径,且没有重复的命名客户端或标头;2.2.1 包升级仍因 NuGet API 密钥而受阻。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- C#
- 星标
- 157
- 派生
- 59
- 平均合并
- 3 小时 12 分钟
- 30 天内合并 PR
- 4
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
DevBetterCom/DevBetterWeb 的其他 Issue
-
难度 5/5 一周以上 新手友好度 35/100
DevBetterCom/DevBetterWeb#1472 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 20/100
DevBetterCom/DevBetterWeb#1393 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 35/100
DevBetterCom/DevBetterWeb#1392 ·
维护者通常 1 天内回复
-
.NET enhancement
难度 5/5 一周以上 新手友好度 35/100
DevBetterCom/DevBetterWeb#1380 ·
维护者通常 1 天内回复
-
New Members Subscription Should Not Have End Date可能已有人在做 @ShadyNagy 于 585 天前认领。 未关闭bug
DevBetterCom/DevBetterWeb#1334 · 4 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 DevBetterCom/DevBetterWeb 的全部 Issue
相似的 Issue
-
[中] 更新器下载缓存从不清理未关闭
难度 2/5 1-3 小时 新手友好度 72/100
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
NimblePros/eShopOnWeb#333 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
Natvs/Nt.Automaton#33 ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 62/100