diff --git a/PluralKit.API/Startup.cs b/PluralKit.API/Startup.cs index c935e690..1883f11f 100644 --- a/PluralKit.API/Startup.cs +++ b/PluralKit.API/Startup.cs @@ -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();