Added Imagesharp to the website stuff
This commit is contained in:
@@ -1,18 +1,24 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using SixLabors.ImageSharp.Web.DependencyInjection;
|
||||
|
||||
namespace Umbraco.Web.Website.AspNetCore
|
||||
{
|
||||
public static class UmbracoBackOfficeApplicationBuilderExtensions
|
||||
{
|
||||
public static IApplicationBuilder UseUmbracoWebsite(this IApplicationBuilder builder)
|
||||
public static IApplicationBuilder UseUmbracoWebsite(this IApplicationBuilder app)
|
||||
{
|
||||
if (builder == null)
|
||||
if (app == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(builder));
|
||||
throw new ArgumentNullException(nameof(app));
|
||||
}
|
||||
|
||||
return builder.UseMiddleware<UmbracoWebsiteMiddleware>();
|
||||
|
||||
// Important we handle image manipulations before the static files, otherwise the querystring is just ignored.
|
||||
app.UseImageSharp();
|
||||
app.UseStaticFiles();
|
||||
|
||||
return app;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace Umbraco.Web.Website.AspNetCore
|
||||
{
|
||||
public class UmbracoWebsiteMiddleware
|
||||
{
|
||||
private readonly RequestDelegate _next;
|
||||
public UmbracoWebsiteMiddleware(RequestDelegate next)
|
||||
{
|
||||
_next = next;
|
||||
}
|
||||
|
||||
public async Task InvokeAsync(HttpContext context)
|
||||
{
|
||||
|
||||
// Call the next delegate/middleware in the pipeline
|
||||
await _next(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SixLabors.ImageSharp.Web.DependencyInjection;
|
||||
|
||||
namespace Umbraco.Web.Website.AspNetCore
|
||||
{
|
||||
@@ -6,6 +7,9 @@ namespace Umbraco.Web.Website.AspNetCore
|
||||
{
|
||||
public static IServiceCollection AddUmbracoWebsite(this IServiceCollection services)
|
||||
{
|
||||
services.AddImageSharp();
|
||||
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user