mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-04-22 22:22:51 +08:00
fix: 🐛 tinymce editor css 加载路径错误 (#94)
This commit is contained in:
parent
5fe73878a2
commit
802251e423
@ -35,32 +35,41 @@ public static class IApplicationBuilderExtensions
|
|||||||
return Assembly.GetExecutingAssembly().GetManifestResourceStream(_RES_PFX + path);
|
return Assembly.GetExecutingAssembly().GetManifestResourceStream(_RES_PFX + path);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task UseVueAdminAsync(HttpContext context, Func<Task> next)
|
private static string GetResName(string path)
|
||||||
{
|
{
|
||||||
if (!context.Request.Path.StartsWithSegments(new PathString("/api"))) {
|
return _allResNames.FirstOrDefault(x => path.EndsWith(x, StringComparison.OrdinalIgnoreCase));
|
||||||
var path = context.Request.Path.Value?.Replace("-", "_");
|
}
|
||||||
if (path == "/" || path?.Length == 0) {
|
|
||||||
path = _INDEX_HTML_PATH;
|
|
||||||
}
|
|
||||||
|
|
||||||
path = path!.Replace('/', '.');
|
private static Task UseVueAdminAsync(HttpContext context, Func<Task> next)
|
||||||
|
{
|
||||||
var output = GetManifestResourceStream(path);
|
if (context.Request.Path.StartsWithSegments(new PathString("/api"))) {
|
||||||
if (output == null) {
|
return next.Invoke();
|
||||||
var resName = _allResNames.FirstOrDefault(x => path.EndsWith(x, StringComparison.OrdinalIgnoreCase));
|
|
||||||
output = resName == null
|
|
||||||
? GetManifestResourceStream(_INDEX_HTML_PATH)
|
|
||||||
: GetManifestResourceStream(resName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (output != null) {
|
|
||||||
context.Response.ContentLength = output.Length;
|
|
||||||
context.Response.ContentType = MimeTypeHelper.GetMimeTypeByExtName(_regex.Match(path!).Groups[1].Value);
|
|
||||||
await output.CopyToAsync(context.Response.Body).ConfigureAwait(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await next.Invoke().ConfigureAwait(false);
|
var path = context.Request.Path.Value;
|
||||||
|
if (path == "/" || path?.Length == 0) {
|
||||||
|
path = _INDEX_HTML_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
|
path = path!.Replace('/', '.');
|
||||||
|
|
||||||
|
var output = GetManifestResourceStream(path);
|
||||||
|
if (output == null) {
|
||||||
|
var resName = GetResName(path);
|
||||||
|
if (resName == null) {
|
||||||
|
path = path.Replace("-", "_");
|
||||||
|
resName = GetResName(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
output = resName == null ? GetManifestResourceStream(_INDEX_HTML_PATH) : GetManifestResourceStream(resName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (output == null) {
|
||||||
|
return next.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
context.Response.ContentLength = output.Length;
|
||||||
|
context.Response.ContentType = MimeTypeHelper.GetMimeTypeByExtName(_regex.Match(path!).Groups[1].Value);
|
||||||
|
return output.CopyToAsync(context.Response.Body);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user