mirror of
https://github.com/CyberL1/MyMcRealms.git
synced 2024-11-24 06:58:22 -05:00
feat: public directory
This commit is contained in:
parent
c93673367a
commit
fbf2e8b9bb
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using MyMcRealms.Data;
|
||||
using MyMcRealms.Helpers;
|
||||
using MyMcRealms.Middlewares;
|
||||
@ -25,6 +26,7 @@ builder.Services.AddControllers().AddJsonOptions(x => x.JsonSerializerOptions.Re
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
builder.Services.AddDirectoryBrowser();
|
||||
|
||||
var dataSourceBuilder = new NpgsqlDataSourceBuilder(Environment.GetEnvironmentVariable("CONNECTION_STRING"));
|
||||
dataSourceBuilder.EnableDynamicJson();
|
||||
@ -50,5 +52,21 @@ if (app.Environment.IsDevelopment())
|
||||
app.UseMiddleware<MinecraftCookieMiddleware>();
|
||||
|
||||
app.MapControllers();
|
||||
app.UseStaticFiles();
|
||||
|
||||
var fileProvider = new PhysicalFileProvider(Path.Combine(builder.Environment.WebRootPath, "public"));
|
||||
var requestPath = "/public";
|
||||
|
||||
app.UseStaticFiles(new StaticFileOptions
|
||||
{
|
||||
FileProvider = fileProvider,
|
||||
RequestPath = requestPath
|
||||
});
|
||||
|
||||
app.UseDirectoryBrowser(new DirectoryBrowserOptions
|
||||
{
|
||||
FileProvider = fileProvider,
|
||||
RequestPath = requestPath
|
||||
});
|
||||
|
||||
app.Run();
|
||||
|
2
MyMcRealms/wwwroot/public/README.txt
Normal file
2
MyMcRealms/wwwroot/public/README.txt
Normal file
@ -0,0 +1,2 @@
|
||||
This directory ~~is~~ will be used for plugin files serving.
|
||||
Plugin files will be named in the following way: `MyMcRealms-MC_VERSION.jar`
|
Loading…
Reference in New Issue
Block a user