From b53763824be304fbe555dbf4ebca4812e348a62f Mon Sep 17 00:00:00 2001 From: Sakura Akeno Isayeki Date: Sun, 14 Jan 2024 11:58:12 +0100 Subject: [PATCH 01/12] feat: Update target framework to .NET 8.0 + Bump dependencies versions - Updated the target framework from net7.0 to net8.0 in the SocialGuard.Web.csproj file. - Updated the version of Nodsoft.MoltenObsidian.Blazor package from 0.3.16 to 0.5.18. - Updated the version of Nodsoft.MoltenObsidian.Vaults.Http package from 0.3.16 to 0.5.18. - Updated the version of Serilog.AspNetCore package from 6.1.0 to 8.0.0. - Updated the version of Serilog.Extensions.Logging package from 3.1.0 to 8.0.0. These changes ensure compatibility with newer frameworks and libraries, improving overall functionality and performance of the application. --- SocialGuard.Web/SocialGuard.Web.csproj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SocialGuard.Web/SocialGuard.Web.csproj b/SocialGuard.Web/SocialGuard.Web.csproj index b167bcd..197781d 100644 --- a/SocialGuard.Web/SocialGuard.Web.csproj +++ b/SocialGuard.Web/SocialGuard.Web.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 @@ -10,10 +10,10 @@ - - - - + + + + From 0a61b50e301a0cc90b7974f4b2bb84212cbf9307 Mon Sep 17 00:00:00 2001 From: Sakura Akeno Isayeki Date: Sun, 14 Jan 2024 11:59:05 +0100 Subject: [PATCH 02/12] feat: Add InteractiveAutoRenderMode to App.razor - Added `@rendermode="new InteractiveAutoRenderMode()"` to the `` component in `App.razor`. --- SocialGuard.Web/App.razor | 2 +- SocialGuard.Web/Startup.cs | 131 +++++++++++++++++++------------------ 2 files changed, 67 insertions(+), 66 deletions(-) diff --git a/SocialGuard.Web/App.razor b/SocialGuard.Web/App.razor index 6f67a6e..8e86f23 100644 --- a/SocialGuard.Web/App.razor +++ b/SocialGuard.Web/App.razor @@ -1,4 +1,4 @@ - + diff --git a/SocialGuard.Web/Startup.cs b/SocialGuard.Web/Startup.cs index 49e900a..c22580b 100644 --- a/SocialGuard.Web/Startup.cs +++ b/SocialGuard.Web/Startup.cs @@ -6,94 +6,95 @@ using Microsoft.Extensions.Hosting; using SocialGuard.Web.Services; using SocialGuard.Web.Services.Logging; -using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using Nodsoft.MoltenObsidian.Blazor; -namespace SocialGuard.Web +namespace SocialGuard.Web; + +public sealed class Startup { - public class Startup + public Startup(IConfiguration configuration) { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } + Configuration = configuration; + } - public IConfiguration Configuration { get; } + public IConfiguration Configuration { get; } - // This method gets called by the runtime. Use this method to add services to the container. - // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 - public void ConfigureServices(IServiceCollection services) - { - services.AddRazorPages(); - services.AddServerSideBlazor(); - services.AddDistributedMemoryCache(); - services.AddDirectoryBrowser(); + // This method gets called by the runtime. Use this method to add services to the container. + // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 + public void ConfigureServices(IServiceCollection services) + { + services.AddRazorPages(); + + services.AddServerSideBlazor() + .AddInteractiveServerComponents(); + + services.AddDistributedMemoryCache(); + services.AddDirectoryBrowser(); - // Add the MoltenObsidian Vault - services.AddHttpClient("Docs", client => client.BaseAddress = new(Configuration["Docs:WebRoot"])); - services.AddMoltenObsidianHttpVault(static services => services.GetRequiredService().CreateClient("Docs")); - services.AddMoltenObsidianBlazorIntegration(); + // Add the MoltenObsidian Vault + services.AddHttpClient("Docs", client => client.BaseAddress = new(Configuration["Docs:WebRoot"])); + services.AddMoltenObsidianHttpVault(static services => services.GetRequiredService().CreateClient("Docs")); + services.AddMoltenObsidianBlazorIntegration(); - services.AddCors(c => c.AddDefaultPolicy(builder => builder - .AllowAnyOrigin() - .AllowAnyHeader() - .AllowAnyMethod())); + services.AddCors(c => c.AddDefaultPolicy(builder => builder + .AllowAnyOrigin() + .AllowAnyHeader() + .AllowAnyMethod())); - services.AddSingleton(); - } + services.AddSingleton(); + } - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - else if (env.IsProduction()) + app.UseDeveloperExceptionPage(); + } + else if (env.IsProduction()) + { + IPAddress[] allowedProxies = Configuration.GetSection("AllowedProxies").Get()?.Select(IPAddress.Parse).ToArray() ?? []; + + // Nginx configuration step + ForwardedHeadersOptions forwardedHeadersOptions = new() { - IEnumerable allowedProxies = Configuration.GetSection("AllowedProxies")?.Get()?.Select(x => IPAddress.Parse(x)); + ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto + }; - // Nginx configuration step - ForwardedHeadersOptions forwardedHeadersOptions = new() - { - ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto - }; + if (allowedProxies is { Length: not 0 }) + { + forwardedHeadersOptions.KnownProxies.Clear(); - if (allowedProxies is not null && allowedProxies.Any()) + foreach (IPAddress address in allowedProxies) { - forwardedHeadersOptions.KnownProxies.Clear(); - - foreach (IPAddress address in allowedProxies) - { - forwardedHeadersOptions.KnownProxies.Add(address); - } + forwardedHeadersOptions.KnownProxies.Add(address); } - - app.UseExceptionHandler("/Error"); - // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. - app.UseHsts(); } + + app.UseExceptionHandler("/Error"); + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); + } - app.UseHttpsRedirection(); + app.UseHttpsRedirection(); - app.UseMiddleware(); + app.UseMiddleware(); - app.UseStaticFiles(); - // app.UseStaticFiles("/viewer"); - // app.UseBlazorFrameworkFiles("/viewer"); + app.UseStaticFiles(); + // app.UseStaticFiles("/viewer"); + // app.UseBlazorFrameworkFiles("/viewer"); - app.UseRouting(); - app.UseCors(); + app.UseRouting(); + app.UseCors(); - app.UseEndpoints(endpoints => - { - endpoints.MapBlazorHub(); - endpoints.MapFallbackToFile("/viewer/{*path:nonfile}", "viewer/index.html"); - endpoints.MapFallbackToPage("/_Host"); - }); - } + app.UseEndpoints(endpoints => + { + endpoints.MapBlazorHub(); + endpoints.MapFallbackToFile("/viewer/{*path:nonfile}", "viewer/index.html"); + endpoints.MapFallbackToPage("/_Host"); + }); } -} +} \ No newline at end of file From cabe44e899682c10c9a822b772c759b99258bcf1 Mon Sep 17 00:00:00 2001 From: Sakura Akeno Isayeki Date: Sun, 14 Jan 2024 12:21:23 +0100 Subject: [PATCH 03/12] feat(docs): Improve display of index note navigation - Updated the rendering of the `FoundIndexNote` component in `Docs.razor` - Added logic to conditionally display index note navigation based on the presence of a non-empty `VaultPath` - Modified the `VaultDisplayOptions` property initialization to include a trailing space for consistency --- SocialGuard.Web/Pages/Docs.razor | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/SocialGuard.Web/Pages/Docs.razor b/SocialGuard.Web/Pages/Docs.razor index 6908924..d3780be 100644 --- a/SocialGuard.Web/Pages/Docs.razor +++ b/SocialGuard.Web/Pages/Docs.razor @@ -18,7 +18,17 @@

Not Found

- @FoundNote.Render(context.Item1) + + @FoundIndexNote.Render(context with + { + DisplayOptions = context.DisplayOptions with + { + DisplayIndexNoteNavigation = VaultPath is not (null or "") + } + }) + + + @@ -31,7 +41,7 @@ [Parameter] public string VaultPath { get; set; } - public static ObsidianVaultDisplayOptions VaultDisplayOptions { get; } = new() { }; + public static ObsidianVaultDisplayOptions VaultDisplayOptions { get; } = new() { }; /// /// Builds a Bootstrap breadcrumb using a slash-separated path string. From 253f7a3c86c893262abd3a83e3fa91e90bbfc59b Mon Sep 17 00:00:00 2001 From: Sakura Akeno Isayeki Date: Sat, 10 Feb 2024 11:20:21 +0100 Subject: [PATCH 04/12] refactor: Various refactors --- .../Authentication/AuthenticationService.cs | 4 +- SocialGuard.Api/Startup.cs | 371 +++++++++--------- SocialGuard.Common/Data/Models/Emitter.cs | 2 +- SocialGuard.Web/Program.cs | 40 +- .../Shared/Docs/VaultSidebar.razor | 10 +- 5 files changed, 207 insertions(+), 220 deletions(-) diff --git a/SocialGuard.Api/Services/Authentication/AuthenticationService.cs b/SocialGuard.Api/Services/Authentication/AuthenticationService.cs index 033392e..4e2350f 100644 --- a/SocialGuard.Api/Services/Authentication/AuthenticationService.cs +++ b/SocialGuard.Api/Services/Authentication/AuthenticationService.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Identity; using Microsoft.IdentityModel.Tokens; using SocialGuard.Common.Data.Models.Authentication; using System.IdentityModel.Tokens.Jwt; @@ -141,4 +141,4 @@ public record AuthServiceResponse public Response Response { get; init; } } -public record AuthServiceResponse : AuthServiceResponse; \ No newline at end of file +public sealed record AuthServiceResponse : AuthServiceResponse; \ No newline at end of file diff --git a/SocialGuard.Api/Startup.cs b/SocialGuard.Api/Startup.cs index d6120b0..8bfd76a 100644 --- a/SocialGuard.Api/Startup.cs +++ b/SocialGuard.Api/Startup.cs @@ -22,247 +22,246 @@ using SocialGuard.Api.Services.Admin; -namespace SocialGuard.Api +namespace SocialGuard.Api; + +public class Startup { - public class Startup + public Startup(IConfiguration configuration) { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } + Configuration = configuration; + } - public IConfiguration Configuration { get; } - public static string Version { get; } = typeof(Startup).Assembly.GetCustomAttribute()?.InformationalVersion; + public IConfiguration Configuration { get; } + public static string Version { get; } = typeof(Startup).Assembly.GetCustomAttribute()?.InformationalVersion; - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) - { - services.AddControllers(config => { config.ModelBinderProviders.Insert(0, new CommaSeparatedArrayModelBinderProvider()); }); + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.AddControllers(config => { config.ModelBinderProviders.Insert(0, new CommaSeparatedArrayModelBinderProvider()); }); - services.AddApiVersioning(config => - { - config.DefaultApiVersion = new(3, 1, "rc1"); - config.AssumeDefaultVersionWhenUnspecified = true; - config.ReportApiVersions = true; - } - ); + services.AddApiVersioning(config => + { + config.DefaultApiVersion = new(3, 1, "rc1"); + config.AssumeDefaultVersionWhenUnspecified = true; + config.ReportApiVersions = true; + } + ); - services.AddVersionedApiExplorer(options => - { - // add the versioned api explorer, which also adds IApiVersionDescriptionProvider service - // note: the specified format code will format the version as "'v'major[.minor][-status]" - options.GroupNameFormat = "'v'VVV"; + services.AddVersionedApiExplorer(options => + { + // add the versioned api explorer, which also adds IApiVersionDescriptionProvider service + // note: the specified format code will format the version as "'v'major[.minor][-status]" + options.GroupNameFormat = "'v'VVV"; - // note: this option is only necessary when versioning by url segment. the SubstitutionFormat - // can also be used to control the format of the API version in route templates - options.SubstituteApiVersionInUrl = true; - } - ); + // note: this option is only necessary when versioning by url segment. the SubstitutionFormat + // can also be used to control the format of the API version in route templates + options.SubstituteApiVersionInUrl = true; + } + ); - string dbConnectionString = Configuration.GetConnectionString("Database"); + string dbConnectionString = Configuration.GetConnectionString("Database"); - services.AddDbContextPool(o => - o.UseNpgsql(dbConnectionString, p => - p.EnableRetryOnFailure() - ) - .UseSnakeCaseNamingConvention() - ); + services.AddDbContextPool(o => + o.UseNpgsql(dbConnectionString, p => + p.EnableRetryOnFailure() + ) + .UseSnakeCaseNamingConvention() + ); - services.AddDbContextPool(o => - o.UseNpgsql(dbConnectionString, p => - p.EnableRetryOnFailure() - ) - .UseSnakeCaseNamingConvention() - ); + services.AddDbContextPool(o => + o.UseNpgsql(dbConnectionString, p => + p.EnableRetryOnFailure() + ) + .UseSnakeCaseNamingConvention() + ); + + services.AddTransient, ConfigureSwaggerOptions>(); - services.AddTransient, ConfigureSwaggerOptions>(); + services.AddSwaggerGen(options => + { + options.OperationFilter(); + + // Set the comments path for the Swagger JSON and UI. + string xmlFile = $"{typeof(Startup).Assembly.GetName().Name}.xml"; + string xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); + options.IncludeXmlComments(xmlPath); + + // Bearer token authentication + options.AddSecurityDefinition("jwt_auth", new() + { + Name = "bearer", + BearerFormat = "JWT", + Scheme = "bearer", + Description = "Specify the authorization token.", + In = ParameterLocation.Header, + Type = SecuritySchemeType.Http, + } + ); - services.AddSwaggerGen(options => + // Make sure swagger UI requires a Bearer token specified + OpenApiSecurityScheme securityScheme = new() { - options.OperationFilter(); - - // Set the comments path for the Swagger JSON and UI. - string xmlFile = $"{typeof(Startup).Assembly.GetName().Name}.xml"; - string xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); - options.IncludeXmlComments(xmlPath); - - // Bearer token authentication - options.AddSecurityDefinition("jwt_auth", new() - { - Name = "bearer", - BearerFormat = "JWT", - Scheme = "bearer", - Description = "Specify the authorization token.", - In = ParameterLocation.Header, - Type = SecuritySchemeType.Http, - } - ); - - // Make sure swagger UI requires a Bearer token specified - OpenApiSecurityScheme securityScheme = new() + Reference = new() { - Reference = new() - { - Id = "jwt_auth", - Type = ReferenceType.SecurityScheme - } - }; + Id = "jwt_auth", + Type = ReferenceType.SecurityScheme + } + }; - options.AddSecurityRequirement(new() - { - { securityScheme, Array.Empty() } - } - ); - } - ); + options.AddSecurityRequirement(new() + { + { securityScheme, Array.Empty() } + } + ); + } + ); - services.AddSignalR(config => config.EnableDetailedErrors = true) - .AddMessagePackProtocol(); + services.AddSignalR(config => config.EnableDetailedErrors = true) + .AddMessagePackProtocol(); - /* - services.AddIdentityMongoDbProvider( - options => { }, - mongo => - { - IConfigurationSection config = Configuration.GetSection("Auth"); - mongo.ConnectionString = config["ConnectionString"]; - mongo.MigrationCollection = config["Tables:Migration"]; - mongo.RolesCollection = config["Tables:Role"]; - mongo.UsersCollection = config["Tables:User"]; - }); - */ + /* + services.AddIdentityMongoDbProvider( + options => { }, + mongo => + { + IConfigurationSection config = Configuration.GetSection("Auth"); + mongo.ConnectionString = config["ConnectionString"]; + mongo.MigrationCollection = config["Tables:Migration"]; + mongo.RolesCollection = config["Tables:Role"]; + mongo.UsersCollection = config["Tables:User"]; + }); + */ - // Add Identity - services.AddIdentity() - .AddEntityFrameworkStores() - .AddDefaultTokenProviders(); + // Add Identity + services.AddIdentity() + .AddEntityFrameworkStores() + .AddDefaultTokenProviders(); - services.AddAuthentication(options => - { - options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; - options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; - options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme; - } - ) + services.AddAuthentication(options => + { + options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; + options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; + options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme; + } + ) - // Adding Jwt Bearer - .AddJwtBearer(options => + // Adding Jwt Bearer + .AddJwtBearer(options => + { + options.SaveToken = true; + options.RequireHttpsMetadata = false; + options.TokenValidationParameters = new() { - options.SaveToken = true; - options.RequireHttpsMetadata = false; - options.TokenValidationParameters = new() - { - ValidateIssuer = true, - ValidateAudience = true, - ValidAudience = Configuration["JWT:ValidAudience"], - ValidIssuer = Configuration["JWT:ValidIssuer"], - IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["JWT:Secret"])) - }; - } - ); - - services.AddCors(c => c.AddDefaultPolicy(builder => builder - .AllowAnyOrigin() - .AllowAnyHeader() - .AllowAnyMethod() - ) + ValidateIssuer = true, + ValidateAudience = true, + ValidAudience = Configuration["JWT:ValidAudience"], + ValidIssuer = Configuration["JWT:ValidIssuer"], + IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["JWT:Secret"])) + }; + } ); + services.AddCors(c => c.AddDefaultPolicy(builder => builder + .AllowAnyOrigin() + .AllowAnyHeader() + .AllowAnyMethod() + ) + ); - services.AddTransient(); - services.AddTransient(); + services.AddTransient(); - services.AddSingleton(s => new MongoClient(Configuration["MongoDatabase:ConnectionString"]).GetDatabase(Configuration["MongoDatabase:DatabaseName"])); + services.AddTransient(); - services.AddScoped() - .AddScoped(); + services.AddSingleton(s => new MongoClient(Configuration["MongoDatabase:ConnectionString"]).GetDatabase(Configuration["MongoDatabase:DatabaseName"])); - services.AddTransient(); + services.AddScoped() + .AddScoped(); - services.AddApplicationInsightsTelemetry(options => - { + services.AddTransient(); + + services.AddApplicationInsightsTelemetry(options => + { #if DEBUG - options.DeveloperMode = true; + options.DeveloperMode = true; #endif - } - ); + } + ); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApiVersionDescriptionProvider provider) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); } - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApiVersionDescriptionProvider provider) + List allowedProxies = Configuration.GetSection("AllowedProxies")?.Get()?.Select(IPAddress.Parse).ToList(); + + // Nginx configuration step + ForwardedHeadersOptions forwardedHeadersOptions = new() { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } + ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto + }; - List allowedProxies = Configuration.GetSection("AllowedProxies")?.Get()?.Select(IPAddress.Parse).ToList(); + if (allowedProxies is { Count: > 0 }) + { + forwardedHeadersOptions.KnownProxies.Clear(); - // Nginx configuration step - ForwardedHeadersOptions forwardedHeadersOptions = new() + foreach (IPAddress address in allowedProxies) { - ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto - }; + forwardedHeadersOptions.KnownProxies.Add(address); + } + } + + app.UseStaticFiles(); - if (allowedProxies is { Count: > 0 }) + app.UseSwagger(options => { options.RouteTemplate = "swagger/{documentName}/swagger.json"; }); + app.UseSwaggerUI(options => { - forwardedHeadersOptions.KnownProxies.Clear(); + options.RoutePrefix = "swagger"; - foreach (IPAddress address in allowedProxies) + foreach (ApiVersionDescription description in provider.ApiVersionDescriptions.OrderByDescending(x => x.ApiVersion)) { - forwardedHeadersOptions.KnownProxies.Add(address); + options.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json", description.GroupName.ToLowerInvariant()); } } + ); - app.UseStaticFiles(); - - app.UseSwagger(options => { options.RouteTemplate = "swagger/{documentName}/swagger.json"; }); - app.UseSwaggerUI(options => - { - options.RoutePrefix = "swagger"; - - foreach (ApiVersionDescription description in provider.ApiVersionDescriptions.OrderByDescending(x => x.ApiVersion)) - { - options.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json", description.GroupName.ToLowerInvariant()); - } - } - ); - - app.UseHttpsRedirection(); + app.UseHttpsRedirection(); - app.UseRouting(); - app.UseCors(); + app.UseRouting(); + app.UseCors(); - app.UseForwardedHeaders(forwardedHeadersOptions); + app.UseForwardedHeaders(forwardedHeadersOptions); - app.UseAuthentication(); - app.UseAuthorization(); + app.UseAuthentication(); + app.UseAuthorization(); - app.UseMiddleware(); + app.UseMiddleware(); - app.UseEndpoints(endpoints => - { - /* - * Remove once proper website is built. - */ - endpoints.MapGet("/", context => - { - context.Response.Redirect("/swagger/index.html"); + app.UseEndpoints(endpoints => + { + /* + * Remove once proper website is built. + */ + endpoints.MapGet("/", context => + { + context.Response.Redirect("/swagger/index.html"); - return Task.CompletedTask; - } - ); + return Task.CompletedTask; + } + ); - endpoints.MapControllers(); + endpoints.MapControllers(); - endpoints.MapHub("/hubs/trustlist"); - } - ); - } + endpoints.MapHub("/hubs/trustlist"); + } + ); } } \ No newline at end of file diff --git a/SocialGuard.Common/Data/Models/Emitter.cs b/SocialGuard.Common/Data/Models/Emitter.cs index f943309..176d90b 100644 --- a/SocialGuard.Common/Data/Models/Emitter.cs +++ b/SocialGuard.Common/Data/Models/Emitter.cs @@ -13,6 +13,6 @@ public record Emitter public ulong Snowflake { get; init; } - [Required, DisallowNull] + [Required] public string DisplayName { get; init; } = string.Empty; } diff --git a/SocialGuard.Web/Program.cs b/SocialGuard.Web/Program.cs index eebfa4b..2b198b6 100644 --- a/SocialGuard.Web/Program.cs +++ b/SocialGuard.Web/Program.cs @@ -9,35 +9,31 @@ -namespace SocialGuard.Web +namespace SocialGuard.Web; + +public class Program { - public class Program + public static async Task Main(string[] args) { - public static async Task Main(string[] args) - { - IHost host = CreateHostBuilder(args).Build(); + IHost host = CreateHostBuilder(args).Build(); - Log.Logger = new LoggerConfiguration() - #if DEBUG - .MinimumLevel.Debug() + Log.Logger = new LoggerConfiguration() +#if DEBUG + .MinimumLevel.Debug() #else .MinimumLevel.Information() .MinimumLevel.Override("Microsoft", LogEventLevel.Warning) .MinimumLevel.Override("Microsoft.Hosting.Lifetime", LogEventLevel.Information) #endif - .Enrich.FromLogContext() - .WriteTo.Console() - .CreateLogger(); - - await host.RunAsync(); - } + .Enrich.FromLogContext() + .WriteTo.Console() + .CreateLogger(); - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup(); - webBuilder.UseSerilog(); - }); + await host.RunAsync(); } -} + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup()) + .UseSerilog(); +} \ No newline at end of file diff --git a/SocialGuard.Web/Shared/Docs/VaultSidebar.razor b/SocialGuard.Web/Shared/Docs/VaultSidebar.razor index 9214317..404e6b8 100644 --- a/SocialGuard.Web/Shared/Docs/VaultSidebar.razor +++ b/SocialGuard.Web/Shared/Docs/VaultSidebar.razor @@ -1,12 +1,4 @@ -