Merge branch 'oqtane:dev' into refs

This commit is contained in:
Tonći Vatavuk
2022-02-08 19:55:34 +01:00
committed by GitHub
30 changed files with 963 additions and 722 deletions

View File

@ -17,18 +17,17 @@ using Oqtane.Infrastructure;
using Oqtane.Modules;
using Oqtane.Repository;
using Oqtane.Security;
using Oqtane.Services;
using Oqtane.Shared;
namespace Microsoft.Extensions.DependencyInjection
{
public static class OqtaneServiceCollectionExtensions
{
public static IServiceCollection AddOqtane(this IServiceCollection services, Runtime runtime, string[] supportedCultures)
public static IServiceCollection AddOqtane(this IServiceCollection services, string[] supportedCultures)
{
LoadAssemblies();
LoadSatelliteAssemblies(supportedCultures);
services.AddOqtaneServices(runtime);
services.AddOqtaneServices();
return services;
}
@ -190,7 +189,7 @@ namespace Microsoft.Extensions.DependencyInjection
return services;
}
private static IServiceCollection AddOqtaneServices(this IServiceCollection services, Runtime runtime)
private static IServiceCollection AddOqtaneServices(this IServiceCollection services)
{
if (services is null)
{
@ -229,14 +228,6 @@ namespace Microsoft.Extensions.DependencyInjection
{
startup.ConfigureServices(services);
}
if (runtime == Runtime.Server)
{
// register client startup services if running on server
assembly.GetInstances<IClientStartup>()
.ToList()
.ForEach(x => x.ConfigureServices(services));
}
}
return services;
}

View File

@ -28,14 +28,14 @@ namespace Oqtane.Infrastructure
{
public class DatabaseManager : IDatabaseManager
{
private readonly IConfigurationRoot _config;
private readonly IConfigManager _config;
private readonly IServiceScopeFactory _serviceScopeFactory;
private readonly IWebHostEnvironment _environment;
private readonly IMemoryCache _cache;
private readonly IConfigManager _configManager;
private readonly ILogger<DatabaseManager> _filelogger;
public DatabaseManager(IConfigurationRoot config, IServiceScopeFactory serviceScopeFactory, IWebHostEnvironment environment, IMemoryCache cache, IConfigManager configManager, ILogger<DatabaseManager> filelogger)
public DatabaseManager(IConfigManager config, IServiceScopeFactory serviceScopeFactory, IWebHostEnvironment environment, IMemoryCache cache, IConfigManager configManager, ILogger<DatabaseManager> filelogger)
{
_config = config;
_serviceScopeFactory = serviceScopeFactory;

View File

@ -125,6 +125,9 @@ namespace Oqtane.Infrastructure
case "ref": // ref/net*/...
filename = ExtractFile(entry, Path.Combine(binPath, "ref"), 2);
break;
case "refs": // refs/net*/...
filename = ExtractFile(entry, Path.Combine(binPath, "refs"), 2);
break;
}
if (filename != "")

View File

@ -14,18 +14,18 @@ namespace Oqtane.Infrastructure
public class LogManager : ILogManager
{
private readonly ILogRepository _logs;
private readonly IConfigurationRoot _config;
private readonly ITenantManager _tenantManager;
private readonly IConfigManager _config;
private readonly IUserPermissions _userPermissions;
private readonly IHttpContextAccessor _accessor;
private readonly Alias _alias;
public LogManager(ILogRepository logs, ITenantManager tenantManager, IConfigurationRoot config, IUserPermissions userPermissions, IHttpContextAccessor accessor)
public LogManager(ILogRepository logs, ITenantManager tenantManager, IConfigManager config, IUserPermissions userPermissions, IHttpContextAccessor accessor)
{
_logs = logs;
_tenantManager = tenantManager;
_config = config;
_userPermissions = userPermissions;
_accessor = accessor;
_alias = tenantManager.GetAlias();
}
public void Log(LogLevel level, object @class, LogFunction function, string message, params object[] args)
@ -48,9 +48,13 @@ namespace Oqtane.Infrastructure
Log log = new Log();
log.SiteId = siteId;
if (log.SiteId == -1 && _alias != null)
if (log.SiteId == -1)
{
log.SiteId = _alias.SiteId;
var alias = _tenantManager.GetAlias();
if (alias != null)
{
log.SiteId = alias.SiteId;
}
}
if (log.SiteId == -1) return; // logs must be site specific

View File

@ -1,6 +1,5 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
namespace Oqtane.Infrastructure
{
@ -16,8 +15,8 @@ namespace Oqtane.Infrastructure
public async Task Invoke(HttpContext context)
{
// check if framework is installed
var config = context.RequestServices.GetService(typeof(IConfiguration)) as IConfiguration;
if (!string.IsNullOrEmpty(config.GetConnectionString("DefaultConnection")))
var config = context.RequestServices.GetService(typeof(IConfigManager)) as IConfigManager;
if (config.IsInstalled())
{
// get alias
var tenantManager = context.RequestServices.GetService(typeof(ITenantManager)) as ITenantManager;

View File

@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Oqtane.Databases.Interfaces;
using Oqtane.Migrations.EntityBuilders;
using Oqtane.Repository;
namespace Oqtane.Migrations.Tenant
{
[DbContext(typeof(TenantDBContext))]
[Migration("Tenant.03.00.03.01")]
public class AddPageMeta : MultiDatabaseMigration
{
public AddPageMeta(IDatabase database) : base(database)
{
}
protected override void Up(MigrationBuilder migrationBuilder)
{
var pageEntityBuilder = new PageEntityBuilder(migrationBuilder, ActiveDatabase);
pageEntityBuilder.AddStringColumn("Meta", 2000, true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
var pageEntityBuilder = new PageEntityBuilder(migrationBuilder, ActiveDatabase);
pageEntityBuilder.DropColumn("Meta");
}
}
}

View File

@ -8,6 +8,8 @@ using Oqtane.Infrastructure;
using Oqtane.Controllers;
using System.Net;
using Oqtane.Documentation;
using System.Collections.Generic;
using System.Linq;
namespace Oqtane.Modules.HtmlText.Controllers
{
@ -22,18 +24,60 @@ namespace Oqtane.Modules.HtmlText.Controllers
_htmlText = htmlText;
}
// GET api/<controller>/5
[HttpGet("{id}")]
[Authorize(Policy = PolicyNames.ViewModule)]
public Models.HtmlText Get(int id)
// GET: api/<controller>?moduleid=x
[HttpGet]
[Authorize(Roles = RoleNames.Registered)]
public IEnumerable<Models.HtmlText> Get(string moduleId)
{
if (AuthEntityId(EntityNames.Module) == id)
if (int.TryParse(moduleId, out int ModuleId) && AuthEntityId(EntityNames.Module) == ModuleId)
{
return _htmlText.GetHtmlTexts(ModuleId);
}
else
{
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Html/Text Get Attempt {ModuleId}", moduleId);
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
return null;
}
}
// GET api/<controller>/5
[HttpGet("{moduleid}")]
[Authorize(Policy = PolicyNames.ViewModule)]
public Models.HtmlText Get(int moduleId)
{
if (AuthEntityId(EntityNames.Module) == moduleId)
{
var htmltexts = _htmlText.GetHtmlTexts(moduleId);
if (htmltexts != null && htmltexts.Any())
{
return htmltexts.OrderByDescending(item => item.CreatedOn).First();
}
else
{
return null;
}
}
else
{
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Html/Text Get Attempt {ModuleId}", moduleId);
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
return null;
}
}
// GET api/<controller>/5/6
[HttpGet("{id}/{moduleid}")]
[Authorize(Policy = PolicyNames.ViewModule)]
public Models.HtmlText Get(int id, int moduleId)
{
if (AuthEntityId(EntityNames.Module) == moduleId)
{
return _htmlText.GetHtmlText(id);
}
else
{
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized HtmlText Get Attempt {ModuleId}", id);
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Html/Text Get Attempt {HtmlTextId}", id);
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
return null;
}
@ -53,27 +97,7 @@ namespace Oqtane.Modules.HtmlText.Controllers
}
else
{
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized HtmlText Post Attempt {HtmlText}", htmlText);
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
return null;
}
}
// PUT api/<controller>/5
[ValidateAntiForgeryToken]
[HttpPut("{id}")]
[Authorize(Policy = PolicyNames.EditModule)]
public Models.HtmlText Put(int id, [FromBody] Models.HtmlText htmlText)
{
if (ModelState.IsValid && AuthEntityId(EntityNames.Module) == htmlText.ModuleId)
{
htmlText = _htmlText.UpdateHtmlText(htmlText);
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Html/Text Updated {HtmlText}", htmlText);
return htmlText;
}
else
{
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized HtmlText Put Attempt {HtmlText}", htmlText);
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Html/Text Post Attempt {HtmlText}", htmlText);
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
return null;
}
@ -81,18 +105,18 @@ namespace Oqtane.Modules.HtmlText.Controllers
// DELETE api/<controller>/5
[ValidateAntiForgeryToken]
[HttpDelete("{id}")]
[HttpDelete("{id}/{moduleid}")]
[Authorize(Policy = PolicyNames.EditModule)]
public void Delete(int id)
public void Delete(int id, int moduleId)
{
if (AuthEntityId(EntityNames.Module) == id)
if (AuthEntityId(EntityNames.Module) == moduleId)
{
_htmlText.DeleteHtmlText(id);
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Html/Text Deleted {HtmlTextId}", id);
}
else
{
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized HtmlText Delete Attempt {ModuleId}", id);
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Html/Text Delete Attempt {HtmlTextId}", id);
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
}
}

View File

@ -43,19 +43,10 @@ namespace Oqtane.Modules.HtmlText.Manager
public void ImportModule(Module module, string content, string version)
{
content = WebUtility.HtmlDecode(content);
var htmlText = _htmlText.GetHtmlText(module.ModuleId);
if (htmlText != null)
{
htmlText.Content = content;
_htmlText.UpdateHtmlText(htmlText);
}
else
{
htmlText = new Models.HtmlText();
htmlText.ModuleId = module.ModuleId;
htmlText.Content = content;
_htmlText.AddHtmlText(htmlText);
}
var htmlText = new Models.HtmlText();
htmlText.ModuleId = module.ModuleId;
htmlText.Content = content;
_htmlText.AddHtmlText(htmlText);
}
public bool Install(Tenant tenant, string version)

View File

@ -2,6 +2,7 @@ using Microsoft.EntityFrameworkCore;
using System.Linq;
using Oqtane.Modules.HtmlText.Models;
using Oqtane.Documentation;
using System.Collections.Generic;
namespace Oqtane.Modules.HtmlText.Repository
{
@ -15,11 +16,15 @@ namespace Oqtane.Modules.HtmlText.Repository
_db = context;
}
public Models.HtmlText GetHtmlText(int moduleId)
public IEnumerable<Models.HtmlText> GetHtmlTexts(int moduleId)
{
return _db.HtmlText.FirstOrDefault(item => item.ModuleId == moduleId);
return _db.HtmlText.Where(item => item.ModuleId == moduleId);
}
public Models.HtmlText GetHtmlText(int htmlTextId)
{
return _db.HtmlText.Find(htmlTextId);
}
public Models.HtmlText AddHtmlText(Models.HtmlText htmlText)
{
@ -28,16 +33,9 @@ namespace Oqtane.Modules.HtmlText.Repository
return htmlText;
}
public Models.HtmlText UpdateHtmlText(Models.HtmlText htmlText)
public void DeleteHtmlText(int htmlTextId)
{
_db.Entry(htmlText).State = EntityState.Modified;
_db.SaveChanges();
return htmlText;
}
public void DeleteHtmlText(int moduleId)
{
Models.HtmlText htmlText = _db.HtmlText.FirstOrDefault(item => item.ModuleId == moduleId);
Models.HtmlText htmlText = _db.HtmlText.FirstOrDefault(item => item.HtmlTextId == htmlTextId);
if (htmlText != null) _db.HtmlText.Remove(htmlText);
_db.SaveChanges();
}

View File

@ -1,3 +1,4 @@
using System.Collections.Generic;
using Oqtane.Documentation;
using Oqtane.Modules.HtmlText.Models;
@ -6,9 +7,9 @@ namespace Oqtane.Modules.HtmlText.Repository
[PrivateApi("Mark HtmlText classes as private, since it's not very useful in the public docs")]
public interface IHtmlTextRepository
{
Models.HtmlText GetHtmlText(int moduleId);
IEnumerable<Models.HtmlText> GetHtmlTexts(int moduleId);
Models.HtmlText GetHtmlText(int htmlTextId);
Models.HtmlText AddHtmlText(Models.HtmlText htmlText);
Models.HtmlText UpdateHtmlText(Models.HtmlText htmlText);
void DeleteHtmlText(int moduleId);
void DeleteHtmlText(int htmlTextId);
}
}

View File

@ -8,6 +8,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@Model.Title</title>
@Html.Raw(@Model.Meta)
<base href="~/" />
<link id="app-favicon" rel="shortcut icon" type="image/x-icon" href="@Model.FavIcon" />
@if (!string.IsNullOrEmpty(Model.PWAScript))
@ -20,34 +21,42 @@
@Html.Raw(Model.HeadResources)
</head>
<body>
@(Html.AntiForgeryToken())
<component type="typeof(Oqtane.App)" render-mode="@Model.RenderMode" param-AntiForgeryToken="@Model.AntiForgeryToken" param-Runtime="@Model.Runtime" param-RenderMode="@Model.RenderMode.ToString()" param-VisitorId="@Model.VisitorId" param-RemoteIPAddress="@Model.RemoteIPAddress" />
<div id="blazor-error-ui">
<environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded.
</environment>
<environment include="Development">
An unhandled exception has occurred. See browser dev tools for details.
</environment>
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
<script src="js/interop.js"></script>
@if (Model.Runtime == "WebAssembly")
{
<script src="_framework/blazor.webassembly.js"></script>
}
else
{
<script src="_framework/blazor.server.js"></script>
}
@if (!string.IsNullOrEmpty(Model.PWAScript))
@if (string.IsNullOrEmpty(Model.Message))
{
@Html.Raw(Model.PWAScript)
@(Html.AntiForgeryToken())
<component type="typeof(Oqtane.App)" render-mode="@Model.RenderMode" param-AntiForgeryToken="@Model.AntiForgeryToken" param-Runtime="@Model.Runtime" param-RenderMode="@Model.RenderMode.ToString()" param-VisitorId="@Model.VisitorId" param-RemoteIPAddress="@Model.RemoteIPAddress" />
<div id="blazor-error-ui">
<environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded.
</environment>
<environment include="Development">
An unhandled exception has occurred. See browser dev tools for details.
</environment>
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
<script src="js/interop.js"></script>
@if (Model.Runtime == "WebAssembly")
{
<script src="_framework/blazor.webassembly.js"></script>
}
else
{
<script src="_framework/blazor.server.js"></script>
}
@if (!string.IsNullOrEmpty(Model.PWAScript))
{
@Html.Raw(Model.PWAScript)
}
@Html.Raw(Model.BodyResources)
}
else
{
<div class="app-alert">@Model.Message</div>
}
@Html.Raw(Model.BodyResources)
</body>
</html>

View File

@ -25,7 +25,7 @@ namespace Oqtane.Pages
{
public class HostModel : PageModel
{
private IConfiguration _configuration;
private IConfigManager _configuration;
private readonly ITenantManager _tenantManager;
private readonly ILocalizationManager _localizationManager;
private readonly ILanguageRepository _languages;
@ -38,7 +38,7 @@ namespace Oqtane.Pages
private readonly ISettingRepository _settings;
private readonly ILogManager _logger;
public HostModel(IConfiguration configuration, ITenantManager tenantManager, ILocalizationManager localizationManager, ILanguageRepository languages, IAntiforgery antiforgery, ISiteRepository sites, IPageRepository pages, IUrlMappingRepository urlMappings, IVisitorRepository visitors, IAliasRepository aliases, ISettingRepository settings, ILogManager logger)
public HostModel(IConfigManager configuration, ITenantManager tenantManager, ILocalizationManager localizationManager, ILanguageRepository languages, IAntiforgery antiforgery, ISiteRepository sites, IPageRepository pages, IUrlMappingRepository urlMappings, IVisitorRepository visitors, IAliasRepository aliases, ISettingRepository settings, ILogManager logger)
{
_configuration = configuration;
_tenantManager = tenantManager;
@ -63,9 +63,11 @@ namespace Oqtane.Pages
public string HeadResources = "";
public string BodyResources = "";
public string Title = "";
public string Meta = "";
public string FavIcon = "favicon.ico";
public string PWAScript = "";
public string ThemeType = "";
public string Message = "";
public IActionResult OnGet()
{
@ -83,7 +85,7 @@ namespace Oqtane.Pages
}
// if framework is installed
if (!string.IsNullOrEmpty(_configuration.GetConnectionString("DefaultConnection")))
if (_configuration.IsInstalled())
{
var alias = _tenantManager.GetAlias();
if (alias != null)
@ -108,7 +110,7 @@ namespace Oqtane.Pages
}
var site = _sites.GetSite(alias.SiteId);
if (site != null)
if (site != null && !site.IsDeleted)
{
Route route = new Route(url, alias.Path);
@ -148,6 +150,7 @@ namespace Oqtane.Pages
{
Title = Title + " - " + page.Name;
}
Meta = page.Meta;
// include theme resources
if (!string.IsNullOrEmpty(page.ThemeType))
@ -165,42 +168,50 @@ namespace Oqtane.Pages
return RedirectPermanent(url);
}
}
}
// include global resources
var assemblies = AppDomain.CurrentDomain.GetOqtaneAssemblies();
foreach (Assembly assembly in assemblies)
{
ProcessHostResources(assembly);
ProcessModuleControls(assembly);
ProcessThemeControls(assembly);
}
// set culture if not specified
string culture = HttpContext.Request.Cookies[CookieRequestCultureProvider.DefaultCookieName];
if (culture == null)
{
// get default language for site
var languages = _languages.GetLanguages(alias.SiteId);
if (languages.Any())
// include global resources
var assemblies = AppDomain.CurrentDomain.GetOqtaneAssemblies();
foreach (Assembly assembly in assemblies)
{
// use default language if specified otherwise use first language in collection
culture = (languages.Where(l => l.IsDefault).SingleOrDefault() ?? languages.First()).Code;
ProcessHostResources(assembly);
ProcessModuleControls(assembly);
ProcessThemeControls(assembly);
}
else
{
culture = _localizationManager.GetDefaultCulture();
}
SetLocalizationCookie(culture);
}
// set language for page
if (!string.IsNullOrEmpty(culture))
{
// localization cookie value in form of c=en|uic=en
Language = culture.Split('|')[0];
Language = Language.Replace("c=", "");
// set culture if not specified
string culture = HttpContext.Request.Cookies[CookieRequestCultureProvider.DefaultCookieName];
if (culture == null)
{
// get default language for site
var languages = _languages.GetLanguages(alias.SiteId);
if (languages.Any())
{
// use default language if specified otherwise use first language in collection
culture = (languages.Where(l => l.IsDefault).SingleOrDefault() ?? languages.First()).Code;
}
else
{
culture = _localizationManager.GetDefaultCulture();
}
SetLocalizationCookie(culture);
}
// set language for page
if (!string.IsNullOrEmpty(culture))
{
// localization cookie value in form of c=en|uic=en
Language = culture.Split('|')[0];
Language = Language.Replace("c=", "");
}
}
else
{
Message = "Site Is Either Disabled Or Not Configured Correctly";
}
}
else
{
Message = "Site Not Configured Correctly - No Matching Alias Exists For Host Name";
}
}
return Page();

View File

@ -1,19 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Migrations;
using Oqtane.Models;
using Microsoft.Extensions.Configuration;
using Oqtane.Databases.Interfaces;
using Oqtane.Extensions;
using Oqtane.Interfaces;
using Oqtane.Migrations.Framework;
using Oqtane.Repository.Databases.Interfaces;
using Oqtane.Shared;
using System.Threading.Tasks;
using System.Threading;
using Oqtane.Infrastructure;
// ReSharper disable BuiltInTypeReferenceStyleForMemberAccess
// ReSharper disable UnusedAutoPropertyAccessor.Global
@ -24,14 +21,14 @@ namespace Oqtane.Repository
public class MasterDBContext : DbContext, IMultiDatabase
{
private readonly IHttpContextAccessor _accessor;
private readonly IConfiguration _configuration;
private readonly IConfigManager _config;
private string _connectionString;
private string _databaseType;
public MasterDBContext(DbContextOptions<MasterDBContext> options, IHttpContextAccessor accessor, IConfiguration configuration) : base(options)
public MasterDBContext(DbContextOptions<MasterDBContext> options, IHttpContextAccessor accessor, IConfigManager config) : base(options)
{
_accessor = accessor;
_configuration = configuration;
_config = config;
}
public IDatabase ActiveDatabase { get; private set; }
@ -40,15 +37,15 @@ namespace Oqtane.Repository
{
optionsBuilder.ReplaceService<IMigrationsAssembly, MultiDatabaseMigrationsAssembly>();
if(_configuration != null)
if(_config != null)
{
if (!String.IsNullOrEmpty(_configuration.GetConnectionString("DefaultConnection")))
if (_config.IsInstalled())
{
_connectionString = _configuration.GetConnectionString("DefaultConnection")
_connectionString = _config.GetConnectionString("DefaultConnection")
.Replace("|DataDirectory|", AppDomain.CurrentDomain.GetData("DataDirectory")?.ToString());
}
_databaseType = _configuration.GetSection(SettingKeys.DatabaseSection)[SettingKeys.DatabaseTypeKey];
_databaseType = _config.GetSection(SettingKeys.DatabaseSection)[SettingKeys.DatabaseTypeKey];
}
if (!String.IsNullOrEmpty(_databaseType))

View File

@ -6,7 +6,6 @@ using Oqtane.Infrastructure;
using Oqtane.Repository;
using Oqtane.Models;
using System.Collections.Generic;
using Microsoft.Extensions.Configuration;
namespace Oqtane.Security
{
@ -17,8 +16,8 @@ namespace Oqtane.Security
if (context != null && context.Principal.Identity.IsAuthenticated)
{
// check if framework is installed
var config = context.HttpContext.RequestServices.GetService(typeof(IConfiguration)) as IConfiguration;
if (!string.IsNullOrEmpty(config.GetConnectionString("DefaultConnection")))
var config = context.HttpContext.RequestServices.GetService(typeof(IConfigManager)) as IConfigManager;
if (config.IsInstalled())
{
var tenantManager = context.HttpContext.RequestServices.GetService(typeof(ITenantManager)) as ITenantManager;
var alias = tenantManager.GetAlias();

View File

@ -21,7 +21,6 @@ namespace Oqtane
{
public class Startup
{
private readonly Runtime _runtime;
private readonly bool _useSwagger;
private readonly IWebHostEnvironment _env;
private readonly string[] _supportedCultures;
@ -36,7 +35,6 @@ namespace Oqtane
Configuration = builder.Build();
_supportedCultures = localizationManager.GetSupportedCultures();
_runtime = (Configuration.GetSection("Runtime").Value == "WebAssembly") ? Runtime.WebAssembly : Runtime.Server;
//add possibility to switch off swagger on production.
_useSwagger = Configuration.GetSection("UseSwagger").Value != "false";
@ -115,7 +113,7 @@ namespace Oqtane
services.AddOqtaneTransientServices();
// load the external assemblies into the app domain, install services
services.AddOqtane(_runtime, _supportedCultures);
services.AddOqtane(_supportedCultures);
services.AddOqtaneDbContext();
services.AddMvc()