diff --git a/backend/i18n/source/backend_en.json b/backend/i18n/source/backend_en.json index 382e4179f..4d3b55c77 100644 --- a/backend/i18n/source/backend_en.json +++ b/backend/i18n/source/backend_en.json @@ -48,6 +48,7 @@ "common.data": "Data", "common.defaultValue": "Default value", "common.displayName": "Display name", + "common.documentation": "Documentation", "common.editor": "Editor", "common.email": "Email", "common.errorNoPermission": "You do not have the necessary permission.", @@ -296,6 +297,9 @@ "setup.ruleUrl.failure": "You should access Squidex only over one canonical URL and configure this URL with the URLS__BASEURL environment variable. The current base URL {actual} does not match to the base url {configured}.", "setup.ruleUrl.success": "Congratulations, the URLS__BASEURL environment variable is configured properly.", "setup.title": "Installation", + "setup.webpack.headline": "webpack error", + "setup.webpack.text": "You have to run webpack dev server to run the frontend in Development mode. More information in the documenation: ", + "setup.webpack.title": "webpack error", "users.accessDenied.text": "This operation is not allowed, your account might be locked.", "users.accessDenied.title": "Access denied", "users.consent.agree": "I agree!", diff --git a/backend/src/Squidex.Shared/Texts.it.resx b/backend/src/Squidex.Shared/Texts.it.resx index a88497e4f..11c8d00be 100644 --- a/backend/src/Squidex.Shared/Texts.it.resx +++ b/backend/src/Squidex.Shared/Texts.it.resx @@ -229,6 +229,9 @@ Nome da visualizzare + + Documentation + Redattore @@ -973,6 +976,15 @@ Installazione + + webpack error + + + You have to run webpack dev server to run the frontend in Development mode. More information in the documenation: + + + webpack error + Questa operazione non è consentita, il tuo account potrebbe essere bloccato. diff --git a/backend/src/Squidex.Shared/Texts.nl.resx b/backend/src/Squidex.Shared/Texts.nl.resx index cd91315c9..69bf31b6b 100644 --- a/backend/src/Squidex.Shared/Texts.nl.resx +++ b/backend/src/Squidex.Shared/Texts.nl.resx @@ -229,6 +229,9 @@ Weergavenaam + + Documentation + Editor @@ -973,6 +976,15 @@ Installation + + webpack error + + + You have to run webpack dev server to run the frontend in Development mode. More information in the documenation: + + + webpack error + Deze bewerking is niet toegestaan, je account is mogelijk vergrendeld. diff --git a/backend/src/Squidex.Shared/Texts.resx b/backend/src/Squidex.Shared/Texts.resx index 23a319e7d..c31761c3f 100644 --- a/backend/src/Squidex.Shared/Texts.resx +++ b/backend/src/Squidex.Shared/Texts.resx @@ -229,6 +229,9 @@ Display name + + Documentation + Editor @@ -973,6 +976,15 @@ Installation + + webpack error + + + You have to run webpack dev server to run the frontend in Development mode. More information in the documenation: + + + webpack error + This operation is not allowed, your account might be locked. diff --git a/backend/src/Squidex.Shared/Texts.zh.resx b/backend/src/Squidex.Shared/Texts.zh.resx index 368aa94e8..1625b6173 100644 --- a/backend/src/Squidex.Shared/Texts.zh.resx +++ b/backend/src/Squidex.Shared/Texts.zh.resx @@ -229,6 +229,9 @@ 显示名称 + + Documentation + 编辑器 @@ -973,6 +976,15 @@ 安装 + + webpack error + + + You have to run webpack dev server to run the frontend in Development mode. More information in the documenation: + + + webpack error + 不允许此操作,您的帐户可能被锁定。 diff --git a/backend/src/Squidex/Areas/Frontend/Middlewares/IndexExtensions.cs b/backend/src/Squidex/Areas/Frontend/Middlewares/IndexExtensions.cs index f885cc01a..21ef525dd 100644 --- a/backend/src/Squidex/Areas/Frontend/Middlewares/IndexExtensions.cs +++ b/backend/src/Squidex/Areas/Frontend/Middlewares/IndexExtensions.cs @@ -26,7 +26,9 @@ namespace Squidex.Areas.Frontend.Middlewares public static bool IsIndex(this HttpContext context) { - return context.Request.Path.Value?.EndsWith("/index.html", StringComparison.OrdinalIgnoreCase) == true; + var path = context.Request.Path.Value; + + return path == "/" || path?.EndsWith("/index.html", StringComparison.OrdinalIgnoreCase) == true; } public static bool IsHtmlPath(this HttpContext context) diff --git a/backend/src/Squidex/Areas/Frontend/Middlewares/WebpackMiddleware.cs b/backend/src/Squidex/Areas/Frontend/Middlewares/WebpackMiddleware.cs index d417462a9..349771753 100644 --- a/backend/src/Squidex/Areas/Frontend/Middlewares/WebpackMiddleware.cs +++ b/backend/src/Squidex/Areas/Frontend/Middlewares/WebpackMiddleware.cs @@ -26,26 +26,35 @@ namespace Squidex.Areas.Frontend.Middlewares { if (context.IsIndex() && !context.Response.IsNotModified()) { - var handler = new HttpClientHandler + try { - ServerCertificateCustomValidationCallback = (message, cert, chain, error) => true - }; + var handler = new HttpClientHandler + { + ServerCertificateCustomValidationCallback = (message, cert, chain, error) => true + }; - using (var client = new HttpClient(handler)) - { - var result = await client.GetAsync(WebpackUrl, context.RequestAborted); + using (var client = new HttpClient(handler)) + { + var result = await client.GetAsync(WebpackUrl, context.RequestAborted); - context.Response.StatusCode = (int)result.StatusCode; + context.Response.StatusCode = (int)result.StatusCode; - if (result.IsSuccessStatusCode) - { - var html = await result.Content.ReadAsStringAsync(context.RequestAborted); + if (result.IsSuccessStatusCode) + { + var html = await result.Content.ReadAsStringAsync(context.RequestAborted); - html = html.AdjustBase(context); + html = html.AdjustBase(context); - await context.Response.WriteAsync(html, context.RequestAborted); + await context.Response.WriteAsync(html, context.RequestAborted); + } } } + catch + { + context.Request.Path = "/identity-server/webpack"; + + await next(context); + } } else { diff --git a/backend/src/Squidex/Areas/Frontend/Startup.cs b/backend/src/Squidex/Areas/Frontend/Startup.cs index a61182d1b..0b62b7aab 100644 --- a/backend/src/Squidex/Areas/Frontend/Startup.cs +++ b/backend/src/Squidex/Areas/Frontend/Startup.cs @@ -59,10 +59,7 @@ namespace Squidex.Areas.Frontend app.UseMiddleware(); - if (environment.IsDevelopment()) - { - app.UseMiddleware(); - } + app.ConfigureDev(); app.UseStaticFiles(new StaticFileOptions { @@ -88,5 +85,15 @@ namespace Squidex.Areas.Frontend } }); } + + public static void ConfigureDev(this IApplicationBuilder app) + { + var environment = app.ApplicationServices.GetRequiredService(); + + if (environment.IsDevelopment()) + { + app.UseMiddleware(); + } + } } } diff --git a/backend/src/Squidex/Areas/IdentityServer/Controllers/Setup/SetupController.cs b/backend/src/Squidex/Areas/IdentityServer/Controllers/Setup/SetupController.cs index 014e3bb84..08823c16c 100644 --- a/backend/src/Squidex/Areas/IdentityServer/Controllers/Setup/SetupController.cs +++ b/backend/src/Squidex/Areas/IdentityServer/Controllers/Setup/SetupController.cs @@ -46,6 +46,13 @@ namespace Squidex.Areas.IdentityServer.Controllers.Setup this.userService = userService; } + [HttpGet] + [Route("webpack/")] + public IActionResult Webpack() + { + return View(); + } + [HttpGet] [Route("setup/")] public async Task Setup() diff --git a/backend/src/Squidex/Areas/IdentityServer/Views/Setup/Webpack.cshtml b/backend/src/Squidex/Areas/IdentityServer/Views/Setup/Webpack.cshtml new file mode 100644 index 000000000..a7c213d3b --- /dev/null +++ b/backend/src/Squidex/Areas/IdentityServer/Views/Setup/Webpack.cshtml @@ -0,0 +1,74 @@ +@{ + ViewBag.Title = T.Get("setup.webpack.title"); + + Layout = null; +} + + + + + + + + + + @ViewBag.Title - @T.Get("common.product") + + + + + +
+ + +
+
+ + +

@T.Get("setup.webpack.headline")

+ +

+ @T.Get("setup.webpack.text") + + @T.Get("common.documentation") +

+ +
+
+ + +
+ + \ No newline at end of file diff --git a/backend/src/Squidex/Pipeline/Squid/SquidMiddleware.cs b/backend/src/Squidex/Pipeline/Squid/SquidMiddleware.cs index 83272254e..5881098d6 100644 --- a/backend/src/Squidex/Pipeline/Squid/SquidMiddleware.cs +++ b/backend/src/Squidex/Pipeline/Squid/SquidMiddleware.cs @@ -95,7 +95,7 @@ namespace Squidex.Pipeline.Squid foreach (var word in text.Split(' ')) { - if (line.Length + word.Length > 17 && line.Length > 0) + if (line.Length + word.Length > 16 && line.Length > 0) { result.Add(line.ToString()); diff --git a/backend/src/Squidex/Startup.cs b/backend/src/Squidex/Startup.cs index 680813aca..f1ed1c86e 100644 --- a/backend/src/Squidex/Startup.cs +++ b/backend/src/Squidex/Startup.cs @@ -88,6 +88,7 @@ namespace Squidex app.UseSquidexLocalCache(); app.UseSquidexCors(); + app.ConfigureDev(); app.ConfigureApi(); app.ConfigurePortal(); app.ConfigureOrleansDashboard(); diff --git a/backend/src/Squidex/__missing.txt b/backend/src/Squidex/__missing.txt new file mode 100644 index 000000000..d6f9904ed --- /dev/null +++ b/backend/src/Squidex/__missing.txt @@ -0,0 +1,6 @@ +setup.webpack.title +setup.webpack.headline +setup.webpack.text +setup.webpack.title +setup.webpack.headline +setup.webpack.text