Remove duplicate Vimeo DI registration; use NimblePros.Vimeo AddVimeoServices and upgrade package
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
調査の方向性
src/DevBetterWeb.Infrastructure/VimeoServiceCollectionExtensions.cs と Program.cs の AddInfrastructureServices(...) 呼び出し(~92 行目)と AddVimeoServices(~148 行目)、さらに 45 行目のコメントアウトされた Autofac ファクトリから開始します。ローカルの拡張ファイルを削除し、RegisterVimeoServicesDependencies 呼び出しと、不要になった vimeoToken パラメーターがあればそれを削除してから、ビルドして管理画面の動画フロー(チャンクアップロード、説明の更新、削除、詳細、oEmbed)をスモークテストします。完了条件は、登録経路が 1 つであること、および名前付きクライアントやヘッダーの重複がないことです。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分
- マージ済み PR(30日)
- 4
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DevBetterCom/DevBetterWeb のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 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 1週間以上 初心者へのやさしさ 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