2020-03-30 21:27:35 +02:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2020-04-02 17:41:00 +11:00
|
|
|
|
using Umbraco.Core.Configuration;
|
2020-04-03 11:03:06 +11:00
|
|
|
|
using Umbraco.Core.Hosting;
|
2020-04-02 17:41:00 +11:00
|
|
|
|
using Umbraco.Core.IO;
|
2020-03-30 21:27:35 +02:00
|
|
|
|
using Umbraco.Core.Runtime;
|
2020-04-02 17:41:00 +11:00
|
|
|
|
using Umbraco.Core.WebAssets;
|
2020-03-30 21:27:35 +02:00
|
|
|
|
using Umbraco.Web.BackOffice.Filters;
|
2020-03-31 10:57:56 +02:00
|
|
|
|
using Umbraco.Web.Common.ActionResults;
|
2020-04-02 21:19:42 +11:00
|
|
|
|
using Umbraco.Web.WebAssets;
|
2020-03-30 21:27:35 +02:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Web.BackOffice.Controllers
|
|
|
|
|
|
{
|
|
|
|
|
|
public class BackOfficeController : Controller
|
|
|
|
|
|
{
|
|
|
|
|
|
private readonly IRuntimeMinifier _runtimeMinifier;
|
2020-04-02 17:41:00 +11:00
|
|
|
|
private readonly IGlobalSettings _globalSettings;
|
2020-04-03 11:03:06 +11:00
|
|
|
|
private readonly IHostingEnvironment _hostingEnvironment;
|
2020-03-30 21:27:35 +02:00
|
|
|
|
|
2020-04-03 11:03:06 +11:00
|
|
|
|
public BackOfficeController(IRuntimeMinifier runtimeMinifier, IGlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
|
2020-03-30 21:27:35 +02:00
|
|
|
|
{
|
|
|
|
|
|
_runtimeMinifier = runtimeMinifier;
|
2020-04-02 17:41:00 +11:00
|
|
|
|
_globalSettings = globalSettings;
|
2020-04-03 11:03:06 +11:00
|
|
|
|
_hostingEnvironment = hostingEnvironment;
|
2020-03-30 21:27:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GET
|
|
|
|
|
|
public IActionResult Index()
|
|
|
|
|
|
{
|
|
|
|
|
|
return View();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Returns the JavaScript main file including all references found in manifests
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[MinifyJavaScriptResult(Order = 0)]
|
|
|
|
|
|
public async Task<IActionResult> Application()
|
|
|
|
|
|
{
|
2020-04-03 11:03:06 +11:00
|
|
|
|
var result = await _runtimeMinifier.GetScriptForLoadingBackOfficeAsync(_globalSettings, _hostingEnvironment);
|
2020-03-30 21:27:35 +02:00
|
|
|
|
|
|
|
|
|
|
return new JavaScriptResult(result);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|