Skip to content

Commit

Permalink
Serve media files
Browse files Browse the repository at this point in the history
  • Loading branch information
Foxocube committed Jan 1, 2025
1 parent ba1d314 commit 581f1cc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions MediaFeeder/MediaFeeder/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using OpenTelemetry.Trace;
using MediaFeeder.Services;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.Extensions.FileProviders;
using IPNetwork = Microsoft.AspNetCore.HttpOverrides.IPNetwork;

var builder = WebApplication.CreateBuilder(args);
Expand Down Expand Up @@ -153,6 +154,12 @@

app.UseAntiforgery();

app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(app.Configuration.GetValue<string>("MediaRoot")),
RequestPath = new PathString("/media")
});

app.MapStaticAssets();
app.MapControllers();
app.MapRazorComponents<App>()
Expand Down

0 comments on commit 581f1cc

Please sign in to comment.