diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-12-01 21:55:20 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-12-02 20:14:07 -0500 |
commit | 5f532c259d5d3050bd6a053659067617db136d57 (patch) | |
tree | 06b8bf7ac63ccab8be27908002612a53d5975075 /src/SMAPI.Web.LegacyRedirects/Controllers | |
parent | 8766a79408ce79bd632c1fe1c9b17ab0a7a6a976 (diff) | |
download | SMAPI-5f532c259d5d3050bd6a053659067617db136d57.tar.gz SMAPI-5f532c259d5d3050bd6a053659067617db136d57.tar.bz2 SMAPI-5f532c259d5d3050bd6a053659067617db136d57.zip |
migrate from AWS to Azure
This commit migrates from subdomains to paths (due to the cost of a wildcard HTTPS certificate on Azure), adds a web project to redirect the old subdomains from AWS to Azure, and removes AWS-specific hacks.
Diffstat (limited to 'src/SMAPI.Web.LegacyRedirects/Controllers')
-rw-r--r-- | src/SMAPI.Web.LegacyRedirects/Controllers/ModsApiController.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/SMAPI.Web.LegacyRedirects/Controllers/ModsApiController.cs b/src/SMAPI.Web.LegacyRedirects/Controllers/ModsApiController.cs new file mode 100644 index 00000000..44ed0b6b --- /dev/null +++ b/src/SMAPI.Web.LegacyRedirects/Controllers/ModsApiController.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Pathoschild.Http.Client; +using StardewModdingAPI.Toolkit.Framework.Clients.WebApi; + +namespace SMAPI.Web.LegacyRedirects.Controllers +{ + /// <summary>Provides an API to perform mod update checks.</summary> + [ApiController] + [Produces("application/json")] + [Route("api/v{version}/mods")] + public class ModsApiController : Controller + { + /********* + ** Public methods + *********/ + /// <summary>Fetch version metadata for the given mods.</summary> + /// <param name="model">The mod search criteria.</param> + [HttpPost] + public async Task<IEnumerable<ModEntryModel>> PostAsync([FromBody] ModSearchModel model) + { + using IClient client = new FluentClient("https://smapi.io/api"); + + Startup.ConfigureJsonNet(client.Formatters.JsonFormatter.SerializerSettings); + + return await client + .PostAsync(this.Request.Path) + .WithBody(model) + .AsArray<ModEntryModel>(); + } + } +} |