mirror of
https://github.com/nsnail/IGeekFan.AspNetCore.Knife4jUI.git
synced 2025-04-13 19:52:50 +08:00
fix 返回json数据HeadContent DocumentTitle config
This commit is contained in:
parent
34baddc9d1
commit
d54e5fd4c4
@ -11,7 +11,7 @@
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/luoyunchong/IGeekFan.AspNetCore.Knife4jUI.git</RepositoryUrl>
|
||||
<RootNamespace>IGeekFan.AspNetCore.Knife4jUI</RootNamespace>
|
||||
<Version>0.0.1</Version>
|
||||
<Version>0.0.2</Version>
|
||||
<Company />
|
||||
<Authors>igeekfan;xiaoym;</Authors>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
|
@ -33,11 +33,12 @@ namespace IGeekFan.AspNetCore.Knife4jUI
|
||||
/// <summary>
|
||||
/// Gets the JavaScript config object, represented as JSON, that will be passed to the Knife4jUI
|
||||
/// </summary>
|
||||
public ConfigObject ConfigObject { get; set; } = new ConfigObject();
|
||||
public ConfigObject ConfigObject { get; set; } = new ConfigObject();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the JavaScript config object, represented as JSON, that will be passed to the initOAuth method
|
||||
/// 暂不支持此特性Gets the JavaScript config object, represented as JSON, that will be passed to the initOAuth method
|
||||
/// </summary>
|
||||
[Obsolete]
|
||||
public OAuthConfigObject OAuthConfigObject { get; set; } = new OAuthConfigObject();
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ using Microsoft.AspNetCore.StaticFiles;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using System.Collections.Generic;
|
||||
#if NETCOREAPP3_0
|
||||
using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IWebHostEnvironment;
|
||||
#endif
|
||||
@ -109,8 +110,25 @@ namespace IGeekFan.AspNetCore.Knife4jUI
|
||||
{
|
||||
// Inject arguments before writing to response
|
||||
var htmlBuilder = new StringBuilder(new StreamReader(stream).ReadToEnd());
|
||||
|
||||
foreach (var entry in GetIndexArguments())
|
||||
{
|
||||
htmlBuilder.Replace(entry.Key, entry.Value);
|
||||
}
|
||||
|
||||
await response.WriteAsync(htmlBuilder.ToString(), Encoding.UTF8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private IDictionary<string, string> GetIndexArguments()
|
||||
{
|
||||
return new Dictionary<string, string>()
|
||||
{
|
||||
{ "%(DocumentTitle)", _options.DocumentTitle },
|
||||
{ "%(HeadContent)", _options.HeadContent },
|
||||
//{ "%(OAuthConfigObject)", JsonSerializer.Serialize(_options.OAuthConfigObject, _jsonSerializerOptions) }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1 +1,25 @@
|
||||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon.ico><title>knife4j 接口文档</title><link href=knife4j/css/app.f6bd291e.css rel=preload as=style><link href=knife4j/js/app.708d5416.js rel=preload as=script><link href=knife4j/js/chunk-vendors.e86fea24.js rel=preload as=script><link href=knife4j/css/app.f6bd291e.css rel=stylesheet></head><body><noscript><strong>We're sorry but knife4j-vue doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=knife4j/js/chunk-vendors.e86fea24.js></script><script src=knife4j/js/app.708d5416.js></script></body></html>
|
||||
<!DOCTYPE html>
|
||||
<html lang=en>
|
||||
<head>
|
||||
<meta charset=utf-8>
|
||||
<meta http-equiv=X-UA-Compatible content="IE=edge">
|
||||
<meta name=viewport content="width=device-width,initial-scale=1">
|
||||
<link rel=icon href=favicon.ico>
|
||||
<title>%(DocumentTitle)</title>
|
||||
<link href=knife4j/css/app.8f08f96a.css rel=preload as= style>
|
||||
<link href=knife4j/js/app.c02977a4.js rel=preload as=script>
|
||||
<link href=knife4j/js/chunk-vendors.e86fea24.js rel=preload as=script>
|
||||
<link href=knife4j/css/app.8f08f96a.css rel=stylesheet>
|
||||
%(HeadContent)
|
||||
</head>
|
||||
<body>
|
||||
<noscript><strong>We're sorry but knife4j-vue doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div>
|
||||
<script src=knife4j/js/chunk-vendors.e86fea24.js></script>
|
||||
<script src=knife4j/js/app.c02977a4.js></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
BIN
src/IGeekFan.AspNetCore.SwaggerUI/knife4j/js/app.c02977a4.js.gz
Normal file
BIN
src/IGeekFan.AspNetCore.SwaggerUI/knife4j/js/app.c02977a4.js.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user