Browse Source

Hint to run webpack.

pull/768/head
Sebastian 4 years ago
parent
commit
0bd5e21816
  1. 4
      backend/i18n/source/backend_en.json
  2. 12
      backend/src/Squidex.Shared/Texts.it.resx
  3. 12
      backend/src/Squidex.Shared/Texts.nl.resx
  4. 12
      backend/src/Squidex.Shared/Texts.resx
  5. 12
      backend/src/Squidex.Shared/Texts.zh.resx
  6. 4
      backend/src/Squidex/Areas/Frontend/Middlewares/IndexExtensions.cs
  7. 9
      backend/src/Squidex/Areas/Frontend/Middlewares/WebpackMiddleware.cs
  8. 15
      backend/src/Squidex/Areas/Frontend/Startup.cs
  9. 7
      backend/src/Squidex/Areas/IdentityServer/Controllers/Setup/SetupController.cs
  10. 74
      backend/src/Squidex/Areas/IdentityServer/Views/Setup/Webpack.cshtml
  11. 2
      backend/src/Squidex/Pipeline/Squid/SquidMiddleware.cs
  12. 1
      backend/src/Squidex/Startup.cs
  13. 6
      backend/src/Squidex/__missing.txt

4
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 <code>URLS__BASEURL</code> environment variable. The current base URL <code>{actual}</code> does not match to the base url <code>{configured}</code>.",
"setup.ruleUrl.success": "Congratulations, the <code>URLS__BASEURL</code> 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!",

12
backend/src/Squidex.Shared/Texts.it.resx

@ -229,6 +229,9 @@
<data name="common.displayName" xml:space="preserve">
<value>Nome da visualizzare</value>
</data>
<data name="common.documentation" xml:space="preserve">
<value>Documentation</value>
</data>
<data name="common.editor" xml:space="preserve">
<value>Redattore</value>
</data>
@ -973,6 +976,15 @@
<data name="setup.title" xml:space="preserve">
<value>Installazione</value>
</data>
<data name="setup.webpack.headline" xml:space="preserve">
<value>webpack error</value>
</data>
<data name="setup.webpack.text" xml:space="preserve">
<value>You have to run webpack dev server to run the frontend in Development mode. More information in the documenation: </value>
</data>
<data name="setup.webpack.title" xml:space="preserve">
<value>webpack error</value>
</data>
<data name="users.accessDenied.text" xml:space="preserve">
<value>Questa operazione non è consentita, il tuo account potrebbe essere bloccato.</value>
</data>

12
backend/src/Squidex.Shared/Texts.nl.resx

@ -229,6 +229,9 @@
<data name="common.displayName" xml:space="preserve">
<value>Weergavenaam</value>
</data>
<data name="common.documentation" xml:space="preserve">
<value>Documentation</value>
</data>
<data name="common.editor" xml:space="preserve">
<value>Editor</value>
</data>
@ -973,6 +976,15 @@
<data name="setup.title" xml:space="preserve">
<value>Installation</value>
</data>
<data name="setup.webpack.headline" xml:space="preserve">
<value>webpack error</value>
</data>
<data name="setup.webpack.text" xml:space="preserve">
<value>You have to run webpack dev server to run the frontend in Development mode. More information in the documenation: </value>
</data>
<data name="setup.webpack.title" xml:space="preserve">
<value>webpack error</value>
</data>
<data name="users.accessDenied.text" xml:space="preserve">
<value>Deze bewerking is niet toegestaan, je account is mogelijk vergrendeld.</value>
</data>

12
backend/src/Squidex.Shared/Texts.resx

@ -229,6 +229,9 @@
<data name="common.displayName" xml:space="preserve">
<value>Display name</value>
</data>
<data name="common.documentation" xml:space="preserve">
<value>Documentation</value>
</data>
<data name="common.editor" xml:space="preserve">
<value>Editor</value>
</data>
@ -973,6 +976,15 @@
<data name="setup.title" xml:space="preserve">
<value>Installation</value>
</data>
<data name="setup.webpack.headline" xml:space="preserve">
<value>webpack error</value>
</data>
<data name="setup.webpack.text" xml:space="preserve">
<value>You have to run webpack dev server to run the frontend in Development mode. More information in the documenation: </value>
</data>
<data name="setup.webpack.title" xml:space="preserve">
<value>webpack error</value>
</data>
<data name="users.accessDenied.text" xml:space="preserve">
<value>This operation is not allowed, your account might be locked.</value>
</data>

12
backend/src/Squidex.Shared/Texts.zh.resx

@ -229,6 +229,9 @@
<data name="common.displayName" xml:space="preserve">
<value>显示名称</value>
</data>
<data name="common.documentation" xml:space="preserve">
<value>Documentation</value>
</data>
<data name="common.editor" xml:space="preserve">
<value>编辑器</value>
</data>
@ -973,6 +976,15 @@
<data name="setup.title" xml:space="preserve">
<value>安装</value>
</data>
<data name="setup.webpack.headline" xml:space="preserve">
<value>webpack error</value>
</data>
<data name="setup.webpack.text" xml:space="preserve">
<value>You have to run webpack dev server to run the frontend in Development mode. More information in the documenation: </value>
</data>
<data name="setup.webpack.title" xml:space="preserve">
<value>webpack error</value>
</data>
<data name="users.accessDenied.text" xml:space="preserve">
<value>不允许此操作,您的帐户可能被锁定。</value>
</data>

4
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)

9
backend/src/Squidex/Areas/Frontend/Middlewares/WebpackMiddleware.cs

@ -25,6 +25,8 @@ namespace Squidex.Areas.Frontend.Middlewares
public async Task InvokeAsync(HttpContext context)
{
if (context.IsIndex() && !context.Response.IsNotModified())
{
try
{
var handler = new HttpClientHandler
{
@ -47,6 +49,13 @@ namespace Squidex.Areas.Frontend.Middlewares
}
}
}
catch
{
context.Request.Path = "/identity-server/webpack";
await next(context);
}
}
else
{
await next(context);

15
backend/src/Squidex/Areas/Frontend/Startup.cs

@ -59,10 +59,7 @@ namespace Squidex.Areas.Frontend
app.UseMiddleware<IndexMiddleware>();
if (environment.IsDevelopment())
{
app.UseMiddleware<WebpackMiddleware>();
}
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<IWebHostEnvironment>();
if (environment.IsDevelopment())
{
app.UseMiddleware<WebpackMiddleware>();
}
}
}
}

7
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<IActionResult> Setup()

74
backend/src/Squidex/Areas/IdentityServer/Views/Setup/Webpack.cshtml

@ -0,0 +1,74 @@
@{
ViewBag.Title = T.Get("setup.webpack.title");
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<base href="/">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>@ViewBag.Title - @T.Get("common.product")</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<style>
body {
background: #f5f6f9;
padding-left: 0;
padding-top: 3.75rem;
}
.profile-container {
margin: 0 auto;
max-width: 40rem;
min-width: 10rem;
padding: 1rem 2rem;
}
.profile-logo {
height: 1.75rem;
position: absolute;
padding-left: 0;
padding-right: 0;
right: 1rem;
top: 1rem;
}
.profile-footer {
font-size: .8rem;
font-weight: normal;
margin-top: 2rem;
}
</style>
</head>
<body class="profile">
<div class="profile-container">
<img class="profile-logo" alt="@T.Get("common.product")S" title="@T.Get("common.product")" src="@Url.RootContentUrl("~/images/logo.svg")" />
<div class="profile-card card">
<div class="profile-card-body card-body">
<img class="splash-image" src="@Url.RootContentUrl("~/squid.svg?title=OH%20DAMN&text=Please%20run%20webpack")" />
<h1 class="splash-h1">@T.Get("setup.webpack.headline")</h1>
<p class="splash-text">
<span>@T.Get("setup.webpack.text")</span>
<a href="https://docs.squidex.io/01-getting-started/contributing-and-developing/developing" target="_blank">@T.Get("common.documentation")</a>
</p>
</div>
</div>
<div class="profile-footer text-center mt-4 mb-2">
<small class="text-muted">
@T.Get("setup.madeBy")<br />@T.Get("setup.madeByCopyright")
</small>
</div>
</div>
</body>
</html>

2
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());

1
backend/src/Squidex/Startup.cs

@ -88,6 +88,7 @@ namespace Squidex
app.UseSquidexLocalCache();
app.UseSquidexCors();
app.ConfigureDev();
app.ConfigureApi();
app.ConfigurePortal();
app.ConfigureOrleansDashboard();

6
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
Loading…
Cancel
Save