Remove duplicate Vimeo DI registration; use NimblePros.Vimeo AddVimeoServices and upgrade package

Open Beginner friendly
#1,486 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
backend

Research direction

Start in src/DevBetterWeb.Infrastructure/VimeoServiceCollectionExtensions.cs and Program.cs at the AddInfrastructureServices(...) call (~line 92) and AddVimeoServices (~line 148), plus the commented Autofac factory at line 45. Delete the local extension file, drop the RegisterVimeoServicesDependencies call and any now-unused vimeoToken parameter, then build and smoke test the admin video flows (chunked upload, description update, delete, details, oEmbed). Done means one registration path and no duplicate named clients or headers; the 2.2.1 package bump stays blocked on the NuGet API key.

Written by the indexing model from the issue text.

Description

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 local services.RegisterVimeoServicesDependencies(vimeoToken)
  • Program.cs:148 → builder.Services.AddVimeoServices(vimeoSettings.Token)

Effects of the duplicate registration

  • Named HttpClients are configured twice. VimeoApi, VimeoOEmbed and VimeoTusApi are each registered by both methods, and both configure actions run. Default headers are added twice: Accept on every client, and Tus-Resumable on the Tus client.
  • Two ClientApiConfigurations singletons. The last one registered wins, which is the one from AddVimeoServices. The local configuration (default JSON settings, token on the Tus client) is effectively dead code.
  • The tus services are registered twice. ISleepService, IUploadVideoSessionService and IUploadVideoTusService are each registered twice with the same implementation. This is harmless, but it's noise.
  • AuthHeaderHandler in VimeoServiceCollectionExtensions.cs is never used. The bearer token is actually added by AddVimeoServices, on the VimeoApi client only.

AddVimeoServices on its own registers everything devBetter needs:

  • every Vimeo service, such as GetVideoService, GetOEmbedVideoService and UploadVideoChunkService;
  • 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 unused AuthHeaderHandler.
  • Remove services.RegisterVimeoServicesDependencies(vimeoToken); from AddInfrastructureServices, along with the vimeoToken parameter if nothing else uses it. Keep AddVimeoServices(vimeoSettings.Token) in Program.cs.
  • Remove the commented-out AutofacServiceProviderFactory line in Program.cs:45.
  • Upgrade NimblePros.Vimeo from 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 VimeoTusApi client set its base address and Accept header.
  • 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.

Dominant language
C#
Stars
157
Forks
59
Avg merge
3h 12m
Merged PRs (30d)
4

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DevBetterCom/DevBetterWeb

All issues in DevBetterCom/DevBetterWeb

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.