diff options
| author | Jake Mannens <jake@asger.xyz> | 2026-05-22 12:46:00 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2026-05-23 22:13:00 +1000 |
| commit | 4ea3ddb38d010c2f85c22b7f1c3f2d7e0c1355e3 (patch) | |
| tree | 90af9203059d645eb77216f1a091722ee9702438 /Program.cs | |
| parent | 6de5d7f5364fe1d54703da6d6b7cb08ea26e939f (diff) | |
Initial commitwasm-oldserver
Diffstat (limited to 'Program.cs')
| -rw-r--r-- | Program.cs | 31 |
1 files changed, 0 insertions, 31 deletions
@@ -1,9 +1,5 @@ -using HyperBooru.Services; using Microsoft.AspNetCore.Authentication.Cookies; -using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Http.Json; -using Microsoft.EntityFrameworkCore; -using System.Text.Json.Serialization; namespace HyperBooru; @@ -11,14 +7,9 @@ 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(); builder.Services.AddAuthorization(); - builder.Services.AddControllers().AddJsonOptions(o => { - var converter = new JsonStringEnumConverter(); - o.JsonSerializerOptions.Converters.Add(converter); - }); builder.Services.Configure<JsonOptions>(o => { o.SerializerOptions.TypeInfoResolverChain.Insert(0, new ExceptionJsonResolver()); }); @@ -26,30 +17,9 @@ public class Program { builder.Services.AddServerSideBlazor(); // Add our custom services - builder.Services.AddSingleton<IConfigService, ConfigService>(); - builder.Services.AddDbContextFactory<HBContext>(); - builder.Services.AddScoped<IFeedService, FeedService>(); - builder.Services.AddScoped<ITagService, TagService>(); - builder.Services.AddScoped<IMediaService, MediaService>(); - builder.Services.AddSingleton<IGlobalUserService, GlobalUserService>(); - builder.Services.AddScoped<IUserService, UserService>(); - builder.Services.AddHostedService<OcrService>(); - builder.Services.AddSingleton<ISourceService, SourceService>(); - - // Ensure session keys are stored in a persistent location on all platforms - builder.Services.AddDataProtection() - .PersistKeysToFileSystem(new( - builder.Services.BuildServiceProvider() - .GetRequiredService<IConfigService>() - .KeyPath)); var app = builder.Build(); - // Ensure database is created and it's schema is up to date - using var scope = app.Services.CreateScope(); - using var db = scope.ServiceProvider.GetRequiredService<HBContext>(); - db.Database.Migrate(); - app.UseRouting(); app.UseSession(); app.UseAuthentication(); @@ -59,7 +29,6 @@ public class Program { app.UseStaticFiles(); app.UseMiddleware<ExceptionMiddleware>(); app.MapBlazorHub(); - app.MapControllers(); app.MapFallbackToPage("/_Host"); app.Run(); |
