mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-05-11 18:10:10 +08:00
27 lines
719 B
C#
27 lines
719 B
C#
using Microsoft.Extensions.FileProviders;
|
|
using Scalar.AspNetCore;
|
|
|
|
namespace Foxel.Extensions;
|
|
|
|
public static class ApplicationBuilderExtensions
|
|
{
|
|
public static void UseApplicationStaticFiles(this WebApplication app)
|
|
{
|
|
var uploadsPath = Path.Combine(Directory.GetCurrentDirectory(), "Uploads");
|
|
if (!Directory.Exists(uploadsPath))
|
|
{
|
|
Directory.CreateDirectory(uploadsPath);
|
|
}
|
|
|
|
app.UseStaticFiles(new StaticFileOptions
|
|
{
|
|
FileProvider = new PhysicalFileProvider(uploadsPath),
|
|
RequestPath = "/uploads"
|
|
});
|
|
}
|
|
|
|
public static void UseApplicationOpenApi(this WebApplication app)
|
|
{
|
|
app.MapOpenApi();
|
|
}
|
|
} |