a fork of iceshrimp.net but a tweaked frontend to my personal liking. waow
fediverse social-media social iceshrimp fedi
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[backend/core] Migrate service & configuration registration to Iceshrimp.Utils.DependencyInjection

+99 -193
+1 -1
Iceshrimp.Backend/Components/PublicPreview/Attributes/PublicPreviewRouteFilter.cs
··· 1 1 using AngleSharp.Io; 2 - using Iceshrimp.Backend.Core.Extensions; 2 + using Iceshrimp.Utils.DependencyInjection; 3 3 using Microsoft.AspNetCore.Routing.Matching; 4 4 5 5 namespace Iceshrimp.Backend.Components.PublicPreview.Attributes;
+1 -1
Iceshrimp.Backend/Components/PublicPreview/Renderers/MfmRenderer.cs
··· 1 1 using Iceshrimp.Backend.Components.PublicPreview.Schemas; 2 2 using Iceshrimp.Backend.Core.Database.Tables; 3 - using Iceshrimp.Backend.Core.Extensions; 4 3 using Iceshrimp.Backend.Core.Helpers.LibMfm.Conversion; 5 4 using Iceshrimp.Backend.Core.Services; 6 5 using Iceshrimp.MfmSharp; 6 + using Iceshrimp.Utils.DependencyInjection; 7 7 using JetBrains.Annotations; 8 8 using Microsoft.AspNetCore.Components; 9 9
+1
Iceshrimp.Backend/Components/PublicPreview/Renderers/NoteRenderer.cs
··· 4 4 using Iceshrimp.Backend.Core.Database.Tables; 5 5 using Iceshrimp.Backend.Core.Extensions; 6 6 using Iceshrimp.Backend.Core.Services; 7 + using Iceshrimp.Utils.DependencyInjection; 7 8 using Microsoft.EntityFrameworkCore; 8 9 using Microsoft.Extensions.Options; 9 10
+1 -1
Iceshrimp.Backend/Components/PublicPreview/Renderers/UserRenderer.cs
··· 2 2 using Iceshrimp.Backend.Core.Configuration; 3 3 using Iceshrimp.Backend.Core.Database; 4 4 using Iceshrimp.Backend.Core.Database.Tables; 5 - using Iceshrimp.Backend.Core.Extensions; 5 + using Iceshrimp.Utils.DependencyInjection; 6 6 using Microsoft.EntityFrameworkCore; 7 7 using Microsoft.Extensions.Options; 8 8
+1
Iceshrimp.Backend/Controllers/Federation/ActivityPubController.cs
··· 12 12 using Iceshrimp.Backend.Core.Middleware; 13 13 using Iceshrimp.Backend.Core.Queues; 14 14 using Iceshrimp.Backend.Core.Services; 15 + using Iceshrimp.Utils.DependencyInjection; 15 16 using Microsoft.AspNetCore.Mvc; 16 17 using Microsoft.AspNetCore.OutputCaching; 17 18 using Microsoft.EntityFrameworkCore;
+1
Iceshrimp.Backend/Controllers/Mastodon/Renderers/AnnouncementRenderer.cs
··· 4 4 using Iceshrimp.Backend.Core.Database.Tables; 5 5 using Iceshrimp.Backend.Core.Extensions; 6 6 using Iceshrimp.Backend.Core.Helpers.LibMfm.Conversion; 7 + using Iceshrimp.Utils.DependencyInjection; 7 8 using Microsoft.EntityFrameworkCore; 8 9 using Microsoft.Extensions.Options; 9 10
+1 -1
Iceshrimp.Backend/Controllers/Mastodon/Renderers/AttachmentRenderer.cs
··· 1 1 using Iceshrimp.Backend.Controllers.Mastodon.Schemas.Entities; 2 2 using Iceshrimp.Backend.Core.Database.Tables; 3 - using Iceshrimp.Backend.Core.Extensions; 4 3 using Iceshrimp.Backend.Core.Services; 4 + using Iceshrimp.Utils.DependencyInjection; 5 5 6 6 namespace Iceshrimp.Backend.Controllers.Mastodon.Renderers; 7 7
+1
Iceshrimp.Backend/Controllers/Mastodon/Renderers/NoteRenderer.cs
··· 7 7 using Iceshrimp.Backend.Core.Helpers; 8 8 using Iceshrimp.Backend.Core.Helpers.LibMfm.Conversion; 9 9 using Iceshrimp.Backend.Core.Services; 10 + using Iceshrimp.Utils.DependencyInjection; 10 11 using Microsoft.EntityFrameworkCore; 11 12 using Microsoft.Extensions.Options; 12 13
+1
Iceshrimp.Backend/Controllers/Mastodon/Renderers/NotificationRenderer.cs
··· 6 6 using Iceshrimp.Backend.Core.Extensions; 7 7 using Iceshrimp.Backend.Core.Services; 8 8 using Iceshrimp.EntityFrameworkCore.Extensions; 9 + using Iceshrimp.Utils.DependencyInjection; 9 10 using Microsoft.EntityFrameworkCore; 10 11 using Microsoft.Extensions.Options; 11 12
+1
Iceshrimp.Backend/Controllers/Mastodon/Renderers/PollRenderer.cs
··· 2 2 using Iceshrimp.Backend.Core.Database; 3 3 using Iceshrimp.Backend.Core.Database.Tables; 4 4 using Iceshrimp.Backend.Core.Extensions; 5 + using Iceshrimp.Utils.DependencyInjection; 5 6 using Microsoft.EntityFrameworkCore; 6 7 7 8 namespace Iceshrimp.Backend.Controllers.Mastodon.Renderers;
+1
Iceshrimp.Backend/Controllers/Mastodon/Renderers/UserRenderer.cs
··· 6 6 using Iceshrimp.Backend.Core.Extensions; 7 7 using Iceshrimp.Backend.Core.Helpers.LibMfm.Conversion; 8 8 using Iceshrimp.Backend.Core.Services; 9 + using Iceshrimp.Utils.DependencyInjection; 9 10 using Microsoft.EntityFrameworkCore; 10 11 using Microsoft.Extensions.Options; 11 12 using Enums = Iceshrimp.Backend.Core.Configuration.Enums;
+1
Iceshrimp.Backend/Controllers/Web/Renderers/AnnouncementRenderer.cs
··· 3 3 using Iceshrimp.Backend.Core.Database.Tables; 4 4 using Iceshrimp.Backend.Core.Extensions; 5 5 using Iceshrimp.Shared.Schemas.Web; 6 + using Iceshrimp.Utils.DependencyInjection; 6 7 using Microsoft.EntityFrameworkCore; 7 8 using Microsoft.Extensions.Options; 8 9
+1
Iceshrimp.Backend/Controllers/Web/Renderers/NoteRenderer.cs
··· 5 5 using Iceshrimp.Backend.Core.Helpers; 6 6 using Iceshrimp.Backend.Core.Services; 7 7 using Iceshrimp.Shared.Schemas.Web; 8 + using Iceshrimp.Utils.DependencyInjection; 8 9 using Microsoft.EntityFrameworkCore; 9 10 using Microsoft.Extensions.Options; 10 11
+1
Iceshrimp.Backend/Controllers/Web/Renderers/NotificationRenderer.cs
··· 5 5 using Iceshrimp.Backend.Core.Services; 6 6 using Iceshrimp.EntityFrameworkCore.Extensions; 7 7 using Iceshrimp.Shared.Schemas.Web; 8 + using Iceshrimp.Utils.DependencyInjection; 8 9 using Microsoft.EntityFrameworkCore; 9 10 using Microsoft.Extensions.Options; 10 11 using static Iceshrimp.Shared.Schemas.Web.NotificationResponse;
+1
Iceshrimp.Backend/Controllers/Web/Renderers/ReportRenderer.cs
··· 1 1 using Iceshrimp.Backend.Core.Database.Tables; 2 2 using Iceshrimp.Backend.Core.Extensions; 3 3 using Iceshrimp.Shared.Schemas.Web; 4 + using Iceshrimp.Utils.DependencyInjection; 4 5 5 6 namespace Iceshrimp.Backend.Controllers.Web.Renderers; 6 7
+1
Iceshrimp.Backend/Controllers/Web/Renderers/UserProfileRenderer.cs
··· 3 3 using Iceshrimp.Backend.Core.Database.Tables; 4 4 using Iceshrimp.Backend.Core.Extensions; 5 5 using Iceshrimp.Shared.Schemas.Web; 6 + using Iceshrimp.Utils.DependencyInjection; 6 7 using Microsoft.EntityFrameworkCore; 7 8 using Microsoft.Extensions.Options; 8 9
+1 -1
Iceshrimp.Backend/Controllers/Web/Renderers/UserRenderer.cs
··· 1 1 using Iceshrimp.Backend.Core.Configuration; 2 2 using Iceshrimp.Backend.Core.Database; 3 3 using Iceshrimp.Backend.Core.Database.Tables; 4 - using Iceshrimp.Backend.Core.Extensions; 5 4 using Iceshrimp.Backend.Core.Services; 6 5 using Iceshrimp.Shared.Schemas.Web; 6 + using Iceshrimp.Utils.DependencyInjection; 7 7 using Microsoft.EntityFrameworkCore; 8 8 using Microsoft.Extensions.Options; 9 9
+19 -1
Iceshrimp.Backend/Core/Configuration/Config.cs
··· 3 3 using Iceshrimp.Backend.Core.Middleware; 4 4 using Iceshrimp.Backend.Core.Services.ImageProcessing; 5 5 using Iceshrimp.Shared.Helpers; 6 + using Iceshrimp.Utils.DependencyInjection; 6 7 7 8 namespace Iceshrimp.Backend.Core.Configuration; 8 9 ··· 12 13 [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")] 13 14 [SuppressMessage("ReSharper", "RedundantDefaultMemberInitializer")] 14 15 [SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")] 15 - public sealed class Config 16 + public sealed class Config : IServiceConfiguration 16 17 { 17 18 public required InstanceSection Instance { get; init; } = new(); 18 19 public required DatabaseSection Database { get; init; } = new(); ··· 24 25 public required BackfillSection Backfill { get; init; } = new(); 25 26 public required OpenTelemetrySection OpenTelemetry { get; init; } = new(); 26 27 28 + [ConfigurationSection("Instance")] 27 29 public sealed class InstanceSection 28 30 { 29 31 private readonly VersionInfo _versionInfo = VersionHelpers.VersionInfo.Value; ··· 53 55 public string[] AdditionalDomainsArray { get; private init; } = []; 54 56 } 55 57 58 + [ConfigurationSection("Security")] 56 59 public sealed class SecuritySection 57 60 { 58 61 public bool AuthorizedFetch { get; init; } = true; ··· 70 73 public Enums.PublicPreview PublicPreview { get; init; } = Enums.PublicPreview.Public; 71 74 } 72 75 76 + [ConfigurationSection("Network")] 73 77 public sealed class NetworkSection 74 78 { 75 79 public string? HttpProxy { get; init; } = null; ··· 77 81 public string? HttpProxyPass { get; init; } = null!; 78 82 } 79 83 84 + [ConfigurationSection("Database")] 80 85 public sealed class DatabaseSection 81 86 { 82 87 [Required] public string Host { get; init; } = "localhost"; ··· 89 94 public bool ParameterLogging { get; init; } = false; 90 95 } 91 96 97 + [ConfigurationSection("Storage")] 92 98 public sealed class StorageSection 93 99 { 94 100 public readonly long? MaxCacheSizeBytes; ··· 181 187 public MediaProcessingSection MediaProcessing { get; init; } = new(); 182 188 } 183 189 190 + [ConfigurationSection("Storage:Local")] 184 191 public sealed class LocalStorageSection 185 192 { 186 193 public string? Path { get; init; } 187 194 } 188 195 196 + [ConfigurationSection("Storage:ObjectStorage")] 189 197 public sealed class ObjectStorageSection 190 198 { 191 199 public string? Endpoint { get; init; } ··· 199 207 public bool DisableValidation { get; init; } = false; 200 208 } 201 209 210 + [ConfigurationSection("Storage:MediaProcessing")] 202 211 public sealed class MediaProcessingSection : IValidatableObject 203 212 { 204 213 public ImagePipelineSection ImagePipeline { get; init; } = new(); ··· 282 291 } 283 292 } 284 293 294 + [ConfigurationSection("Storage:MediaProcessing:ImagePipeline")] 285 295 public sealed class ImagePipelineSection 286 296 { 287 297 public ImageVersion Original { get; init; } = new() ··· 330 340 [Range(1, 9)] public int JxlEffort { get; init; } = 7; 331 341 } 332 342 343 + [ConfigurationSection("Performance")] 333 344 public sealed class PerformanceSection 334 345 { 335 346 public QueueConcurrencySection QueueConcurrency { get; init; } = new(); ··· 337 348 [Range(0, int.MaxValue)] public int FederationRequestHandlerConcurrency { get; init; } = 0; 338 349 } 339 350 351 + [ConfigurationSection("Performance:QueueConcurrency")] 340 352 public sealed class QueueConcurrencySection 341 353 { 342 354 [Range(1, int.MaxValue)] public int Inbox { get; init; } = 4; ··· 347 359 [Range(1, int.MaxValue)] public int BackfillUser { get; init; } = 10; 348 360 } 349 361 362 + [ConfigurationSection("Queue")] 350 363 public sealed class QueueSection 351 364 { 352 365 public JobRetentionSection JobRetention { get; init; } = new(); 353 366 } 354 367 368 + [ConfigurationSection("Queue:JobRetention")] 355 369 public sealed class JobRetentionSection 356 370 { 357 371 [Range(-1, int.MaxValue)] public int Completed { get; init; } = 100; 358 372 [Range(-1, int.MaxValue)] public int Failed { get; init; } = 10; 359 373 } 360 374 375 + [ConfigurationSection("Backfill")] 361 376 public sealed class BackfillSection 362 377 { 363 378 public BackfillRepliesSection Replies { get; init; } = new(); 364 379 public BackfillUserSection User { get; init; } = new(); 365 380 } 366 381 382 + [ConfigurationSection("Backfill:Replies")] 367 383 public sealed class BackfillRepliesSection 368 384 { 369 385 public bool Enabled { get; init; } = false; ··· 387 403 public TimeSpan RefreshAfterTimeSpan = TimeSpan.FromMinutes(15); 388 404 } 389 405 406 + [ConfigurationSection("Backfill:User")] 390 407 public sealed class BackfillUserSection 391 408 { 392 409 public bool Enabled { get; init; } = false; ··· 403 420 public TimeSpan RefreshAfterTimeSpan = TimeSpan.FromDays(30); 404 421 } 405 422 423 + [ConfigurationSection("OpenTelemetry")] 406 424 public sealed class OpenTelemetrySection 407 425 { 408 426 public bool Enabled { get; init; } = false;
+1 -151
Iceshrimp.Backend/Core/Extensions/ServiceExtensions.cs
··· 1 1 using System.Diagnostics.CodeAnalysis; 2 - using System.Reflection; 3 2 using System.Threading.RateLimiting; 4 3 using System.Xml.Linq; 5 - using Iceshrimp.AssemblyUtils; 6 4 using Iceshrimp.Backend.Core.Configuration; 7 5 using Iceshrimp.Backend.Core.Database; 8 - using Iceshrimp.Backend.Core.Helpers; 9 6 using Iceshrimp.Backend.Core.Middleware; 10 7 using Iceshrimp.Backend.SignalR.Authentication; 11 8 using Iceshrimp.Shared.Configuration; ··· 31 28 { 32 29 extension(IServiceCollection services) 33 30 { 34 - public void AddServices(IConfiguration configuration) 35 - { 36 - var config = configuration.Get<Config>() ?? throw new Exception("Failed to read storage config section"); 37 - 38 - var serviceTypes = PluginLoader 39 - .Assemblies.Prepend(Assembly.GetExecutingAssembly()) 40 - .SelectMany(AssemblyLoader.GetImplementationsOfInterface<IService>) 41 - .OrderBy(type => type.GetInterfaceProperty<IService, int?>(nameof(IService.Priority)) ?? 0) 42 - .ToArray(); 43 - 44 - foreach (var type in serviceTypes) 45 - { 46 - if (type.GetInterfaceProperty<IService, ServiceLifetime?>(nameof(IService.Lifetime)) is not { } lifetime) 47 - continue; 48 - 49 - if (type.GetInterface(nameof(IConditionalService)) != null) 50 - if (type.CallInterfaceMethod(nameof(IConditionalService.Predicate), config) is not true) 51 - continue; 52 - 53 - var serviceType = type.GetInterfaceProperty<IService, Type>(nameof(IService.ServiceType)) ?? type; 54 - services.Add(new ServiceDescriptor(serviceType, type, lifetime)); 55 - } 56 - 57 - var hostedServiceTypes = PluginLoader 58 - .Assemblies.Prepend(Assembly.GetExecutingAssembly()) 59 - .SelectMany(AssemblyLoader.GetImplementationsOfInterface<IHostedService>) 60 - .ToArray(); 61 - 62 - foreach (var type in hostedServiceTypes) 63 - { 64 - if (type.GetInterface(nameof(IService)) == null) 65 - services.Add(new ServiceDescriptor(type, type, ServiceLifetime.Singleton)); 66 - 67 - services.Add(new ServiceDescriptor(typeof(IHostedService), provider => provider.GetRequiredService(type), 68 - ServiceLifetime.Singleton)); 69 - } 70 - } 71 - 72 - public void AddMiddleware() 31 + public void ConfigureServices() 73 32 { 74 - var types = PluginLoader 75 - .Assemblies.Prepend(Assembly.GetExecutingAssembly()) 76 - .SelectMany(p => AssemblyLoader.GetImplementationsOfInterface(p, typeof(IMiddlewareService))); 77 - 78 - foreach (var type in types) 79 - { 80 - if (type.GetProperty(nameof(IMiddlewareService.Lifetime))?.GetValue(null) is not ServiceLifetime lifetime) 81 - continue; 82 - 83 - services.Add(new ServiceDescriptor(type, type, lifetime)); 84 - } 85 - } 86 - 87 - public void ConfigureServices(IConfiguration configuration) 88 - { 89 - // @formatter:off 90 - services.ConfigureWithValidation<Config>(configuration) 91 - .ConfigureWithValidation<Config.InstanceSection>(configuration, "Instance") 92 - .ConfigureWithValidation<Config.SecuritySection>(configuration, "Security") 93 - .ConfigureWithValidation<Config.NetworkSection>(configuration, "Network") 94 - .ConfigureWithValidation<Config.PerformanceSection>(configuration, "Performance") 95 - .ConfigureWithValidation<Config.QueueConcurrencySection>(configuration, "Performance:QueueConcurrency") 96 - .ConfigureWithValidation<Config.BackfillSection>(configuration, "Backfill") 97 - .ConfigureWithValidation<Config.BackfillRepliesSection>(configuration, "Backfill:Replies") 98 - .ConfigureWithValidation<Config.BackfillUserSection>(configuration, "Backfill:User") 99 - .ConfigureWithValidation<Config.QueueSection>(configuration, "Queue") 100 - .ConfigureWithValidation<Config.JobRetentionSection>(configuration, "Queue:JobRetention") 101 - .ConfigureWithValidation<Config.DatabaseSection>(configuration, "Database") 102 - .ConfigureWithValidation<Config.StorageSection>(configuration, "Storage") 103 - .ConfigureWithValidation<Config.LocalStorageSection>(configuration, "Storage:Local") 104 - .ConfigureWithValidation<Config.ObjectStorageSection>(configuration, "Storage:ObjectStorage") 105 - .ConfigureWithValidation<Config.MediaProcessingSection>(configuration, "Storage:MediaProcessing") 106 - .ConfigureWithValidation<Config.ImagePipelineSection>(configuration, "Storage:MediaProcessing:ImagePipeline") 107 - .ConfigureWithValidation<Config.ImageFormatConfiguration>(configuration, "Storage:MediaProcessing:ImagePipeline:Original:Local") 108 - .ConfigureWithValidation<Config.ImageFormatConfiguration>(configuration, "Storage:MediaProcessing:ImagePipeline:Original:Remote") 109 - .ConfigureWithValidation<Config.ImageFormatConfiguration>(configuration, "Storage:MediaProcessing:ImagePipeline:Thumbnail:Local") 110 - .ConfigureWithValidation<Config.ImageFormatConfiguration>(configuration, "Storage:MediaProcessing:ImagePipeline:Thumbnail:Remote") 111 - .ConfigureWithValidation<Config.ImageFormatConfiguration>(configuration, "Storage:MediaProcessing:ImagePipeline:Public:Local") 112 - .ConfigureWithValidation<Config.ImageFormatConfiguration>(configuration, "Storage:MediaProcessing:ImagePipeline:Public:Remote") 113 - .ConfigureWithValidation<Config.OpenTelemetrySection>(configuration, "OpenTelemetry"); 114 - // @formatter:on 115 - 116 33 services.Configure<JsonOptions>(options => 117 34 { 118 35 options.SerializerOptions.PropertyNamingPolicy = JsonSerialization.Options.PropertyNamingPolicy; ··· 129 46 }); 130 47 131 48 services.PostConfigure<RazorComponentsServiceOptions>(BlazorSsrHandoffMiddleware.DisableBlazorJsInitializers); 132 - } 133 - 134 - private IServiceCollection ConfigureWithValidation<T>( 135 - IConfiguration config 136 - ) where T : class 137 - { 138 - services.AddOptionsWithValidateOnStart<T>() 139 - .Bind(config) 140 - .ValidateDataAnnotations(); 141 - 142 - return services; 143 - } 144 - 145 - private IServiceCollection ConfigureWithValidation<T>( 146 - IConfiguration config, string name 147 - ) where T : class 148 - { 149 - services.AddOptionsWithValidateOnStart<T>() 150 - .Bind(config.GetSection(name)) 151 - .ValidateDataAnnotations(); 152 - 153 - return services; 154 49 } 155 50 156 51 public void AddDatabaseContext(IConfiguration configuration) ··· 389 284 public bool ShouldCacheOutput() => 390 285 ctx.Items.TryGetValue(CacheKey, out var s) && s is true; 391 286 } 392 - } 393 - 394 - public interface IService 395 - { 396 - // This should be abstract instead of virtual but the runtime team said https://github.com/dotnet/runtime/issues/79331 397 - public static virtual ServiceLifetime Lifetime => throw new Exception("Missing IService.Lifetime override"); 398 - 399 - public static virtual Type? ServiceType => null; 400 - public static virtual int Priority => 0; 401 - } 402 - 403 - /// <summary> 404 - /// Instantiated per request and class 405 - /// </summary> 406 - public interface ITransientService : IService 407 - { 408 - static ServiceLifetime IService.Lifetime => ServiceLifetime.Transient; 409 - } 410 - 411 - /// <summary> 412 - /// Instantiated per request 413 - /// </summary> 414 - public interface IScopedService : IService 415 - { 416 - static ServiceLifetime IService.Lifetime => ServiceLifetime.Scoped; 417 - } 418 - 419 - /// <summary> 420 - /// Instantiated once across application lifetime 421 - /// </summary> 422 - public interface ISingletonService : IService 423 - { 424 - static ServiceLifetime IService.Lifetime => ServiceLifetime.Singleton; 425 - } 426 - 427 - public interface IService<TService> : IService 428 - { 429 - static Type IService.ServiceType => typeof(TService); 430 - } 431 - 432 - public interface IConditionalService : IService 433 - { 434 - // This should be abstract instead of virtual but the runtime team said https://github.com/dotnet/runtime/issues/79331 435 - public static virtual bool Predicate(Config ctx) => 436 - throw new Exception("Missing IConditionalService.Predicate override"); 437 287 } 438 288 439 289 #region AsyncDataProtection handlers
+1 -1
Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityDeliverService.cs
··· 1 1 using Iceshrimp.Backend.Core.Database; 2 2 using Iceshrimp.Backend.Core.Database.Tables; 3 - using Iceshrimp.Backend.Core.Extensions; 4 3 using Iceshrimp.Backend.Core.Federation.ActivityStreams; 5 4 using Iceshrimp.Backend.Core.Federation.ActivityStreams.Types; 6 5 using Iceshrimp.Backend.Core.Queues; 7 6 using Iceshrimp.Backend.Core.Services; 7 + using Iceshrimp.Utils.DependencyInjection; 8 8 using Microsoft.EntityFrameworkCore; 9 9 using Newtonsoft.Json; 10 10
+1
Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityFetcherService.cs
··· 10 10 using Iceshrimp.Backend.Core.Helpers; 11 11 using Iceshrimp.Backend.Core.Middleware; 12 12 using Iceshrimp.Backend.Core.Services; 13 + using Iceshrimp.Utils.DependencyInjection; 13 14 using Microsoft.EntityFrameworkCore; 14 15 using Microsoft.Extensions.Options; 15 16 using Newtonsoft.Json;
+1
Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityHandlerService.cs
··· 7 7 using Iceshrimp.Backend.Core.Helpers; 8 8 using Iceshrimp.Backend.Core.Middleware; 9 9 using Iceshrimp.Backend.Core.Services; 10 + using Iceshrimp.Utils.DependencyInjection; 10 11 using Microsoft.EntityFrameworkCore; 11 12 using Microsoft.Extensions.Options; 12 13 using static Iceshrimp.Backend.Core.Federation.ActivityPub.UserResolver;
+1
Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityRenderer.cs
··· 4 4 using Iceshrimp.Backend.Core.Extensions; 5 5 using Iceshrimp.Backend.Core.Federation.ActivityStreams.Types; 6 6 using Iceshrimp.Backend.Core.Middleware; 7 + using Iceshrimp.Utils.DependencyInjection; 7 8 using Microsoft.Extensions.Options; 8 9 9 10 namespace Iceshrimp.Backend.Core.Federation.ActivityPub;
+1
Iceshrimp.Backend/Core/Federation/ActivityPub/FederationControlService.cs
··· 2 2 using Iceshrimp.Backend.Core.Configuration; 3 3 using Iceshrimp.Backend.Core.Database; 4 4 using Iceshrimp.Backend.Core.Extensions; 5 + using Iceshrimp.Utils.DependencyInjection; 5 6 using Microsoft.EntityFrameworkCore; 6 7 using Microsoft.Extensions.Options; 7 8
+1
Iceshrimp.Backend/Core/Federation/ActivityPub/MentionsResolver.cs
··· 3 3 using Iceshrimp.Backend.Core.Database.Tables; 4 4 using Iceshrimp.Backend.Core.Extensions; 5 5 using Iceshrimp.MfmSharp; 6 + using Iceshrimp.Utils.DependencyInjection; 6 7 using Microsoft.Extensions.Options; 7 8 8 9 namespace Iceshrimp.Backend.Core.Federation.ActivityPub;
+1
Iceshrimp.Backend/Core/Federation/ActivityPub/NoteRenderer.cs
··· 6 6 using Iceshrimp.Backend.Core.Helpers.LibMfm.Conversion; 7 7 using Iceshrimp.Backend.Core.Middleware; 8 8 using Iceshrimp.Backend.Core.Services; 9 + using Iceshrimp.Utils.DependencyInjection; 9 10 using Microsoft.EntityFrameworkCore; 10 11 using Microsoft.Extensions.Options; 11 12
+1 -1
Iceshrimp.Backend/Core/Federation/ActivityPub/ObjectResolver.cs
··· 2 2 using Iceshrimp.Backend.Core.Configuration; 3 3 using Iceshrimp.Backend.Core.Database; 4 4 using Iceshrimp.Backend.Core.Database.Tables; 5 - using Iceshrimp.Backend.Core.Extensions; 6 5 using Iceshrimp.Backend.Core.Federation.ActivityStreams.Types; 7 6 using Iceshrimp.Backend.Core.Middleware; 7 + using Iceshrimp.Utils.DependencyInjection; 8 8 using Microsoft.EntityFrameworkCore; 9 9 using Microsoft.Extensions.Options; 10 10
+1 -1
Iceshrimp.Backend/Core/Federation/ActivityPub/StampRenderer.cs
··· 1 1 using Iceshrimp.Backend.Core.Configuration; 2 2 using Iceshrimp.Backend.Core.Database.Tables; 3 - using Iceshrimp.Backend.Core.Extensions; 4 3 using Iceshrimp.Backend.Core.Federation.ActivityStreams.Types; 4 + using Iceshrimp.Utils.DependencyInjection; 5 5 using Microsoft.Extensions.Options; 6 6 7 7 namespace Iceshrimp.Backend.Core.Federation.ActivityPub;
+1
Iceshrimp.Backend/Core/Federation/ActivityPub/UserRenderer.cs
··· 7 7 using Iceshrimp.Backend.Core.Helpers.LibMfm.Conversion; 8 8 using Iceshrimp.Backend.Core.Services; 9 9 using Iceshrimp.MfmSharp; 10 + using Iceshrimp.Utils.DependencyInjection; 10 11 using Microsoft.EntityFrameworkCore; 11 12 using Microsoft.Extensions.Options; 12 13
+1 -1
Iceshrimp.Backend/Core/Federation/ActivityPub/UserResolver.cs
··· 3 3 using Iceshrimp.Backend.Core.Configuration; 4 4 using Iceshrimp.Backend.Core.Database; 5 5 using Iceshrimp.Backend.Core.Database.Tables; 6 - using Iceshrimp.Backend.Core.Extensions; 7 6 using Iceshrimp.Backend.Core.Federation.ActivityStreams.Types; 8 7 using Iceshrimp.Backend.Core.Federation.WebFinger; 9 8 using Iceshrimp.Backend.Core.Middleware; 10 9 using Iceshrimp.Backend.Core.Services; 11 10 using Iceshrimp.Utils.Common; 11 + using Iceshrimp.Utils.DependencyInjection; 12 12 using Microsoft.EntityFrameworkCore; 13 13 using Microsoft.Extensions.Options; 14 14
+1 -1
Iceshrimp.Backend/Core/Federation/WebFinger/WebFingerService.cs
··· 5 5 using System.Xml; 6 6 using System.Xml.Serialization; 7 7 using Iceshrimp.Backend.Core.Configuration; 8 - using Iceshrimp.Backend.Core.Extensions; 9 8 using Iceshrimp.Backend.Core.Helpers; 10 9 using Iceshrimp.Backend.Core.Middleware; 11 10 using Iceshrimp.Backend.Core.Services; 11 + using Iceshrimp.Utils.DependencyInjection; 12 12 using Microsoft.Extensions.Options; 13 13 14 14 namespace Iceshrimp.Backend.Core.Federation.WebFinger;
+1
Iceshrimp.Backend/Core/Helpers/LibMfm/Conversion/MfmConverter.cs
··· 10 10 using Iceshrimp.MfmSharp; 11 11 using Iceshrimp.Backend.Core.Services; 12 12 using Iceshrimp.MfmSharp.Helpers; 13 + using Iceshrimp.Utils.DependencyInjection; 13 14 using Microsoft.Extensions.Options; 14 15 using MfmHtmlParser = Iceshrimp.Backend.Core.Helpers.LibMfm.Parsing.HtmlParser; 15 16 using HtmlParser = AngleSharp.Html.Parser.HtmlParser;
+1 -1
Iceshrimp.Backend/Core/Helpers/Telemetry.cs
··· 1 1 using System.Diagnostics; 2 2 using System.Diagnostics.Metrics; 3 - using Iceshrimp.Backend.Core.Extensions; 4 3 using Iceshrimp.Shared.Helpers; 4 + using Iceshrimp.Utils.DependencyInjection; 5 5 6 6 namespace Iceshrimp.Backend.Core.Helpers; 7 7
+1 -1
Iceshrimp.Backend/Core/Services/BiteService.cs
··· 1 1 using Iceshrimp.Backend.Core.Configuration; 2 2 using Iceshrimp.Backend.Core.Database; 3 3 using Iceshrimp.Backend.Core.Database.Tables; 4 - using Iceshrimp.Backend.Core.Extensions; 5 4 using Iceshrimp.Backend.Core.Helpers; 5 + using Iceshrimp.Utils.DependencyInjection; 6 6 using Microsoft.Extensions.Options; 7 7 8 8 namespace Iceshrimp.Backend.Core.Services;
+1 -1
Iceshrimp.Backend/Core/Services/CacheService.cs
··· 3 3 using AsyncKeyedLock; 4 4 using Iceshrimp.Backend.Core.Database; 5 5 using Iceshrimp.Backend.Core.Database.Tables; 6 - using Iceshrimp.Backend.Core.Extensions; 6 + using Iceshrimp.Utils.DependencyInjection; 7 7 using Microsoft.EntityFrameworkCore; 8 8 9 9 namespace Iceshrimp.Backend.Core.Services;
+1
Iceshrimp.Backend/Core/Services/CustomHttpClient.cs
··· 3 3 using System.Net.Sockets; 4 4 using Iceshrimp.Backend.Core.Configuration; 5 5 using Iceshrimp.Backend.Core.Extensions; 6 + using Iceshrimp.Utils.DependencyInjection; 6 7 using JetBrains.Annotations; 7 8 using Microsoft.Extensions.Options; 8 9
+1 -1
Iceshrimp.Backend/Core/Services/DatabaseMaintenanceService.cs
··· 1 1 using Iceshrimp.Backend.Core.Database; 2 - using Iceshrimp.Backend.Core.Extensions; 2 + using Iceshrimp.Utils.DependencyInjection; 3 3 using Microsoft.EntityFrameworkCore; 4 4 5 5 namespace Iceshrimp.Backend.Core.Services;
+1
Iceshrimp.Backend/Core/Services/DriveService.cs
··· 9 9 using Iceshrimp.Backend.Core.Middleware; 10 10 using Iceshrimp.Backend.Core.Queues; 11 11 using Iceshrimp.Backend.Core.Services.ImageProcessing; 12 + using Iceshrimp.Utils.DependencyInjection; 12 13 using Microsoft.EntityFrameworkCore; 13 14 using Microsoft.Extensions.Options; 14 15 using static Iceshrimp.Backend.Core.Services.ImageProcessing.ImageVersion;
+1 -1
Iceshrimp.Backend/Core/Services/EmojiImportService.cs
··· 1 1 using System.IO.Compression; 2 2 using System.Net; 3 3 using System.Text.Json; 4 - using Iceshrimp.Backend.Core.Extensions; 5 4 using Iceshrimp.Backend.Core.Middleware; 5 + using Iceshrimp.Utils.DependencyInjection; 6 6 using Microsoft.AspNetCore.StaticFiles; 7 7 8 8 namespace Iceshrimp.Backend.Core.Services;
+1
Iceshrimp.Backend/Core/Services/EmojiService.cs
··· 9 9 using Iceshrimp.Backend.Core.Helpers; 10 10 using Iceshrimp.Backend.Core.Middleware; 11 11 using Iceshrimp.MfmSharp; 12 + using Iceshrimp.Utils.DependencyInjection; 12 13 using Microsoft.EntityFrameworkCore; 13 14 using Microsoft.Extensions.Options; 14 15
+1 -1
Iceshrimp.Backend/Core/Services/EventService.cs
··· 1 1 using Iceshrimp.Backend.Core.Database.Tables; 2 2 using Iceshrimp.Backend.Core.Events; 3 - using Iceshrimp.Backend.Core.Extensions; 3 + using Iceshrimp.Utils.DependencyInjection; 4 4 5 5 namespace Iceshrimp.Backend.Core.Services; 6 6
+1 -1
Iceshrimp.Backend/Core/Services/FlagService.cs
··· 1 - using Iceshrimp.Backend.Core.Extensions; 1 + using Iceshrimp.Utils.DependencyInjection; 2 2 using JetBrains.Annotations; 3 3 4 4 namespace Iceshrimp.Backend.Core.Services;
+1 -1
Iceshrimp.Backend/Core/Services/FollowupTaskService.cs
··· 1 - using Iceshrimp.Backend.Core.Extensions; 1 + using Iceshrimp.Utils.DependencyInjection; 2 2 3 3 namespace Iceshrimp.Backend.Core.Services; 4 4
+1 -1
Iceshrimp.Backend/Core/Services/HttpRequestService.cs
··· 3 3 using System.Security.Cryptography; 4 4 using Iceshrimp.Backend.Core.Configuration; 5 5 using Iceshrimp.Backend.Core.Database.Tables; 6 - using Iceshrimp.Backend.Core.Extensions; 7 6 using Iceshrimp.Backend.Core.Federation.Cryptography; 7 + using Iceshrimp.Utils.DependencyInjection; 8 8 using Microsoft.Extensions.Options; 9 9 10 10 namespace Iceshrimp.Backend.Core.Services;
+1 -1
Iceshrimp.Backend/Core/Services/ImageProcessing/ImageProcessor.cs
··· 2 2 using System.Diagnostics.CodeAnalysis; 3 3 using Iceshrimp.Backend.Core.Configuration; 4 4 using Iceshrimp.Backend.Core.Database.Tables; 5 - using Iceshrimp.Backend.Core.Extensions; 6 5 using Iceshrimp.Backend.Core.Helpers; 6 + using Iceshrimp.Utils.DependencyInjection; 7 7 using Microsoft.Extensions.Options; 8 8 using static Iceshrimp.Backend.Core.Services.ImageProcessing.ImageVersion; 9 9
+2 -2
Iceshrimp.Backend/Core/Services/ImageProcessing/ImageSharpProcessor.cs
··· 1 1 using CommunityToolkit.HighPerformance; 2 2 using Iceshrimp.Backend.Core.Configuration; 3 - using Iceshrimp.Backend.Core.Extensions; 4 3 using Iceshrimp.Backend.Core.Helpers; 4 + using Iceshrimp.Utils.DependencyInjection; 5 5 using Microsoft.Extensions.Options; 6 6 using SixLabors.ImageSharp; 7 7 using SixLabors.ImageSharp.Formats; ··· 15 15 namespace Iceshrimp.Backend.Core.Services.ImageProcessing; 16 16 17 17 public class ImageSharpProcessor : ImageProcessorBase, IImageProcessor, 18 - ISingletonService, IConditionalService, IService<IImageProcessor> 18 + ISingletonService, IConditionalService<Config>, IService<IImageProcessor> 19 19 { 20 20 private readonly ILogger<ImageSharpProcessor> _logger; 21 21 private readonly ImageSharpConfig _sharpConfig;
+2 -3
Iceshrimp.Backend/Core/Services/ImageProcessing/VipsProcessor.cs
··· 1 - using System.Runtime.InteropServices; 2 1 using CommunityToolkit.HighPerformance; 3 2 using Iceshrimp.Backend.Core.Configuration; 4 - using Iceshrimp.Backend.Core.Extensions; 5 3 using Iceshrimp.Backend.Core.Helpers; 6 4 using NetVips; 7 5 using Iceshrimp.MimeTypes; 6 + using Iceshrimp.Utils.DependencyInjection; 8 7 using SixLabors.ImageSharp.PixelFormats; 9 8 using Enums = NetVips.Enums; 10 9 11 10 namespace Iceshrimp.Backend.Core.Services.ImageProcessing; 12 11 13 12 public class VipsProcessor : ImageProcessorBase, IImageProcessor, 14 - ISingletonService, IConditionalService, IService<IImageProcessor> 13 + ISingletonService, IConditionalService<Config>, IService<IImageProcessor> 15 14 { 16 15 private readonly ILogger<VipsProcessor> _logger; 17 16
+1
Iceshrimp.Backend/Core/Services/ImportExportService.cs
··· 2 2 using Iceshrimp.Backend.Core.Database; 3 3 using Iceshrimp.Backend.Core.Database.Tables; 4 4 using Iceshrimp.Backend.Core.Extensions; 5 + using Iceshrimp.Utils.DependencyInjection; 5 6 using Microsoft.EntityFrameworkCore; 6 7 using Microsoft.Extensions.Options; 7 8 using static Iceshrimp.Backend.Core.Federation.ActivityPub.UserResolver;
+1
Iceshrimp.Backend/Core/Services/InstanceService.cs
··· 6 6 using Iceshrimp.Backend.Core.Extensions; 7 7 using Iceshrimp.Backend.Core.Federation.WebFinger; 8 8 using Iceshrimp.Backend.Core.Helpers; 9 + using Iceshrimp.Utils.DependencyInjection; 9 10 using Microsoft.EntityFrameworkCore; 10 11 11 12 namespace Iceshrimp.Backend.Core.Services;
+1 -1
Iceshrimp.Backend/Core/Services/MediaProxyService.cs
··· 1 1 using Iceshrimp.Backend.Core.Configuration; 2 2 using Iceshrimp.Backend.Core.Database.Tables; 3 - using Iceshrimp.Backend.Core.Extensions; 3 + using Iceshrimp.Utils.DependencyInjection; 4 4 using JetBrains.Annotations; 5 5 using Microsoft.Extensions.Options; 6 6
+1 -1
Iceshrimp.Backend/Core/Services/MetaService.cs
··· 1 1 using Iceshrimp.Backend.Core.Database; 2 2 using Iceshrimp.Backend.Core.Database.Tables; 3 - using Iceshrimp.Backend.Core.Extensions; 3 + using Iceshrimp.Utils.DependencyInjection; 4 4 using Microsoft.EntityFrameworkCore; 5 5 6 6 namespace Iceshrimp.Backend.Core.Services;
+1
Iceshrimp.Backend/Core/Services/NoteService.cs
··· 12 12 using Iceshrimp.Backend.Core.Middleware; 13 13 using Iceshrimp.Backend.Core.Queues; 14 14 using Iceshrimp.MfmSharp; 15 + using Iceshrimp.Utils.DependencyInjection; 15 16 using Microsoft.EntityFrameworkCore; 16 17 using Microsoft.Extensions.Options; 17 18 using static Iceshrimp.Backend.Core.Federation.ActivityPub.UserResolver;
+1
Iceshrimp.Backend/Core/Services/NotificationService.cs
··· 3 3 using Iceshrimp.Backend.Core.Database.Tables; 4 4 using Iceshrimp.Backend.Core.Extensions; 5 5 using Iceshrimp.Backend.Core.Helpers; 6 + using Iceshrimp.Utils.DependencyInjection; 6 7 using Microsoft.EntityFrameworkCore; 7 8 8 9 namespace Iceshrimp.Backend.Core.Services;
+1 -1
Iceshrimp.Backend/Core/Services/ObjectStorageService.cs
··· 4 4 using System.Text; 5 5 using Carbon.Storage; 6 6 using Iceshrimp.Backend.Core.Configuration; 7 - using Iceshrimp.Backend.Core.Extensions; 8 7 using Iceshrimp.Backend.Core.Helpers; 9 8 using Iceshrimp.ObjectStorage.Core.Models; 10 9 using Iceshrimp.ObjectStorage.Core.Security; 11 10 using Iceshrimp.ObjectStorage.S3.Client; 11 + using Iceshrimp.Utils.DependencyInjection; 12 12 using Microsoft.Extensions.Options; 13 13 14 14 namespace Iceshrimp.Backend.Core.Services;
+1 -1
Iceshrimp.Backend/Core/Services/PolicyService.cs
··· 4 4 using Iceshrimp.AssemblyUtils; 5 5 using Iceshrimp.Backend.Core.Database; 6 6 using Iceshrimp.Backend.Core.Database.Tables; 7 - using Iceshrimp.Backend.Core.Extensions; 8 7 using Iceshrimp.Backend.Core.Federation.ActivityStreams.Types; 9 8 using Iceshrimp.Backend.Core.Helpers; 10 9 using Iceshrimp.Shared.Configuration; 10 + using Iceshrimp.Utils.DependencyInjection; 11 11 using Microsoft.EntityFrameworkCore; 12 12 13 13 namespace Iceshrimp.Backend.Core.Services;
+1 -1
Iceshrimp.Backend/Core/Services/PollService.cs
··· 1 1 using Iceshrimp.Backend.Core.Database; 2 2 using Iceshrimp.Backend.Core.Database.Tables; 3 - using Iceshrimp.Backend.Core.Extensions; 3 + using Iceshrimp.Utils.DependencyInjection; 4 4 using Microsoft.EntityFrameworkCore; 5 5 6 6 namespace Iceshrimp.Backend.Core.Services;
+1 -1
Iceshrimp.Backend/Core/Services/RelayService.cs
··· 1 1 using Iceshrimp.Backend.Core.Database; 2 2 using Iceshrimp.Backend.Core.Database.Tables; 3 - using Iceshrimp.Backend.Core.Extensions; 4 3 using Iceshrimp.Backend.Core.Helpers; 5 4 using Iceshrimp.Backend.Core.Middleware; 5 + using Iceshrimp.Utils.DependencyInjection; 6 6 using Microsoft.EntityFrameworkCore; 7 7 8 8 namespace Iceshrimp.Backend.Core.Services;
+1 -1
Iceshrimp.Backend/Core/Services/ReportService.cs
··· 1 1 using Iceshrimp.Backend.Core.Database; 2 2 using Iceshrimp.Backend.Core.Database.Tables; 3 - using Iceshrimp.Backend.Core.Extensions; 4 3 using Iceshrimp.Backend.Core.Helpers; 4 + using Iceshrimp.Utils.DependencyInjection; 5 5 6 6 namespace Iceshrimp.Backend.Core.Services; 7 7
+1 -1
Iceshrimp.Backend/Core/Services/StampService.cs
··· 1 1 using Iceshrimp.Backend.Core.Database; 2 2 using Iceshrimp.Backend.Core.Database.Tables; 3 - using Iceshrimp.Backend.Core.Extensions; 4 3 using Iceshrimp.Backend.Core.Federation.ActivityStreams.Types; 5 4 using Iceshrimp.Backend.Core.Helpers; 5 + using Iceshrimp.Utils.DependencyInjection; 6 6 7 7 namespace Iceshrimp.Backend.Core.Services; 8 8
+1
Iceshrimp.Backend/Core/Services/StorageMaintenanceService.cs
··· 5 5 using Iceshrimp.Backend.Core.Database.Tables; 6 6 using Iceshrimp.Backend.Core.Extensions; 7 7 using Iceshrimp.EntityFrameworkCore.Extensions; 8 + using Iceshrimp.Utils.DependencyInjection; 8 9 using Microsoft.EntityFrameworkCore; 9 10 using Microsoft.Extensions.Options; 10 11
+1 -1
Iceshrimp.Backend/Core/Services/StreamingService.cs
··· 1 1 using System.Collections.Concurrent; 2 2 using Iceshrimp.Backend.Controllers.Web.Renderers; 3 3 using Iceshrimp.Backend.Core.Database.Tables; 4 - using Iceshrimp.Backend.Core.Extensions; 5 4 using Iceshrimp.Backend.SignalR; 6 5 using Iceshrimp.Backend.SignalR.Helpers; 7 6 using Iceshrimp.Shared.Helpers; 8 7 using Iceshrimp.Shared.Schemas.SignalR; 9 8 using Iceshrimp.Shared.Schemas.Web; 9 + using Iceshrimp.Utils.DependencyInjection; 10 10 using Microsoft.AspNetCore.SignalR; 11 11 12 12 namespace Iceshrimp.Backend.Core.Services;
+1 -1
Iceshrimp.Backend/Core/Services/SystemUserService.cs
··· 2 2 using AsyncKeyedLock; 3 3 using Iceshrimp.Backend.Core.Database; 4 4 using Iceshrimp.Backend.Core.Database.Tables; 5 - using Iceshrimp.Backend.Core.Extensions; 6 5 using Iceshrimp.Backend.Core.Helpers; 6 + using Iceshrimp.Utils.DependencyInjection; 7 7 using Microsoft.EntityFrameworkCore; 8 8 9 9 namespace Iceshrimp.Backend.Core.Services;
+1
Iceshrimp.Backend/Core/Services/UserProfileMentionsResolver.cs
··· 6 6 using Iceshrimp.Backend.Core.Federation.ActivityStreams.Types; 7 7 using Iceshrimp.Backend.Core.Helpers.LibMfm.Conversion; 8 8 using Iceshrimp.MfmSharp; 9 + using Iceshrimp.Utils.DependencyInjection; 9 10 using Microsoft.Extensions.Options; 10 11 using static Iceshrimp.Backend.Core.Federation.ActivityPub.UserResolver; 11 12
+1
Iceshrimp.Backend/Core/Services/UserService.cs
··· 18 18 using Iceshrimp.EntityFrameworkCore.Extensions; 19 19 using Iceshrimp.MfmSharp; 20 20 using Iceshrimp.Shared.Configuration; 21 + using Iceshrimp.Utils.DependencyInjection; 21 22 using Microsoft.EntityFrameworkCore; 22 23 using Microsoft.Extensions.Options; 23 24
+1
Iceshrimp.Backend/Iceshrimp.Backend.csproj
··· 61 61 <PackageReference Include="Iceshrimp.AssemblyUtils" Version="1.1.0" /> 62 62 <PackageReference Include="Iceshrimp.MfmSharp" Version="1.3.1" /> 63 63 <PackageReference Include="Iceshrimp.Utils.Common" Version="1.3.0" /> 64 + <PackageReference Include="Iceshrimp.Utils.DependencyInjection" Version="1.0.1" /> 64 65 <PackageReference Include="Iceshrimp.MimeTypes" Version="1.0.1" /> 65 66 <PackageReference Include="Iceshrimp.WebPush" Version="2.2.0" /> 66 67 <PackageReference Include="NetVips" Version="3.2.0" />
+6 -3
Iceshrimp.Backend/Startup.cs
··· 1 1 using System.Diagnostics; 2 2 using System.Net; 3 + using Iceshrimp.Backend.Core.Configuration; 3 4 using Iceshrimp.Backend.Core.Extensions; 4 5 using Iceshrimp.Backend.Core.Helpers; 5 6 using Iceshrimp.Backend.Pages.Shared; 6 7 using Iceshrimp.Backend.SignalR; 7 8 using Iceshrimp.Backend.SignalR.Authentication; 9 + using Iceshrimp.Utils.DependencyInjection; 8 10 using Microsoft.AspNetCore.HttpOverrides; 9 11 using IPNetwork = System.Net.IPNetwork; 10 12 ··· 38 40 builder.Services.AddResponseCompression(); 39 41 builder.Services.AddRazorComponents(); 40 42 builder.Services.AddAntiforgery(o => o.Cookie.Name = "CSRF-Token"); 41 - builder.Services.AddMiddleware(); 42 - builder.Services.AddServices(builder.Configuration); 43 - builder.Services.ConfigureServices(builder.Configuration); 43 + builder.Services.AddMiddlewareFromAssembly(PluginLoader.Assemblies); 44 + builder.Services.AddServicesFromAssembly<Config>(builder.Configuration, PluginLoader.Assemblies); 45 + builder.Services.ConfigureServicesWithValidation<Config>(builder.Configuration); 46 + builder.Services.ConfigureServices(); 44 47 builder.AddOpenTelemetry(); 45 48 46 49 builder.WebHost.ConfigureKestrel(builder.Configuration);
+8 -3
Iceshrimp.Tests/MockObjects.cs
··· 1 + using System.Diagnostics.CodeAnalysis; 1 2 using System.Security.Cryptography; 3 + using Iceshrimp.Backend.Core.Configuration; 2 4 using Iceshrimp.Backend.Core.Database.Tables; 3 5 using Iceshrimp.Backend.Core.Extensions; 4 6 using Iceshrimp.Backend.Core.Federation.ActivityStreams.Types; 5 7 using Iceshrimp.Backend.Core.Helpers; 6 8 using Microsoft.Extensions.Configuration; 7 9 using Microsoft.Extensions.DependencyInjection; 10 + using Iceshrimp.Utils.DependencyInjection; 8 11 9 12 namespace Iceshrimp.Tests; 10 13 ··· 37 40 private static readonly ServiceProvider DefaultServiceProvider = GetServiceProvider(); 38 41 public static IServiceProvider ServiceProvider => DefaultServiceProvider.CreateScope().ServiceProvider; 39 42 43 + [SuppressMessage("ReSharper", "RedundantSuppressNullableWarningExpression")] 40 44 private static ServiceProvider GetServiceProvider() 41 45 { 42 46 var config = new ConfigurationManager(); 43 47 config.AddIniStream(AssemblyHelpers.GetEmbeddedResourceStream("configuration.ini")); 44 48 45 - var collection = new ServiceCollection(); 46 - collection.AddServices(config); 47 - collection.ConfigureServices(config); 49 + IServiceCollection collection = new ServiceCollection(); 50 + collection.AddServicesFromAssembly<Config>(config, typeof(Config).Assembly!); 51 + collection.ConfigureServicesWithValidation<Config>(config); 52 + collection.ConfigureServices(); 48 53 49 54 return collection.BuildServiceProvider(); 50 55 }