diff --git a/IGeekFan.AspNetCore.Knife4jUI.sln b/IGeekFan.AspNetCore.Knife4jUI.sln index 35f840d..4241ef2 100644 --- a/IGeekFan.AspNetCore.Knife4jUI.sln +++ b/IGeekFan.AspNetCore.Knife4jUI.sln @@ -23,8 +23,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OAuth2Integration", "test\W EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Swagger.Knife4jUI", "test\WebSites\NSwag.Swagger.Knife4jUI\NSwag.Swagger.Knife4jUI.csproj", "{42B4C1C3-AE38-47C7-AAAA-FE0FDA7DADEB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspNetCore6Api", "samples\AspNetCore6Api\AspNetCore6Api.csproj", "{43B995C5-145B-4D46-B4C3-6340F31A1572}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A08844CF-E477-4104-98CB-EB6417CB1B0C}" ProjectSection(SolutionItems) = preProject .gitattributes = .gitattributes @@ -33,6 +31,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution README.md = README.md EndProjectSection EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNetCore7Api", "samples\AspNetCoreApi\AspNetCore7Api.csproj", "{F576D6A1-D21C-4BBB-9461-8D7C6DBE5B61}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -63,10 +63,10 @@ Global {42B4C1C3-AE38-47C7-AAAA-FE0FDA7DADEB}.Debug|Any CPU.Build.0 = Debug|Any CPU {42B4C1C3-AE38-47C7-AAAA-FE0FDA7DADEB}.Release|Any CPU.ActiveCfg = Release|Any CPU {42B4C1C3-AE38-47C7-AAAA-FE0FDA7DADEB}.Release|Any CPU.Build.0 = Release|Any CPU - {43B995C5-145B-4D46-B4C3-6340F31A1572}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {43B995C5-145B-4D46-B4C3-6340F31A1572}.Debug|Any CPU.Build.0 = Debug|Any CPU - {43B995C5-145B-4D46-B4C3-6340F31A1572}.Release|Any CPU.ActiveCfg = Release|Any CPU - {43B995C5-145B-4D46-B4C3-6340F31A1572}.Release|Any CPU.Build.0 = Release|Any CPU + {F576D6A1-D21C-4BBB-9461-8D7C6DBE5B61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F576D6A1-D21C-4BBB-9461-8D7C6DBE5B61}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F576D6A1-D21C-4BBB-9461-8D7C6DBE5B61}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F576D6A1-D21C-4BBB-9461-8D7C6DBE5B61}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -79,7 +79,7 @@ Global {86851B6C-3504-4879-8464-1DB422D46BA0} = {75C51574-4CBD-403B-8182-8BF2A6DCFD43} {9E8D8F42-33F0-4F2D-9B56-1AB1B33DE1FA} = {86851B6C-3504-4879-8464-1DB422D46BA0} {42B4C1C3-AE38-47C7-AAAA-FE0FDA7DADEB} = {86851B6C-3504-4879-8464-1DB422D46BA0} - {43B995C5-145B-4D46-B4C3-6340F31A1572} = {C146A419-15E0-4475-9623-706C5E2DCE0B} + {F576D6A1-D21C-4BBB-9461-8D7C6DBE5B61} = {C146A419-15E0-4475-9623-706C5E2DCE0B} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {9D77CCB4-F597-421B-9EF9-52D4B0AC382D} diff --git a/samples/AspNetCore6Api/AspNetCore6Api.csproj b/samples/AspNetCore6Api/AspNetCore6Api.csproj deleted file mode 100644 index 6f55844..0000000 --- a/samples/AspNetCore6Api/AspNetCore6Api.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - net6.0 - enable - enable - - - AspNetCore6Api.xml - - - - - - - - - - - diff --git a/samples/AspNetCore6Api/AspNetCore6Api.xml b/samples/AspNetCore6Api/AspNetCore6Api.xml deleted file mode 100644 index 0b836c0..0000000 --- a/samples/AspNetCore6Api/AspNetCore6Api.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - - AspNetCore6Api - - - - - 中文这是一个Get请求这是一个Get请求 - - - - - 得到一个ErrorCode - - - - - - 发送一个Post - - - - - - 这是一个Get请求 - - - - - - 请求实体 - - - - - 异常信息 - - - - - 状态码 - - - - - 注释ErrorCode - - - - - 操作成功 - - - - - 未知错误 - - - - - 服务器未知错误 - - - - - 失败 - - - - - 认证失败 - - - - - 无权限 - - - - - 失败 - - - - - refreshToken异常 - - - - - 资源不存在 - - - - - 参数错误 - - - - - 令牌失效 - - - - - 令牌过期 - - - - - 字段重复 - - - - - 禁止操作 - - - - diff --git a/samples/AspNetCore6Api/Properties/launchSettings.json b/samples/AspNetCore6Api/Properties/launchSettings.json deleted file mode 100644 index 59a6a29..0000000 --- a/samples/AspNetCore6Api/Properties/launchSettings.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:7480", - "sslPort": 44309 - } - }, - "profiles": { - "AspNetCore6Api": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "launchUrl": "swagger", - "applicationUrl": "https://localhost:7030;http://localhost:5030", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} diff --git a/samples/AspNetCoreApi/AspNetCore7Api.csproj b/samples/AspNetCoreApi/AspNetCore7Api.csproj new file mode 100644 index 0000000..1fc15de --- /dev/null +++ b/samples/AspNetCoreApi/AspNetCore7Api.csproj @@ -0,0 +1,18 @@ + + + + net7.0 + enable + enable + True + + + + + + + + + + + diff --git a/samples/AspNetCore6Api/Controllers/WeatherForecastController.cs b/samples/AspNetCoreApi/Controllers/WeatherForecastController.cs similarity index 100% rename from samples/AspNetCore6Api/Controllers/WeatherForecastController.cs rename to samples/AspNetCoreApi/Controllers/WeatherForecastController.cs diff --git a/samples/AspNetCore6Api/ErrorCode.cs b/samples/AspNetCoreApi/ErrorCode.cs similarity index 100% rename from samples/AspNetCore6Api/ErrorCode.cs rename to samples/AspNetCoreApi/ErrorCode.cs diff --git a/samples/AspNetCore6Api/Program.cs b/samples/AspNetCoreApi/Program.cs similarity index 92% rename from samples/AspNetCore6Api/Program.cs rename to samples/AspNetCoreApi/Program.cs index 265788d..61efa72 100644 --- a/samples/AspNetCore6Api/Program.cs +++ b/samples/AspNetCoreApi/Program.cs @@ -12,7 +12,7 @@ builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "API V1", Version = "v1" }); - var filePath = Path.Combine(System.AppContext.BaseDirectory, "AspNetCore6Api.xml"); + var filePath = Path.Combine(System.AppContext.BaseDirectory, "AspNetCore7Api.xml"); c.IncludeXmlComments(filePath, true); }); @@ -24,17 +24,16 @@ if (app.Environment.IsDevelopment()) app.UseSwagger(); app.UseKnife4UI(c => { - c.RoutePrefix = "k4"; // serve the UI at root + c.RoutePrefix = "swagger"; // serve the UI at root c.SwaggerEndpoint("/v1/swagger.json", "V1 Docs"); }); } app.UseHttpsRedirection(); - +app.UseRouting(); app.UseAuthorization(); -app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); diff --git a/samples/AspNetCoreApi/Properties/launchSettings.json b/samples/AspNetCoreApi/Properties/launchSettings.json new file mode 100644 index 0000000..3159a44 --- /dev/null +++ b/samples/AspNetCoreApi/Properties/launchSettings.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "AspNetCore7Api": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7030;http://localhost:5030", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/samples/AspNetCore6Api/WeatherForecast.cs b/samples/AspNetCoreApi/WeatherForecast.cs similarity index 100% rename from samples/AspNetCore6Api/WeatherForecast.cs rename to samples/AspNetCoreApi/WeatherForecast.cs diff --git a/samples/AspNetCore6Api/appsettings.Development.json b/samples/AspNetCoreApi/appsettings.Development.json similarity index 100% rename from samples/AspNetCore6Api/appsettings.Development.json rename to samples/AspNetCoreApi/appsettings.Development.json diff --git a/samples/AspNetCore6Api/appsettings.json b/samples/AspNetCoreApi/appsettings.json similarity index 100% rename from samples/AspNetCore6Api/appsettings.json rename to samples/AspNetCoreApi/appsettings.json diff --git a/samples/SwaggerUI_IndexStream_Knife4jUI_Demo/SwaggerUI_IndexStream_Knife4jUI_Demo.csproj b/samples/SwaggerUI_IndexStream_Knife4jUI_Demo/SwaggerUI_IndexStream_Knife4jUI_Demo.csproj index baaeb80..4917652 100644 --- a/samples/SwaggerUI_IndexStream_Knife4jUI_Demo/SwaggerUI_IndexStream_Knife4jUI_Demo.csproj +++ b/samples/SwaggerUI_IndexStream_Knife4jUI_Demo/SwaggerUI_IndexStream_Knife4jUI_Demo.csproj @@ -7,10 +7,10 @@ - - - - + + + + diff --git a/src/IGeekFan.AspNetCore.Knife4jUI/IGeekFan.AspNetCore.Knife4jUI.csproj b/src/IGeekFan.AspNetCore.Knife4jUI/IGeekFan.AspNetCore.Knife4jUI.csproj index c65988a..bfe1519 100644 --- a/src/IGeekFan.AspNetCore.Knife4jUI/IGeekFan.AspNetCore.Knife4jUI.csproj +++ b/src/IGeekFan.AspNetCore.Knife4jUI/IGeekFan.AspNetCore.Knife4jUI.csproj @@ -1,7 +1,7 @@  - netstandard2.0;netcoreapp3.1;net5.0;net6.0 + netstandard2.0;netcoreapp3.1;net6.0;net7.0 Middleware to expose an embedded version of the knife4j-vue from an ASP.NET Core application $(NoWarn);1591 true @@ -11,14 +11,14 @@ git https://github.com/luoyunchong/IGeekFan.AspNetCore.Knife4jUI.git IGeekFan.AspNetCore.Knife4jUI - 0.0.11 + 0.0.13 igeekfan;xiaoym; true Apache License 2.0 - 0.0.11.0 - 0.0.11.0 + 0.0.13.0 + 0.0.13.0 @@ -31,13 +31,13 @@ - + - - - - + + + + diff --git a/test/Basic/Basic.csproj b/test/Basic/Basic.csproj index d7aa9b4..2e51ab9 100644 --- a/test/Basic/Basic.csproj +++ b/test/Basic/Basic.csproj @@ -7,9 +7,9 @@ - - - + + + diff --git a/test/Basic/Properties/launchSettings.json b/test/Basic/Properties/launchSettings.json index e8f0f7a..2b879f8 100644 --- a/test/Basic/Properties/launchSettings.json +++ b/test/Basic/Properties/launchSettings.json @@ -4,7 +4,7 @@ "commandName": "Project", "launchBrowser": true, "launchUrl": "", - "applicationUrl": "http://localhost:5000", + "applicationUrl": "http://localhost:5000;https://localhost:5001", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/test/Basic/Startup.cs b/test/Basic/Startup.cs index 9174f64..e3d43b3 100644 --- a/test/Basic/Startup.cs +++ b/test/Basic/Startup.cs @@ -27,6 +27,15 @@ namespace Basic public void ConfigureServices(IServiceCollection services) { services.AddControllers(); + services.AddCors(options => + { + options.AddPolicy("CorsPolicy", + builder => builder + .SetIsOriginAllowed((host) => true) + .AllowAnyMethod() + .AllowAnyHeader() + .AllowCredentials()); + }); services.AddSwaggerGen(c => { @@ -53,11 +62,11 @@ namespace Basic c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, "Basic.xml"),true); //c.EnableAnnotations(); - c.AddServer(new OpenApiServer() - { - Url = "http://localhost:81/admin/", - Description = "vvv" - }); + //c.AddServer(new OpenApiServer() + //{ + // Url = "http://localhost:81/admin/", + // Description = "vvv" + //}); c.CustomOperationIds(apiDesc => { var controllerAction = apiDesc.ActionDescriptor as ControllerActionDescriptor; @@ -75,7 +84,9 @@ namespace Basic { app.UseDeveloperExceptionPage(); } - + app.UseCors(policyName: "CorsPolicy"); + app.UseHsts(); + app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); diff --git a/test/Knife4jUIDemo/Knife4jUIDemo.csproj b/test/Knife4jUIDemo/Knife4jUIDemo.csproj index 4d3bf27..9d77fbf 100644 --- a/test/Knife4jUIDemo/Knife4jUIDemo.csproj +++ b/test/Knife4jUIDemo/Knife4jUIDemo.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/test/WebSites/NSwag.Swagger.Knife4jUI/NSwag.Swagger.Knife4jUI.csproj b/test/WebSites/NSwag.Swagger.Knife4jUI/NSwag.Swagger.Knife4jUI.csproj index eb543ae..9504191 100644 --- a/test/WebSites/NSwag.Swagger.Knife4jUI/NSwag.Swagger.Knife4jUI.csproj +++ b/test/WebSites/NSwag.Swagger.Knife4jUI/NSwag.Swagger.Knife4jUI.csproj @@ -5,7 +5,7 @@ - + diff --git a/test/WebSites/OAuth2Integration/OAuth2Integration.csproj b/test/WebSites/OAuth2Integration/OAuth2Integration.csproj index 32ddaf2..7731bee 100644 --- a/test/WebSites/OAuth2Integration/OAuth2Integration.csproj +++ b/test/WebSites/OAuth2Integration/OAuth2Integration.csproj @@ -5,12 +5,12 @@ - + - - - + + +