Files
duplicati/Duplicati/WebserverCore/Extensions/ServiceCollectionsExtensions.cs
T
Kenneth SkovhedeandGitHub 7f40ec46db Removed the captcha. (#5816)
This commit removes the Captcha support, and replaces with a copy-paste-able safeguard in the UI.
2024-12-28 20:03:52 +01:00

54 lines
2.3 KiB
C#

using Duplicati.Library.IO;
using Duplicati.Library.RestAPI;
using Duplicati.Library.RestAPI.Abstractions;
using Duplicati.Server;
using Duplicati.Server.Database;
using Duplicati.Server.Serialization;
using Duplicati.WebserverCore.Abstractions;
using Duplicati.WebserverCore.Abstractions.Notifications;
using Duplicati.WebserverCore.Middlewares;
using Duplicati.WebserverCore.Notifications;
using Duplicati.WebserverCore.Services;
using Duplicati.WebserverCore.Services.Settings;
using WebserverCore.Services;
namespace Duplicati.WebserverCore.Extensions;
public static class ServiceCollectionsExtensions
{
public static IServiceCollection AddDuplicati(this IServiceCollection services, Connection connection)
{
//old part
services
.AddSingleton<LiveControls>()
.AddSingleton(Serializer.JsonSettings)
.AddSingleton<UpdatePollThread>()
.AddSingleton<EventPollNotify>()
.AddSingleton<Scheduler>()
.AddSingleton(connection);
//transitional part - services that act as a proxy to old part for various reasons (not accessible in assembly i.e.)
services.AddSingleton<ILiveControls>(c => c.GetRequiredService<LiveControls>());
//new part
services
.AddSingleton<ISettingsService, SettingsService>()
.AddTransient<IStatusService, StatusService>()
.AddTransient<IUpdateService, UpdateService>()
.AddSingleton<INotificationUpdateService, NotificationUpdateService>()
.AddSingleton<IWorkerThreadsManager, WorkerThreadsManager>()
.AddSingleton<IScheduler, SchedulerService>()
.AddSingleton<IWebsocketAccessor, WebsocketAccessor>()
.AddTransient<ILanguageService, LanguageService>()
.AddSingleton<ICommandlineRunService, CommandlineRunService>()
.AddTransient<IJWTTokenProvider, JWTTokenProvider>()
.AddTransient<ITokenFamilyStore, TokenFamilyStore>()
.AddTransient<ILoginProvider, LoginProvider>()
.AddSingleton<IRemoteController, RemoteControllerService>()
.AddSingleton<IRemoteControllerRegistration, RemoteControllerRegistrationService>()
.AddSingleton<ISystemInfoProvider, SystemInfoProvider>();
return services;
}
}