Cleaned up config for WebRouting settings
This commit is contained in:
@@ -11,15 +11,15 @@ namespace Umbraco.Web
|
||||
{
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly IIOHelper _ioHelper;
|
||||
private readonly IUmbracoSettingsSection _settings;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IWebRoutingSettings _webRoutingSettings;
|
||||
|
||||
public AspNetBackOfficeInfo(IGlobalSettings globalSettings, IIOHelper ioHelper, IUmbracoSettingsSection settings, ILogger logger)
|
||||
public AspNetBackOfficeInfo(IGlobalSettings globalSettings, IIOHelper ioHelper, ILogger logger, IWebRoutingSettings webRoutingSettings)
|
||||
{
|
||||
_globalSettings = globalSettings;
|
||||
_ioHelper = ioHelper;
|
||||
_settings = settings;
|
||||
_logger = logger;
|
||||
_webRoutingSettings = webRoutingSettings;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -27,7 +27,7 @@ namespace Umbraco.Web
|
||||
|
||||
private string GetAbsoluteUrlFromConfig()
|
||||
{
|
||||
var url = _settings.WebRouting.UmbracoApplicationUrl;
|
||||
var url = _webRoutingSettings.UmbracoApplicationUrl;
|
||||
if (url.IsNullOrWhiteSpace() == false)
|
||||
{
|
||||
var umbracoApplicationUrl = url.TrimEnd('/');
|
||||
|
||||
@@ -19,12 +19,12 @@ namespace Umbraco.Web.Editors
|
||||
public class RedirectUrlManagementController : UmbracoAuthorizedApiController
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IUmbracoSettingsSection _umbracoSettingsSection;
|
||||
private readonly IWebRoutingSettings _webRoutingSettings;
|
||||
|
||||
public RedirectUrlManagementController(ILogger logger, IUmbracoSettingsSection umbracoSettingsSection)
|
||||
public RedirectUrlManagementController(ILogger logger, IWebRoutingSettings webRoutingSettings)
|
||||
{
|
||||
_logger = logger;
|
||||
_umbracoSettingsSection = umbracoSettingsSection ?? throw new ArgumentNullException(nameof(umbracoSettingsSection));
|
||||
_webRoutingSettings = webRoutingSettings;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -34,7 +34,7 @@ namespace Umbraco.Web.Editors
|
||||
[HttpGet]
|
||||
public IHttpActionResult GetEnableState()
|
||||
{
|
||||
var enabled = _umbracoSettingsSection.WebRouting.DisableRedirectUrlTracking == false;
|
||||
var enabled = _webRoutingSettings.DisableRedirectUrlTracking == false;
|
||||
var userIsAdmin = UmbracoContext.Security.CurrentUser.IsAdmin();
|
||||
return Ok(new { enabled, userIsAdmin });
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Umbraco.Web.Mvc
|
||||
base.OnActionExecuted(filterContext);
|
||||
|
||||
filterContext.HttpContext.Response.StatusCode = (int)_statusCode;
|
||||
filterContext.HttpContext.Response.TrySkipIisCustomErrors = Current.Configs.Settings().WebRouting.TrySkipIisCustomErrors;
|
||||
filterContext.HttpContext.Response.TrySkipIisCustomErrors = Current.Configs.WebRouting().TrySkipIisCustomErrors;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,8 +73,8 @@ namespace Umbraco.Web
|
||||
{
|
||||
return content.IsAllowedTemplate(
|
||||
Current.Services.ContentTypeService,
|
||||
Current.Configs.Settings().WebRouting.DisableAlternativeTemplates,
|
||||
Current.Configs.Settings().WebRouting.ValidateAlternativeTemplates,
|
||||
Current.Configs.WebRouting().DisableAlternativeTemplates,
|
||||
Current.Configs.WebRouting().ValidateAlternativeTemplates,
|
||||
templateId);
|
||||
}
|
||||
|
||||
@@ -83,8 +83,8 @@ namespace Umbraco.Web
|
||||
return content.IsAllowedTemplate(
|
||||
Current.Services.FileService,
|
||||
Current.Services.ContentTypeService,
|
||||
Current.Configs.Settings().WebRouting.DisableAlternativeTemplates,
|
||||
Current.Configs.Settings().WebRouting.ValidateAlternativeTemplates,
|
||||
Current.Configs.WebRouting().DisableAlternativeTemplates,
|
||||
Current.Configs.WebRouting().ValidateAlternativeTemplates,
|
||||
templateAlias);
|
||||
}
|
||||
|
||||
|
||||
@@ -240,7 +240,6 @@ namespace Umbraco.Web.Runtime
|
||||
|
||||
// register published router
|
||||
composition.RegisterUnique<IPublishedRouter, PublishedRouter>();
|
||||
composition.Register(_ => composition.Configs.Settings().WebRouting);
|
||||
|
||||
// register preview SignalR hub
|
||||
composition.RegisterUnique(_ => GlobalHost.ConnectionManager.GetHubContext<PreviewHub>());
|
||||
|
||||
@@ -26,17 +26,17 @@ namespace Umbraco.Web.Templates
|
||||
private readonly IPublishedRouter _publishedRouter;
|
||||
private readonly IFileService _fileService;
|
||||
private readonly ILocalizationService _languageService;
|
||||
private readonly IWebRoutingSection _webRoutingSection;
|
||||
private readonly IWebRoutingSettings _webRoutingSettings;
|
||||
private readonly IShortStringHelper _shortStringHelper;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public TemplateRenderer(IUmbracoContextAccessor umbracoContextAccessor, IPublishedRouter publishedRouter, IFileService fileService, ILocalizationService textService, IWebRoutingSection webRoutingSection, IShortStringHelper shortStringHelper, IHttpContextAccessor httpContextAccessor)
|
||||
public TemplateRenderer(IUmbracoContextAccessor umbracoContextAccessor, IPublishedRouter publishedRouter, IFileService fileService, ILocalizationService textService, IWebRoutingSettings webRoutingSettings, IShortStringHelper shortStringHelper, IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_umbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor));
|
||||
_publishedRouter = publishedRouter ?? throw new ArgumentNullException(nameof(publishedRouter));
|
||||
_fileService = fileService ?? throw new ArgumentNullException(nameof(fileService));
|
||||
_languageService = textService ?? throw new ArgumentNullException(nameof(textService));
|
||||
_webRoutingSection = webRoutingSection ?? throw new ArgumentNullException(nameof(webRoutingSection));
|
||||
_webRoutingSettings = webRoutingSettings ?? throw new ArgumentNullException(nameof(webRoutingSettings));
|
||||
_shortStringHelper = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
@@ -77,7 +77,7 @@ namespace Umbraco.Web.Templates
|
||||
//set the doc that was found by id
|
||||
contentRequest.PublishedContent = doc;
|
||||
//set the template, either based on the AltTemplate found or the standard template of the doc
|
||||
var templateId = _webRoutingSection.DisableAlternativeTemplates || !altTemplateId.HasValue
|
||||
var templateId = _webRoutingSettings.DisableAlternativeTemplates || !altTemplateId.HasValue
|
||||
? doc.TemplateId
|
||||
: altTemplateId.Value;
|
||||
if (templateId.HasValue)
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Umbraco.Web
|
||||
var configs = configFactory.Create(ioHelper);
|
||||
|
||||
var logger = SerilogLogger.CreateWithDefaultConfiguration(hostingEnvironment, new AspNetSessionManager(), () => _factory?.GetInstance<IRequestCache>(), coreDebug, ioHelper, new FrameworkMarchal());
|
||||
var backOfficeInfo = new AspNetBackOfficeInfo(configs.Global(), ioHelper, configs.Settings(), logger);
|
||||
var backOfficeInfo = new AspNetBackOfficeInfo(configs.Global(), ioHelper, logger, configFactory.WebRoutingSettings);
|
||||
var profiler = new LogProfiler(logger);
|
||||
Umbraco.Composing.Current.Initialize(logger, configs, ioHelper, hostingEnvironment, backOfficeInfo, profiler);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Umbraco.Web
|
||||
else if (pcr.Is404)
|
||||
{
|
||||
response.StatusCode = 404;
|
||||
response.TrySkipIisCustomErrors = Current.Configs.Settings().WebRouting.TrySkipIisCustomErrors;
|
||||
response.TrySkipIisCustomErrors = Current.Configs.WebRouting().TrySkipIisCustomErrors;
|
||||
|
||||
if (response.TrySkipIisCustomErrors == false)
|
||||
logger.Warn<UmbracoModule>("Status code is 404 yet TrySkipIisCustomErrors is false - IIS will take over.");
|
||||
|
||||
Reference in New Issue
Block a user