fixed issues when running on WebAssembly, made IModule implementations consistent
This commit is contained in:
parent
898bf38156
commit
7421df2970
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Oqtane.Modules.Admin.ModuleCreator
|
||||
{
|
||||
public class Module : IModule
|
||||
public class ModuleInfo : IModule
|
||||
{
|
||||
public ModuleDefinition ModuleDefinition => new ModuleDefinition
|
||||
{
|
|
@ -3,7 +3,7 @@ using Oqtane.Modules;
|
|||
|
||||
namespace Oqtane.Modules.[Module]s
|
||||
{
|
||||
public class Module : IModule
|
||||
public class ModuleInfo : IModule
|
||||
{
|
||||
public ModuleDefinition ModuleDefinition => new ModuleDefinition
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Oqtane.Modules.Counter
|
||||
{
|
||||
public class Module : IModule
|
||||
public class ModuleInfo : IModule
|
||||
{
|
||||
public ModuleDefinition ModuleDefinition => new ModuleDefinition
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Oqtane.Modules.Weather
|
||||
{
|
||||
public class Module : IModule
|
||||
public class ModuleInfo : IModule
|
||||
{
|
||||
public ModuleDefinition ModuleDefinition => new ModuleDefinition
|
||||
{
|
|
@ -20,6 +20,7 @@ namespace Oqtane.Client
|
|||
builder.RootComponents.Add<App>("app");
|
||||
|
||||
builder.Services.AddBaseAddressHttpClient();
|
||||
builder.Services.AddOptions();
|
||||
|
||||
// register auth services
|
||||
builder.Services.AddAuthorizationCore();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -75,13 +75,23 @@ namespace Oqtane.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
// GET api/<controller>/load/filename
|
||||
[HttpGet("load/{filename}")]
|
||||
public IActionResult Load(string 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, filename));
|
||||
return File(file, "application/octet-stream", filename);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -218,11 +218,8 @@ namespace Oqtane
|
|||
installationManager.InstallPackages("Modules,Themes", false);
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseBlazorFrameworkFiles();
|
||||
|
||||
app.UseRouting();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
|
Loading…
Reference in New Issue
Block a user