From 53a1aab8e1311fbcfd715fb5e54f04ec2c3baebb Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Wed, 6 Jun 2018 21:53:20 -0500 Subject: [PATCH] try setting swagger host ref #131 --- .github/README.md | 4 ++-- src/FilterLists.Api/Startup.cs | 9 ++++++++- src/FilterLists.Web/ClientApp/components/Layout.tsx | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/README.md b/.github/README.md index 73653389f..63ca0a36c 100644 --- a/.github/README.md +++ b/.github/README.md @@ -9,7 +9,7 @@ FilterLists is the independent, comprehensive directory of filter and host lists ## Links | Site | API | | --------------------------------------------------- | ------------------------------------------------------ | -| [v3 (Live, Beta)](https://filterlists.com/) | [v1 (Live, Beta)](https://filterlists.com/api/swagger/)| +| [v3 (Live, Beta)](https://filterlists.com/) | [v1 (Live, Beta)](https://filterlists.com/api/docs/) | | [v2 (Legacy, Frozen)](https://v2.filterlists.com/) | | | [v1 (Legacy, Frozen)](https://v1.filterlists.com/) | | @@ -51,4 +51,4 @@ FilterLists does not condone or endorse implementing any particular FilterList o ### Privacy -We respect your privacy. That is the whole point of this site. The only minor data we collect about visitors is what [CloudFlare](https://www.cloudflare.com/analytics/) and [GitHub](https://help.github.com/articles/github-privacy-statement/) captures. +We respect your privacy. That is the whole point of this site. The only minor data we collect about visitors is what [CloudFlare](https://www.cloudflare.com/analytics/) and [GitHub](https://help.github.com/articles/github-privacy-statement/) captures. \ No newline at end of file diff --git a/src/FilterLists.Api/Startup.cs b/src/FilterLists.Api/Startup.cs index c84519fdc..021f9311a 100644 --- a/src/FilterLists.Api/Startup.cs +++ b/src/FilterLists.Api/Startup.cs @@ -58,11 +58,18 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) app.UseStaticFiles(); app.UseCookiePolicy(); app.UseMvc(); - app.UseSwagger(UseLowercaseControllerNameInSwaggerHack); + app.UseSwagger( + c => + { + c.PreSerializeFilters.Add((swaggerDoc, httpReq) => swaggerDoc.Host = httpReq.Host.Value); + UseLowercaseControllerNameInSwaggerHack(c); + }); + app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "FilterLists API V1"); c.DocumentTitle = "FilterLists API"; + c.RoutePrefix = "docs"; }); MigrateAndSeedDatabase(app); } diff --git a/src/FilterLists.Web/ClientApp/components/Layout.tsx b/src/FilterLists.Web/ClientApp/components/Layout.tsx index 077af8561..089172cc4 100644 --- a/src/FilterLists.Web/ClientApp/components/Layout.tsx +++ b/src/FilterLists.Web/ClientApp/components/Layout.tsx @@ -21,7 +21,7 @@ export class Layout extends React.Component {

- API | GitHub | By Collin M. Barrett + API | GitHub | By Collin M. Barrett

;