diff --git a/backend/src/Squidex/Areas/Api/Controllers/UI/MyUIOptions.cs b/backend/src/Squidex/Areas/Api/Controllers/UI/MyUIOptions.cs index 722843853..6e30d7192 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/UI/MyUIOptions.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/UI/MyUIOptions.cs @@ -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")] diff --git a/backend/src/Squidex/Areas/Frontend/Startup.cs b/backend/src/Squidex/Areas/Frontend/Startup.cs index dd1264688..47d5e59e6 100644 --- a/backend/src/Squidex/Areas/Frontend/Startup.cs +++ b/backend/src/Squidex/Areas/Frontend/Startup.cs @@ -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; @@ -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(); + if (uiOptions is { Disable: true }) + { + return; + } + var environment = app.ApplicationServices.GetRequiredService(); var fileProvider = environment.WebRootFileProvider; diff --git a/backend/src/Squidex/Config/Domain/FontendServices.cs b/backend/src/Squidex/Config/Domain/FontendServices.cs index 85cb868e5..15bb3cf87 100644 --- a/backend/src/Squidex/Config/Domain/FontendServices.cs +++ b/backend/src/Squidex/Config/Domain/FontendServices.cs @@ -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(); + if (uiOptions is { Disable: true }) + { + return; + } + services.Configure((services, options) => { var jsonOptions = services.GetRequiredService(); diff --git a/backend/src/Squidex/Startup.cs b/backend/src/Squidex/Startup.cs index 27c237362..d41aacc67 100644 --- a/backend/src/Squidex/Startup.cs +++ b/backend/src/Squidex/Startup.cs @@ -43,7 +43,7 @@ public sealed class Startup(IConfiguration config) services.AddSquidexContents(config); services.AddSquidexControllerServices(config); services.AddSquidexEventSourcing(config); - services.AddSquidexFrontend(); + services.AddSquidexFrontend(config); services.AddSquidexGraphQL(); services.AddSquidexHealthChecks(config); services.AddSquidexHistory(config); @@ -119,7 +119,7 @@ public sealed class Startup(IConfiguration config) builder.Use404(); }); - app.UseFrontend(); + app.UseFrontend(config); app.UsePlugins(); } } diff --git a/backend/src/Squidex/appsettings.json b/backend/src/Squidex/appsettings.json index cfbed3ac0..65662225d 100644 --- a/backend/src/Squidex/appsettings.json +++ b/backend/src/Squidex/appsettings.json @@ -149,6 +149,9 @@ }, "ui": { + // Admin UI disable + "disable": false, + // Regex suggestions for the UI "regexSuggestions": { // Regex for emails.