summaryrefslogtreecommitdiff
path: root/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Program.cs')
-rw-r--r--Program.cs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Program.cs b/Program.cs
index 564ab30..e78f0d4 100644
--- a/Program.cs
+++ b/Program.cs
@@ -1,12 +1,16 @@
using Microsoft.EntityFrameworkCore;
using System.Text.Json.Serialization;
using HyperBooru.Services;
+using Microsoft.AspNetCore.Authentication.Cookies;
namespace HyperBooru;
public class Program {
public static void Main(string[] args) {
var builder = WebApplication.CreateBuilder(args);
+ builder.Services.AddHttpContextAccessor();
+ builder.Services.AddAuthentication(
+ CookieAuthenticationDefaults.AuthenticationScheme).AddCookie();
builder.Services.AddControllers().AddJsonOptions(o => {
var converter = new JsonStringEnumConverter();
o.JsonSerializerOptions.Converters.Add(converter);
@@ -20,7 +24,7 @@ public class Program {
builder.Services.AddScoped<ISearchService, SearchService>();
builder.Services.AddScoped<ITagService, TagService>();
builder.Services.AddScoped<IMediaService, MediaService>();
- builder.Services.AddSingleton<IUserService, UserService>();
+ builder.Services.AddScoped<IUserService, UserService>();
builder.Services.AddHostedService<OcrService>();
var app = builder.Build();