🐛 Fix drive web broke
This commit is contained in:
@@ -46,7 +46,7 @@ using (var scope = app.Services.CreateScope())
|
|||||||
var tusDiskStore = app.Services.GetRequiredService<TusDiskStore>();
|
var tusDiskStore = app.Services.GetRequiredService<TusDiskStore>();
|
||||||
|
|
||||||
// Configure application middleware pipeline
|
// Configure application middleware pipeline
|
||||||
app.ConfigureAppMiddleware(tusDiskStore);
|
app.ConfigureAppMiddleware(tusDiskStore, builder.Environment.ContentRootPath);
|
||||||
|
|
||||||
app.MapGatewayProxy();
|
app.MapGatewayProxy();
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
using DysonNetwork.Drive.Storage;
|
using DysonNetwork.Drive.Storage;
|
||||||
|
using Microsoft.Extensions.FileProviders;
|
||||||
using tusdotnet;
|
using tusdotnet;
|
||||||
using tusdotnet.Interfaces;
|
using tusdotnet.Interfaces;
|
||||||
|
|
||||||
@@ -6,7 +7,7 @@ namespace DysonNetwork.Drive.Startup;
|
|||||||
|
|
||||||
public static class ApplicationBuilderExtensions
|
public static class ApplicationBuilderExtensions
|
||||||
{
|
{
|
||||||
public static WebApplication ConfigureAppMiddleware(this WebApplication app, ITusStore tusStore)
|
public static WebApplication ConfigureAppMiddleware(this WebApplication app, ITusStore tusStore, string contentRoot)
|
||||||
{
|
{
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
@@ -18,6 +19,12 @@ public static class ApplicationBuilderExtensions
|
|||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
|
|
||||||
|
app.UseDefaultFiles();
|
||||||
|
app.UseStaticFiles(new StaticFileOptions
|
||||||
|
{
|
||||||
|
FileProvider = new PhysicalFileProvider(Path.Combine(contentRoot, "wwwroot", "dist"))
|
||||||
|
});
|
||||||
|
|
||||||
app.MapTus("/api/tus", _ => Task.FromResult(TusService.BuildConfiguration(tusStore, app.Configuration)));
|
app.MapTus("/api/tus", _ => Task.FromResult(TusService.BuildConfiguration(tusStore, app.Configuration)));
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
|
@@ -8,6 +8,20 @@ namespace DysonNetwork.Shared.PageData;
|
|||||||
|
|
||||||
public static class PageStartup
|
public static class PageStartup
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The method setup the single page application routes for you.
|
||||||
|
/// Before you calling this, ensure you have setup the static files and default files:
|
||||||
|
/// <code>
|
||||||
|
/// app.UseDefaultFiles();
|
||||||
|
/// app.UseStaticFiles(new StaticFileOptions
|
||||||
|
/// {
|
||||||
|
/// FileProvider = new PhysicalFileProvider(Path.Combine(contentRoot, "wwwroot", "dist"))
|
||||||
|
/// });
|
||||||
|
/// </code>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="app"></param>
|
||||||
|
/// <param name="defaultFile"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static WebApplication MapPages(this WebApplication app, string defaultFile)
|
public static WebApplication MapPages(this WebApplication app, string defaultFile)
|
||||||
{
|
{
|
||||||
#pragma warning disable ASP0016
|
#pragma warning disable ASP0016
|
||||||
|
Reference in New Issue
Block a user