mirror of https://github.com/Squidex/squidex.git
committed by
GitHub
21 changed files with 412 additions and 493 deletions
@ -1,57 +0,0 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using System.Text; |
|||
|
|||
namespace Squidex.Areas.Frontend.Middlewares |
|||
{ |
|||
public sealed class IndexMiddleware |
|||
{ |
|||
private readonly RequestDelegate next; |
|||
|
|||
public IndexMiddleware(RequestDelegate next) |
|||
{ |
|||
this.next = next; |
|||
} |
|||
|
|||
public async Task InvokeAsync(HttpContext context) |
|||
{ |
|||
if (context.IsHtmlPath() && !context.Response.IsNotModified()) |
|||
{ |
|||
var responseBuffer = new MemoryStream(); |
|||
var responseBody = context.Response.Body; |
|||
|
|||
context.Response.Body = responseBuffer; |
|||
|
|||
await next(context); |
|||
|
|||
if (!context.Response.IsNotModified()) |
|||
{ |
|||
context.Response.Body = responseBody; |
|||
|
|||
var html = Encoding.UTF8.GetString(responseBuffer.ToArray()); |
|||
|
|||
html = html.AdjustBase(context); |
|||
|
|||
if (context.IsIndex()) |
|||
{ |
|||
html = html.AddOptions(context); |
|||
} |
|||
|
|||
context.Response.ContentLength = Encoding.UTF8.GetByteCount(html); |
|||
context.Response.Body = responseBody; |
|||
|
|||
await context.Response.WriteAsync(html, context.RequestAborted); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
await next(context); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,61 +0,0 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
namespace Squidex.Areas.Frontend.Middlewares |
|||
{ |
|||
public sealed class WebpackMiddleware |
|||
{ |
|||
private const string WebpackUrl = "https://localhost:3000/index.html"; |
|||
|
|||
private readonly RequestDelegate next; |
|||
|
|||
public WebpackMiddleware(RequestDelegate next) |
|||
{ |
|||
this.next = next; |
|||
} |
|||
|
|||
public async Task InvokeAsync(HttpContext context) |
|||
{ |
|||
if (context.IsIndex() && !context.Response.IsNotModified()) |
|||
{ |
|||
try |
|||
{ |
|||
var handler = new HttpClientHandler |
|||
{ |
|||
ServerCertificateCustomValidationCallback = (message, cert, chain, error) => true |
|||
}; |
|||
|
|||
using (var client = new HttpClient(handler)) |
|||
{ |
|||
var result = await client.GetAsync(WebpackUrl, context.RequestAborted); |
|||
|
|||
context.Response.StatusCode = (int)result.StatusCode; |
|||
|
|||
if (result.IsSuccessStatusCode) |
|||
{ |
|||
var html = await result.Content.ReadAsStringAsync(context.RequestAborted); |
|||
|
|||
html = html.AdjustBase(context); |
|||
|
|||
await context.Response.WriteAsync(html, context.RequestAborted); |
|||
} |
|||
} |
|||
} |
|||
catch |
|||
{ |
|||
context.Request.Path = "/identity-server/webpack"; |
|||
|
|||
await next(context); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
await next(context); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,75 +0,0 @@ |
|||
@{ |
|||
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="@Url.RootContentUrl("~/styles/bootstrap.min.css")" rel="stylesheet"> |
|||
<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; |
|||
} |
|||
|
|||
.card-body { |
|||
text-align: center; |
|||
} |
|||
</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>@T.Get("setup.webpack.text")</p> |
|||
|
|||
<a href="https://docs.squidex.io/01-getting-started/contributing-and-developing/developing" target="_blank">@T.Get("common.documentation")</a> |
|||
</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> |
|||
@ -1,11 +1,10 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<configuration> |
|||
<location path="." inheritInChildApplications="false"> |
|||
<system.webServer> |
|||
<handlers> |
|||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" /> |
|||
</handlers> |
|||
<aspNetCore processPath="bin\Debug\net5.0\Squidex.exe" arguments="" stdoutLogEnabled="false" hostingModel="InProcess" /> |
|||
</system.webServer> |
|||
</location> |
|||
<system.webServer> |
|||
<handlers> |
|||
<remove name="aspNetCore" /> |
|||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" /> |
|||
</handlers> |
|||
<aspNetCore processPath="dotnet" arguments=".\bin\Debug\net6.0\Squidex.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" /> |
|||
</system.webServer> |
|||
</configuration> |
|||
@ -0,0 +1,18 @@ |
|||
const path = require('path'); |
|||
|
|||
const appRoot = path.resolve(__dirname, '..'); |
|||
|
|||
function root() { |
|||
var newArgs = Array.prototype.slice.call(arguments, 0); |
|||
|
|||
return path.join.apply(path, [appRoot].concat(newArgs)); |
|||
} |
|||
|
|||
function isDevServer() { |
|||
return path.basename(require.main.filename) === 'webpack-dev-server.js'; |
|||
} |
|||
|
|||
module.exports = { |
|||
root, |
|||
isDevServer, |
|||
}; |
|||
Loading…
Reference in new issue