diff options
| author | Jake Mannens <jake@asger.xyz> | 2023-09-17 22:51:50 +1000 |
|---|---|---|
| committer | Jake Mannens <jakem_5@hotmail.com> | 2026-01-14 20:30:37 +1100 |
| commit | a440be4df759c7d317c1574ce1132fab807494f2 (patch) | |
| tree | 157bc8246beabf1cb361ff9ec2416a2244a2843a /Program.cs | |
| parent | ee17b95e1deb121636eaaebad8a0351f28ad704a (diff) | |
Consolidated user session state and made it persistent across all scopes pertaining to a session
Diffstat (limited to 'Program.cs')
| -rw-r--r-- | Program.cs | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -8,6 +8,7 @@ namespace HyperBooru; public class Program { public static void Main(string[] args) { var builder = WebApplication.CreateBuilder(args); + builder.Services.AddSession(); builder.Services.AddHttpContextAccessor(); builder.Services.AddAuthentication( CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(); @@ -24,6 +25,7 @@ public class Program { builder.Services.AddScoped<ISearchService, SearchService>(); builder.Services.AddScoped<ITagService, TagService>(); builder.Services.AddScoped<IMediaService, MediaService>(); + builder.Services.AddSingleton<IGlobalUserService, GlobalUserService>(); builder.Services.AddScoped<IUserService, UserService>(); builder.Services.AddHostedService<OcrService>(); @@ -34,6 +36,7 @@ public class Program { using var db = scope.ServiceProvider.GetRequiredService<HBContext>(); db.Database.Migrate(); + app.UseSession(); app.UseHsts(); app.UseHttpsRedirection(); app.UseStaticFiles(); |
