Add blazor & MVC Support (#602)
* Add initial code for Razor pages support * Remove finalizer * Try fully loading blazor This is most likely entirely broken because of a rebase now * UseSptBlazor after app.Use * Fix up StaticWebAsset loading, add MudBlazor * Implement page * Update comment * Replaced existing status page with razor * Track background video in LFS * Update attributes * Improved status page theming * Fix up wwwroot publish folder to SPT_Data/wwwroot * Added name to page * Remove unnecessary code * Begin fixing up MVC & Blazor for modding * Update TestMod * Cleanup todo * Further work out mod support * Re-order initialization and use logger * Rename library to SPTarkov.Server.Web --------- Co-authored-by: Chomp <dev@dev.sp-tarkov.com> Co-authored-by: Chomp <27521899+chompDev@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Authentication;
|
||||
using System.Text;
|
||||
@@ -20,6 +21,7 @@ using SPTarkov.Server.Core.Utils.Logger;
|
||||
using SPTarkov.Server.Logger;
|
||||
using SPTarkov.Server.Modding;
|
||||
using SPTarkov.Server.Services;
|
||||
using SPTarkov.Server.Web;
|
||||
|
||||
namespace SPTarkov.Server;
|
||||
|
||||
@@ -41,7 +43,7 @@ public static class Program
|
||||
ProgramStatics.Initialize();
|
||||
|
||||
// Create web builder and logger
|
||||
var builder = CreateNewHostBuilder(args);
|
||||
var builder = CreateNewHostBuilder();
|
||||
|
||||
var diHandler = new DependencyInjectionHandler(builder.Services);
|
||||
// register SPT components
|
||||
@@ -64,6 +66,8 @@ public static class Program
|
||||
}
|
||||
diHandler.InjectAll();
|
||||
|
||||
builder.InitializeSptBlazor(loadedMods);
|
||||
|
||||
builder.Services.AddSingleton(builder);
|
||||
builder.Services.AddSingleton<IReadOnlyList<SptMod>>(loadedMods);
|
||||
// Configure Kestrel options
|
||||
@@ -125,6 +129,8 @@ public static class Program
|
||||
await context.RequestServices.GetRequiredService<HttpServer>().HandleRequest(context, next);
|
||||
}
|
||||
);
|
||||
|
||||
app.UseSptBlazor();
|
||||
}
|
||||
|
||||
private static void ConfigureKestrel(WebApplicationBuilder builder)
|
||||
@@ -167,9 +173,9 @@ public static class Program
|
||||
);
|
||||
}
|
||||
|
||||
private static WebApplicationBuilder CreateNewHostBuilder(string[]? args = null)
|
||||
private static WebApplicationBuilder CreateNewHostBuilder()
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var builder = WebApplication.CreateBuilder(new WebApplicationOptions { WebRootPath = "./SPT_Data/wwwroot" });
|
||||
builder.Logging.ClearProviders();
|
||||
builder.Configuration.SetBasePath(Directory.GetCurrentDirectory());
|
||||
builder.Host.UseSptLogger();
|
||||
|
||||
Reference in New Issue
Block a user