Merge pull request #248 from sbwalker/master

fix #242 - module definition edit UI
This commit is contained in:
Shaun Walker 2020-03-02 20:23:43 -06:00 committed by GitHub
commit 19143b4255
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 25 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -33,10 +33,10 @@ namespace Oqtane.Controllers
// GET: api/<controller>?siteid=x
[HttpGet]
public IEnumerable<ModuleDefinition> Get(int siteid)
public IEnumerable<ModuleDefinition> Get(string siteid)
{
List<ModuleDefinition> moduledefinitions = new List<ModuleDefinition>();
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/<controller>/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/<controller>/5
[HttpPut("{id}")]
[Authorize(Roles = Constants.AdminRole)]
@ -123,5 +113,14 @@ namespace Oqtane.Controllers
}
}
// GET api/<controller>/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);
}
}
}

View File

@ -36,15 +36,6 @@ namespace Oqtane.Controllers
return Themes.GetThemes();
}
// GET api/<controller>/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/<controller>/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);
}
}
}