Files
Umbraco-CMS/src/Umbraco.Web.Common/AspNetCore/AspNetCoreBackOfficeInfo.cs
Sven Geusens e7eb14d310 V15/task/cleanup obsolete (#17433)
* Replace obsolete UserGroup Alias consts to key equivalent in tests

* Update use of usergroup alias consts to key equivalent in IsSystemgroup extension method

* Obsolete (internally) unused helper function which purpose doesn't even seem true

* Prepped EmbedProviders for proper removal of non async methods and unneeded proxy methods

* Remove obsoleted UmbracoPath and updated internal references

* Corrected  mistake and updated unittets

* Update usergroup tests that use aliases for "system" groups

* Replace more uses of globalsettings.UmbracoPath

* Remove GetDateType by key non async

* Cleanup some usages of hostingEnvironment.MapPathContentRoot

* More easy obsoletion cleanup

* Small Typeload cleanup

* More obsolete removal

* Deploy obsoletion cleanup

* Remove obsolete methods from OEmbedProviderBase.cs

---------

Co-authored-by: Zeegaan <skrivdetud@gmail.com>
2024-11-07 12:20:22 +01:00

44 lines
1.3 KiB
C#

using Microsoft.Extensions.Options;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Hosting;
using Umbraco.Cms.Core.Routing;
using static Umbraco.Cms.Core.Constants;
namespace Umbraco.Cms.Web.Common.AspNetCore;
public class AspNetCoreBackOfficeInfo : IBackOfficeInfo
{
private readonly IOptionsMonitor<GlobalSettings> _globalSettings;
private readonly IHostingEnvironment _hostingEnvironment;
private string? _getAbsoluteUrl;
public AspNetCoreBackOfficeInfo(
IOptionsMonitor<GlobalSettings> globalSettings,
IHostingEnvironment hostingEnviroment)
{
_globalSettings = globalSettings;
_hostingEnvironment = hostingEnviroment;
}
public string GetAbsoluteUrl
{
get
{
if (_getAbsoluteUrl is null)
{
if (_hostingEnvironment.ApplicationMainUrl is null)
{
return string.Empty;
}
_getAbsoluteUrl = WebPath.Combine(
_hostingEnvironment.ApplicationMainUrl.ToString(),
Core.Constants.System.DefaultUmbracoPath.TrimStart(CharArrays.TildeForwardSlash));
}
return _getAbsoluteUrl;
}
}
}