generate page
This commit is contained in:
Родитель
147c3058ac
Коммит
6be3390270
|
@ -4,48 +4,26 @@
|
|||
using System.Text.Json;
|
||||
using System.Web;
|
||||
|
||||
namespace Microsoft.TryDotNet
|
||||
namespace Microsoft.TryDotNet;
|
||||
|
||||
public class ContentGenerator
|
||||
{
|
||||
public class ContentGenerator
|
||||
public static Task<string> GenerateEditorPageAsync(HttpRequest request)
|
||||
{
|
||||
public static Task<string> GenerateEditorPageAsync(HttpRequest request)
|
||||
var referer = request.Headers.Referer.FirstOrDefault();
|
||||
var hostUri = new Uri(request.Scheme + "://" + request.Host.Value, UriKind.Absolute);
|
||||
var wasmRunnerUri = new Uri(hostUri, "/wasmrunner");
|
||||
var commansdUri = new Uri(hostUri, "/commands");
|
||||
var configuration = new
|
||||
{
|
||||
/* use pocket view to emit this
|
||||
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>TryDotNet Editor</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<script defer="defer" src="api/Editor/app.bundle.js" id="trydotnet-editor-script" data-trydotnet-configuration="......"></script>
|
||||
<script defer="defer" src="api/Editor/editor.worker.bundle.js"></script>
|
||||
<script defer="defer" src="api/Editor/json.worker.bundle.js"></script>
|
||||
<script defer="defer" src="api/Editor/css.worker.bundle.js"></script>
|
||||
<script defer="defer" src="api/Editor/html.worker.bundle.js"></script>
|
||||
<script defer="defer" src="api/Editor/ts.worker.bundle.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
*/
|
||||
wasmRunnerUrl = wasmRunnerUri.AbsoluteUri,
|
||||
commandsUrl = commansdUri.AbsoluteUri,
|
||||
refererUrl = !string.IsNullOrWhiteSpace(referer) ? new Uri(referer, UriKind.Absolute) : null
|
||||
};
|
||||
|
||||
var referer = request.Headers.Referer.FirstOrDefault();
|
||||
|
||||
var configString = JsonSerializer.Serialize(configuration);
|
||||
|
||||
var hostUri = new Uri(request.Scheme + "://" + request.Host.Value, UriKind.Absolute);
|
||||
var wasmRunnerUri = new Uri(hostUri, "/wasmrunner");
|
||||
var commansdUri = new Uri(hostUri, "/commands");
|
||||
var configuration = new
|
||||
{
|
||||
wasmRunnerUrl = wasmRunnerUri.AbsoluteUri,
|
||||
commandsUrl = commansdUri.AbsoluteUri,
|
||||
refererUrl = !string.IsNullOrWhiteSpace(referer) ? new Uri(referer, UriKind.Absolute) : null
|
||||
};
|
||||
|
||||
var configString = JsonSerializer.Serialize(configuration);
|
||||
|
||||
var value =$@"<!doctype html>
|
||||
var value =$@"<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=""utf-8"">
|
||||
|
@ -62,7 +40,6 @@ namespace Microsoft.TryDotNet
|
|||
</body>
|
||||
</html>";
|
||||
|
||||
return Task.FromResult(value);
|
||||
}
|
||||
return Task.FromResult(value);
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче