🗑️ Remove built-in frontend serving code

This commit is contained in:
2025-09-19 00:14:37 +08:00
parent 1e374a73c7
commit 634958ffc5
25 changed files with 11 additions and 352 deletions

View File

@@ -1,24 +0,0 @@
using DysonNetwork.Shared.Data;
using DysonNetwork.Shared.PageData;
namespace DysonNetwork.Drive.Pages.Data;
public class VersionPageData : IPageDataProvider
{
public bool CanHandlePath(PathString path) => true;
public Task<IDictionary<string, object?>> GetAppDataAsync(HttpContext context)
{
var versionData = new AppVersion
{
Version = ThisAssembly.AssemblyVersion,
Commit = ThisAssembly.GitCommitId,
UpdateDate = ThisAssembly.GitCommitDate
};
var result = typeof(AppVersion).GetProperties()
.ToDictionary(property => property.Name, property => property.GetValue(versionData));
return Task.FromResult<IDictionary<string, object?>>(result);
}
}

View File

@@ -1,9 +1,7 @@
using DysonNetwork.Drive;
using DysonNetwork.Drive.Pages.Data;
using DysonNetwork.Drive.Startup;
using DysonNetwork.Shared.Auth;
using DysonNetwork.Shared.Http;
using DysonNetwork.Shared.PageData;
using DysonNetwork.Shared.Registry;
using Microsoft.EntityFrameworkCore;
using tusdotnet.Stores;
@@ -35,8 +33,6 @@ builder.Services.AddAppBusinessServices();
// Add scheduled jobs
builder.Services.AddAppScheduledJobs();
builder.Services.AddTransient<IPageDataProvider, VersionPageData>();
var app = builder.Build();
app.MapDefaultEndpoints();
@@ -48,13 +44,6 @@ using (var scope = app.Services.CreateScope())
await db.Database.MigrateAsync();
}
var tusDiskStore = app.Services.GetRequiredService<TusDiskStore>();
// Configure application middleware pipeline
app.ConfigureAppMiddleware(tusDiskStore, builder.Environment.ContentRootPath);
app.MapPages(Path.Combine(app.Environment.WebRootPath, "dist", "index.html"));
// Configure gRPC
app.ConfigureGrpcServices();

View File

@@ -7,7 +7,7 @@ namespace DysonNetwork.Drive.Startup;
public static class ApplicationBuilderExtensions
{
public static WebApplication ConfigureAppMiddleware(this WebApplication app, ITusStore tusStore, string contentRoot)
public static WebApplication ConfigureAppMiddleware(this WebApplication app, ITusStore tusStore)
{
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
@@ -28,12 +28,6 @@ public static class ApplicationBuilderExtensions
.AllowAnyMethod()
);
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)));
return app;