commit
f0c95c46c9
|
@ -90,7 +90,8 @@
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(IconName))
|
if (!string.IsNullOrEmpty(IconName))
|
||||||
{
|
{
|
||||||
_iconSpan = $"<span class=\"oi oi-{IconName}\"></span> ";
|
_iconSpan = $"<span class=\"oi oi-{IconName}\"></span>{(IconOnly?"":" ")}";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_url = EditUrl(Action, _parameters);
|
_url = EditUrl(Action, _parameters);
|
||||||
|
|
|
@ -361,20 +361,26 @@
|
||||||
|
|
||||||
string panes = "";
|
string panes = "";
|
||||||
Type themetype = Type.GetType(page.ThemeType);
|
Type themetype = Type.GetType(page.ThemeType);
|
||||||
var themeobject = Activator.CreateInstance(themetype) as IThemeControl;
|
if (themetype != null)
|
||||||
if (themeobject != null)
|
|
||||||
{
|
{
|
||||||
panes = themeobject.Panes;
|
var themeobject = Activator.CreateInstance(themetype) as IThemeControl;
|
||||||
page.Resources = ManagePageResources(page.Resources, themeobject.Resources);
|
if (themeobject != null)
|
||||||
|
{
|
||||||
|
panes = themeobject.Panes;
|
||||||
|
page.Resources = ManagePageResources(page.Resources, themeobject.Resources);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(page.LayoutType))
|
if (!string.IsNullOrEmpty(page.LayoutType))
|
||||||
{
|
{
|
||||||
Type layouttype = Type.GetType(page.LayoutType);
|
Type layouttype = Type.GetType(page.LayoutType);
|
||||||
var layoutobject = Activator.CreateInstance(layouttype) as ILayoutControl;
|
if (layouttype != null)
|
||||||
if (layoutobject != null)
|
|
||||||
{
|
{
|
||||||
panes = layoutobject.Panes;
|
var layoutobject = Activator.CreateInstance(layouttype) as ILayoutControl;
|
||||||
|
if (layoutobject != null)
|
||||||
|
{
|
||||||
|
panes = layoutobject.Panes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace Oqtane.Controllers
|
||||||
|
|
||||||
private User Filter(User user)
|
private User Filter(User user)
|
||||||
{
|
{
|
||||||
if (user != null && !User.IsInRole(Constants.AdminRole) && User.Identity.Name != user.Username)
|
if (user != null && !User.IsInRole(Constants.AdminRole) && User.Identity.Name?.ToLower() != user.Username.ToLower())
|
||||||
{
|
{
|
||||||
user.DisplayName = "";
|
user.DisplayName = "";
|
||||||
user.Email = "";
|
user.Email = "";
|
||||||
|
|
|
@ -29,7 +29,8 @@ namespace Oqtane
|
||||||
public IConfigurationRoot Configuration { get; }
|
public IConfigurationRoot Configuration { get; }
|
||||||
private string _webRoot;
|
private string _webRoot;
|
||||||
private Runtime _runtime;
|
private Runtime _runtime;
|
||||||
|
private bool _useSwagger;
|
||||||
|
|
||||||
public Startup(IWebHostEnvironment env)
|
public Startup(IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
var builder = new ConfigurationBuilder()
|
var builder = new ConfigurationBuilder()
|
||||||
|
@ -37,9 +38,12 @@ namespace Oqtane
|
||||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
|
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
|
||||||
Configuration = builder.Build();
|
Configuration = builder.Build();
|
||||||
|
|
||||||
_runtime = (Configuration.GetSection("Runtime").Value == "WebAssembly") ? Runtime.WebAssembly : Runtime.Server;
|
_runtime = (Configuration.GetSection("Runtime").Value == "WebAssembly") ? Runtime.WebAssembly : Runtime.Server;
|
||||||
|
|
||||||
|
//add possibility to switch off swagger on production.
|
||||||
|
_useSwagger = Configuration.GetSection("UseSwagger").Value != "false";
|
||||||
|
|
||||||
_webRoot = env.WebRootPath;
|
_webRoot = env.WebRootPath;
|
||||||
AppDomain.CurrentDomain.SetData("DataDirectory", Path.Combine(env.ContentRootPath, "Data"));
|
AppDomain.CurrentDomain.SetData("DataDirectory", Path.Combine(env.ContentRootPath, "Data"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +51,6 @@ namespace Oqtane
|
||||||
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
|
|
||||||
services.AddServerSideBlazor();
|
services.AddServerSideBlazor();
|
||||||
|
|
||||||
// setup HttpClient for server side in a client side compatible fashion ( with auth cookie )
|
// setup HttpClient for server side in a client side compatible fashion ( with auth cookie )
|
||||||
|
@ -59,7 +62,7 @@ namespace Oqtane
|
||||||
var navigationManager = s.GetRequiredService<NavigationManager>();
|
var navigationManager = s.GetRequiredService<NavigationManager>();
|
||||||
var httpContextAccessor = s.GetRequiredService<IHttpContextAccessor>();
|
var httpContextAccessor = s.GetRequiredService<IHttpContextAccessor>();
|
||||||
var authToken = httpContextAccessor.HttpContext.Request.Cookies[".AspNetCore.Identity.Application"];
|
var authToken = httpContextAccessor.HttpContext.Request.Cookies[".AspNetCore.Identity.Application"];
|
||||||
var client = new HttpClient(new HttpClientHandler { UseCookies = false });
|
var client = new HttpClient(new HttpClientHandler {UseCookies = false});
|
||||||
if (authToken != null)
|
if (authToken != null)
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Add("Cookie", ".AspNetCore.Identity.Application=" + authToken);
|
client.DefaultRequestHeaders.Add("Cookie", ".AspNetCore.Identity.Application=" + authToken);
|
||||||
|
@ -121,7 +124,7 @@ namespace Oqtane
|
||||||
.AddEntityFrameworkStores<TenantDBContext>()
|
.AddEntityFrameworkStores<TenantDBContext>()
|
||||||
.AddSignInManager()
|
.AddSignInManager()
|
||||||
.AddDefaultTokenProviders();
|
.AddDefaultTokenProviders();
|
||||||
|
|
||||||
services.Configure<IdentityOptions>(options =>
|
services.Configure<IdentityOptions>(options =>
|
||||||
{
|
{
|
||||||
// Password settings
|
// Password settings
|
||||||
|
@ -199,14 +202,12 @@ namespace Oqtane
|
||||||
services.AddMvc()
|
services.AddMvc()
|
||||||
.AddNewtonsoftJson()
|
.AddNewtonsoftJson()
|
||||||
.AddOqtaneApplicationParts() // register any Controllers from custom modules
|
.AddOqtaneApplicationParts() // register any Controllers from custom modules
|
||||||
.ConfigureOqtaneMvc(); // any additional configuration from IStart classes.
|
.ConfigureOqtaneMvc(); // any additional configuration from IStart classes.
|
||||||
|
|
||||||
services.AddSwaggerGen(c =>
|
if (_useSwagger)
|
||||||
{
|
{
|
||||||
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Oqtane", Version = "v1" });
|
services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo {Title = "Oqtane", Version = "v1"}); });
|
||||||
});
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
|
@ -230,11 +231,11 @@ namespace Oqtane
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
app.UseSwagger();
|
if (_useSwagger)
|
||||||
app.UseSwaggerUI(c =>
|
|
||||||
{
|
{
|
||||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Oqtane V1");
|
app.UseSwagger();
|
||||||
});
|
app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "Oqtane V1"); });
|
||||||
|
}
|
||||||
|
|
||||||
app.UseEndpoints(endpoints =>
|
app.UseEndpoints(endpoints =>
|
||||||
{
|
{
|
||||||
|
@ -242,7 +243,6 @@ namespace Oqtane
|
||||||
endpoints.MapControllers();
|
endpoints.MapControllers();
|
||||||
endpoints.MapFallbackToPage("/_Host");
|
endpoints.MapFallbackToPage("/_Host");
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user