try setting swagger host

ref #131
This commit is contained in:
Collin M. Barrett 2018-06-06 21:53:20 -05:00
parent f24ab00c4c
commit 53a1aab8e1
3 changed files with 11 additions and 4 deletions

4
.github/README.md vendored
View file

@ -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.

View file

@ -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);
}

View file

@ -21,7 +21,7 @@ export class Layout extends React.Component<ILayoutProps, {}> {
</div>
<div className="row justify-content-center">
<p className="mt-2 ml-1 mr-1">
<a href="https://filterlists.com/api/swagger/">API</a> | <a href="https://github.com/collinbarrett/FilterLists">GitHub</a> | By <a href="https://collinmbarrett.com/">Collin M. Barrett</a>
<a href="https://filterlists.com/api/docs/">API</a> | <a href="https://github.com/collinbarrett/FilterLists">GitHub</a> | By <a href="https://collinmbarrett.com/">Collin M. Barrett</a>
</p>
</div>
</div>;