mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
feat(api): redirect root to API docs, return 410 gone for v1 routes
This commit is contained in:
parent
1b5a90f612
commit
97d8863481
1 changed files with 9 additions and 1 deletions
|
|
@ -133,7 +133,15 @@ public class Startup
|
|||
app.UseRouting();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
app.UseEndpoints(endpoints => endpoints.MapControllers());
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
// register base / legacy routes
|
||||
endpoints.MapMethods("", new string[] { }, (context) => { context.Response.Redirect("https://pluralkit.me/api"); return Task.CompletedTask;});
|
||||
endpoints.MapMethods("v1/{*_}", new string[] { }, (context) => context.Response.WriteJSON(410, "{\"message\":\"Unsupported API version\",\"code\":0}"));
|
||||
|
||||
// register controllers
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
|
||||
// metrics
|
||||
app.UseMetricsAllMiddleware();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue