Moves routing into IAreaRoutes, ensures back office is redirected if installed
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SixLabors.ImageSharp.Web.DependencyInjection;
|
||||
using Umbraco.Extensions;
|
||||
using Umbraco.Web.BackOffice.Routing;
|
||||
|
||||
namespace Umbraco.Extensions
|
||||
{
|
||||
@@ -15,18 +16,8 @@ namespace Umbraco.Extensions
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
// TODO: This is temporary, 'umbraco' cannot be hard coded, needs to use GetUmbracoMvcArea()
|
||||
// but actually we need to route all back office stuff in a back office area like we do in v8
|
||||
|
||||
// TODO: We will also need to detect runtime state here and redirect to the installer,
|
||||
// Potentially switch this to dynamic routing so we can essentially disable/overwrite the back office routes to redirect to install
|
||||
// when required, example https://www.strathweb.com/2019/08/dynamic-controller-routing-in-asp-net-core-3-0/
|
||||
|
||||
endpoints.MapControllerRoute("Backoffice", "/umbraco/{Action}", new
|
||||
{
|
||||
Controller = "BackOffice",
|
||||
Action = "Default"
|
||||
});
|
||||
var backOfficeRoutes = app.ApplicationServices.GetRequiredService<BackOfficeAreaRoutes>();
|
||||
backOfficeRoutes.CreateRoutes(endpoints);
|
||||
});
|
||||
|
||||
app.UseUmbracoRuntimeMinification();
|
||||
|
||||
Reference in New Issue
Block a user