Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions backend/src/Squidex/Areas/Api/Controllers/UI/MyUIOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public sealed record MyUIOptions
[JsonPropertyName("collaborationService")]
public string CollaborationService { get; set; }

[JsonPropertyName("disable")]
public bool Disable { get; set; }

public sealed class MapOptions
{
[JsonPropertyName("type")]
Expand Down
9 changes: 8 additions & 1 deletion backend/src/Squidex/Areas/Frontend/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

using Microsoft.Extensions.FileProviders;
using Microsoft.Net.Http.Headers;
using Squidex.Areas.Api.Controllers.UI;
using Squidex.Areas.Frontend.Middlewares;
using Squidex.Hosting.Web;
using Squidex.Pipeline.Squid;
Expand All @@ -17,8 +18,14 @@ namespace Squidex.Areas.Frontend;

public static class Startup
{
public static void UseFrontend(this IApplicationBuilder app)
public static void UseFrontend(this IApplicationBuilder app, IConfiguration config)
{
var uiOptions = config.GetSection("ui").Get<MyUIOptions>();
if (uiOptions is { Disable: true })
{
return;
}

var environment = app.ApplicationServices.GetRequiredService<IWebHostEnvironment>();

var fileProvider = environment.WebRootFileProvider;
Expand Down
8 changes: 7 additions & 1 deletion backend/src/Squidex/Config/Domain/FontendServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ namespace Squidex.Config.Domain;

public static class FontendServices
{
public static void AddSquidexFrontend(this IServiceCollection services)
public static void AddSquidexFrontend(this IServiceCollection services, IConfiguration config)
{
var uiOptions = config.GetSection("ui").Get<MyUIOptions>();
if (uiOptions is { Disable: true })
{
return;
}

services.Configure<MyUIOptions>((services, options) =>
{
var jsonOptions = services.GetRequiredService<JsonSerializerOptions>();
Expand Down
4 changes: 2 additions & 2 deletions backend/src/Squidex/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void ConfigureServices(IServiceCollection services)
services.AddSquidexContents(config);
services.AddSquidexControllerServices(config);
services.AddSquidexEventSourcing(config);
services.AddSquidexFrontend();
services.AddSquidexFrontend(config);
services.AddSquidexGraphQL();
services.AddSquidexHealthChecks(config);
services.AddSquidexHistory(config);
Expand Down Expand Up @@ -119,7 +119,7 @@ public void Configure(IApplicationBuilder app)
builder.Use404();
});

app.UseFrontend();
app.UseFrontend(config);
app.UsePlugins();
}
}
3 changes: 3 additions & 0 deletions backend/src/Squidex/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@
},

"ui": {
// Admin UI disable
"disable": false,

// Regex suggestions for the UI
"regexSuggestions": {
// Regex for emails.
Expand Down
Loading