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

View File

@ -175,7 +175,7 @@ namespace Oqtane
services.AddSingleton<IDatabaseManager, DatabaseManager>();
// install any modules or themes ( this needs to occur BEFORE the assemblies are loaded into the app domain )
InstallationManager.InstallPackages("Modules,Themes", _env.WebRootPath, _env.ContentRootPath);
InstallationManager.InstallPackages("Modules,Themes,Packages", _env.WebRootPath, _env.ContentRootPath);
// register transient scoped core services
services.AddTransient<IModuleDefinitionRepository, ModuleDefinitionRepository>();

View File

@ -1 +0,0 @@
/* Module Custom Styles */

View File

@ -1 +0,0 @@
/* Module Script */

View File

@ -1 +0,0 @@
["\\bin\\Debug\\net5.0\\Oqtane.Blogs.Client.Oqtane.dll","\\bin\\Debug\\net5.0\\Oqtane.Blogs.Client.Oqtane.pdb","\\bin\\Debug\\net5.0\\Oqtane.Blogs.Server.Oqtane.dll","\\bin\\Debug\\net5.0\\Oqtane.Blogs.Server.Oqtane.pdb","\\bin\\Debug\\net5.0\\Oqtane.Blogs.Shared.Oqtane.dll","\\bin\\Debug\\net5.0\\Oqtane.Blogs.Shared.Oqtane.pdb","\\wwwroot\\Modules\\Oqtane.Blogs\\Module.css","\\wwwroot\\Modules\\Oqtane.Blogs\\Module.js"]