diff --git a/Oqtane.Client/Services/ModuleDefinitionService.cs b/Oqtane.Client/Services/ModuleDefinitionService.cs index aadb2dcb..70bf8ee1 100644 --- a/Oqtane.Client/Services/ModuleDefinitionService.cs +++ b/Oqtane.Client/Services/ModuleDefinitionService.cs @@ -73,7 +73,7 @@ namespace Oqtane.Services if (assemblies.Where(item => item.FullName.StartsWith(assemblyname + ",")).FirstOrDefault() == null) { // download assembly from server and load - var bytes = await http.GetByteArrayAsync(apiurl + "/" + assemblyname + ".dll"); + var bytes = await http.GetByteArrayAsync(apiurl + "/load/" + assemblyname + ".dll"); Assembly.Load(bytes); } } @@ -82,7 +82,7 @@ namespace Oqtane.Services if (assemblies.Where(item => item.FullName.StartsWith(moduledefinition.AssemblyName + ",")).FirstOrDefault() == null) { // download assembly from server and load - var bytes = await http.GetByteArrayAsync(apiurl + "/" + moduledefinition.AssemblyName + ".dll"); + var bytes = await http.GetByteArrayAsync(apiurl + "/load/" + moduledefinition.AssemblyName + ".dll"); Assembly.Load(bytes); } } diff --git a/Oqtane.Client/Services/ThemeService.cs b/Oqtane.Client/Services/ThemeService.cs index 6f864cfe..ae90b47c 100644 --- a/Oqtane.Client/Services/ThemeService.cs +++ b/Oqtane.Client/Services/ThemeService.cs @@ -45,7 +45,7 @@ namespace Oqtane.Services if (assemblies.Where(item => item.FullName.StartsWith(assemblyname + ",")).FirstOrDefault() == null) { // download assembly from server and load - var bytes = await http.GetByteArrayAsync(apiurl + "/" + assemblyname + ".dll"); + var bytes = await http.GetByteArrayAsync(apiurl + "/load/" + assemblyname + ".dll"); Assembly.Load(bytes); } } @@ -53,7 +53,7 @@ namespace Oqtane.Services if (assemblies.Where(item => item.FullName.StartsWith(theme.AssemblyName + ",")).FirstOrDefault() == null) { // download assembly from server and load - var bytes = await http.GetByteArrayAsync(apiurl + "/" + theme.AssemblyName + ".dll"); + var bytes = await http.GetByteArrayAsync(apiurl + "/load/" + theme.AssemblyName + ".dll"); Assembly.Load(bytes); } } diff --git a/Oqtane.Server/Controllers/ModuleDefinitionController.cs b/Oqtane.Server/Controllers/ModuleDefinitionController.cs index 1a41edb1..c503bfc8 100644 --- a/Oqtane.Server/Controllers/ModuleDefinitionController.cs +++ b/Oqtane.Server/Controllers/ModuleDefinitionController.cs @@ -33,10 +33,10 @@ namespace Oqtane.Controllers // GET: api/?siteid=x [HttpGet] - public IEnumerable Get(int siteid) + public IEnumerable Get(string siteid) { List moduledefinitions = new List(); - foreach(ModuleDefinition moduledefinition in ModuleDefinitions.GetModuleDefinitions(siteid)) + foreach(ModuleDefinition moduledefinition in ModuleDefinitions.GetModuleDefinitions(int.Parse(siteid))) { if (UserPermissions.IsAuthorized(User, "Utilize", moduledefinition.Permissions)) { @@ -63,16 +63,6 @@ namespace Oqtane.Controllers } } - - // GET api//filename - [HttpGet("{filename}")] - public IActionResult Get(string assemblyname) - { - string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); - byte[] file = System.IO.File.ReadAllBytes(Path.Combine(binfolder, assemblyname)); - return File(file, "application/octet-stream", assemblyname); - } - // PUT api//5 [HttpPut("{id}")] [Authorize(Roles = Constants.AdminRole)] @@ -123,5 +113,14 @@ namespace Oqtane.Controllers } } + // GET api//load/filename + [HttpGet("load/{filename}")] + public IActionResult Load(string assemblyname) + { + string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); + byte[] file = System.IO.File.ReadAllBytes(Path.Combine(binfolder, assemblyname)); + return File(file, "application/octet-stream", assemblyname); + } + } } diff --git a/Oqtane.Server/Controllers/ThemeController.cs b/Oqtane.Server/Controllers/ThemeController.cs index 0e4915f0..4d8b26fe 100644 --- a/Oqtane.Server/Controllers/ThemeController.cs +++ b/Oqtane.Server/Controllers/ThemeController.cs @@ -36,15 +36,6 @@ namespace Oqtane.Controllers return Themes.GetThemes(); } - // GET api//filename - [HttpGet("{filename}")] - public IActionResult Get(string filename) - { - string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); - byte[] file = System.IO.File.ReadAllBytes(Path.Combine(binfolder, filename)); - return File(file, "application/octet-stream", filename); - } - [HttpGet("install")] [Authorize(Roles = Constants.HostRole)] public void InstallThemes() @@ -80,5 +71,14 @@ namespace Oqtane.Controllers InstallationManager.RestartApplication(); } } + + // GET api//load/filename + [HttpGet("load/{filename}")] + public IActionResult Load(string filename) + { + string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); + byte[] file = System.IO.File.ReadAllBytes(Path.Combine(binfolder, filename)); + return File(file, "application/octet-stream", filename); + } } }