fixed issues when running on WebAssembly, made IModule implementations consistent

This commit is contained in:
Shaun Walker
2020-04-06 13:25:19 -04:00
parent 898bf38156
commit 7421df2970
8 changed files with 35 additions and 18 deletions

View File

@ -122,13 +122,22 @@ namespace Oqtane.Controllers
}
}
// GET api/<controller>/load/filename
[HttpGet("load/{filename}")]
// GET api/<controller>/load/assembyname
[HttpGet("load/{assemblyname}")]
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);
if (Path.GetExtension(assemblyname).ToLower() == ".dll")
{
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
byte[] file = System.IO.File.ReadAllBytes(Path.Combine(binfolder, assemblyname));
return File(file, "application/octet-stream", assemblyname);
}
else
{
_logger.Log(LogLevel.Error, this, LogFunction.Read, "User Not Authorized To Download Assembly {Assembly}", assemblyname);
HttpContext.Response.StatusCode = 401;
return null;
}
}
// POST api/<controller>?moduleid=x