2022-06-20 08:37:17 +02:00
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Umbraco.Cms.Core;
|
2021-02-18 11:06:02 +01:00
|
|
|
using Umbraco.Cms.Core.Hosting;
|
|
|
|
|
using Umbraco.Cms.Web.BackOffice.Controllers;
|
|
|
|
|
using Umbraco.Cms.Web.Common.Attributes;
|
|
|
|
|
using Umbraco.Cms.Web.Common.Authorization;
|
2020-05-25 13:41:05 +02:00
|
|
|
|
2022-06-20 08:37:17 +02:00
|
|
|
namespace Umbraco.Cms.Web.BackOffice.Profiling;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The API controller used to display the state of the web profiler
|
|
|
|
|
/// </summary>
|
|
|
|
|
[PluginController(Constants.Web.Mvc.BackOfficeApiArea)]
|
|
|
|
|
[Authorize(Policy = AuthorizationPolicies.SectionAccessSettings)]
|
|
|
|
|
public class WebProfilingController : UmbracoAuthorizedJsonController
|
2020-05-25 13:41:05 +02:00
|
|
|
{
|
2022-06-20 08:37:17 +02:00
|
|
|
private readonly IHostingEnvironment _hosting;
|
2020-05-25 13:41:05 +02:00
|
|
|
|
2022-06-20 08:37:17 +02:00
|
|
|
public WebProfilingController(IHostingEnvironment hosting) => _hosting = hosting;
|
2020-05-25 13:41:05 +02:00
|
|
|
|
2022-06-20 08:37:17 +02:00
|
|
|
public object GetStatus() =>
|
|
|
|
|
new { Enabled = _hosting.IsDebugMode };
|
|
|
|
|
}
|