Allow installation of Language packages through Language Management

This commit is contained in:
Shaun Walker
2021-05-05 19:03:06 -04:00
parent e836e27a5a
commit 38aebf5aff
9 changed files with 145 additions and 49 deletions

View File

@ -1,16 +1,17 @@
using System.Collections.Generic;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Oqtane.Models;
using Newtonsoft.Json;
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Threading;
using System.IO;
using System.Linq;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Authorization;
using Oqtane.Shared;
using Oqtane.Infrastructure;
using Oqtane.Enums;
// ReSharper disable PartialTypeWithSinglePart
namespace Oqtane.Controllers
@ -18,11 +19,15 @@ namespace Oqtane.Controllers
[Route(ControllerRoutes.Default)]
public class PackageController : Controller
{
private readonly IInstallationManager _installationManager;
private readonly IWebHostEnvironment _environment;
private readonly ILogManager _logger;
public PackageController(IWebHostEnvironment environment)
public PackageController(IInstallationManager installationManager, IWebHostEnvironment environment, ILogManager logger)
{
_installationManager = installationManager;
_environment = environment;
_logger = logger;
}
// GET: api/<controller>?tag=x
@ -86,6 +91,14 @@ namespace Oqtane.Controllers
}
}
}
[HttpGet("install")]
[Authorize(Roles = RoleNames.Host)]
public void InstallPackages()
{
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Packages Installed");
_installationManager.InstallPackages("Packages");
}
}
public partial class SearchResult