summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web.LegacyRedirects
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI.Web.LegacyRedirects')
-rw-r--r--src/SMAPI.Web.LegacyRedirects/Controllers/ModsApiController.cs33
-rw-r--r--src/SMAPI.Web.LegacyRedirects/Framework/LambdaRewriteRule.cs37
-rw-r--r--src/SMAPI.Web.LegacyRedirects/Program.cs23
-rw-r--r--src/SMAPI.Web.LegacyRedirects/Properties/launchSettings.json29
-rw-r--r--src/SMAPI.Web.LegacyRedirects/SMAPI.Web.LegacyRedirects.csproj21
5 files changed, 0 insertions, 143 deletions
diff --git a/src/SMAPI.Web.LegacyRedirects/Controllers/ModsApiController.cs b/src/SMAPI.Web.LegacyRedirects/Controllers/ModsApiController.cs
deleted file mode 100644
index 44ed0b6b..00000000
--- a/src/SMAPI.Web.LegacyRedirects/Controllers/ModsApiController.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-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>();
- }
- }
-}
diff --git a/src/SMAPI.Web.LegacyRedirects/Framework/LambdaRewriteRule.cs b/src/SMAPI.Web.LegacyRedirects/Framework/LambdaRewriteRule.cs
deleted file mode 100644
index e5138e5c..00000000
--- a/src/SMAPI.Web.LegacyRedirects/Framework/LambdaRewriteRule.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Rewrite;
-
-namespace SMAPI.Web.LegacyRedirects.Framework
-{
- /// <summary>Rewrite requests to prepend the subdomain portion (if any) to the path.</summary>
- /// <remarks>Derived from <a href="https://stackoverflow.com/a/44526747/262123" />.</remarks>
- internal class LambdaRewriteRule : IRule
- {
- /*********
- ** Accessors
- *********/
- /// <summary>Rewrite an HTTP request if needed.</summary>
- private readonly Action<RewriteContext, HttpRequest, HttpResponse> Rewrite;
-
-
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- /// <param name="rewrite">Rewrite an HTTP request if needed.</param>
- public LambdaRewriteRule(Action<RewriteContext, HttpRequest, HttpResponse> rewrite)
- {
- this.Rewrite = rewrite ?? throw new ArgumentNullException(nameof(rewrite));
- }
-
- /// <summary>Applies the rule. Implementations of ApplyRule should set the value for <see cref="RewriteContext.Result" /> (defaults to RuleResult.ContinueRules).</summary>
- /// <param name="context">The rewrite context.</param>
- public void ApplyRule(RewriteContext context)
- {
- HttpRequest request = context.HttpContext.Request;
- HttpResponse response = context.HttpContext.Response;
- this.Rewrite(context, request, response);
- }
- }
-}
diff --git a/src/SMAPI.Web.LegacyRedirects/Program.cs b/src/SMAPI.Web.LegacyRedirects/Program.cs
deleted file mode 100644
index 6adee877..00000000
--- a/src/SMAPI.Web.LegacyRedirects/Program.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Hosting;
-
-namespace SMAPI.Web.LegacyRedirects
-{
- /// <summary>The main app entry point.</summary>
- public class Program
- {
- /*********
- ** Public methods
- *********/
- /// <summary>The main app entry point.</summary>
- /// <param name="args">The command-line arguments.</param>
- public static void Main(string[] args)
- {
- Host
- .CreateDefaultBuilder(args)
- .ConfigureWebHostDefaults(builder => builder.UseStartup<Startup>())
- .Build()
- .Run();
- }
- }
-}
diff --git a/src/SMAPI.Web.LegacyRedirects/Properties/launchSettings.json b/src/SMAPI.Web.LegacyRedirects/Properties/launchSettings.json
deleted file mode 100644
index e9a1b210..00000000
--- a/src/SMAPI.Web.LegacyRedirects/Properties/launchSettings.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "iisSettings": {
- "windowsAuthentication": false,
- "anonymousAuthentication": true,
- "iisExpress": {
- "applicationUrl": "http://localhost:52756",
- "sslPort": 0
- }
- },
- "$schema": "http://json.schemastore.org/launchsettings.json",
- "profiles": {
- "IIS Express": {
- "commandName": "IISExpress",
- "launchBrowser": true,
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- }
- },
- "SMAPI.Web.LegacyRedirects": {
- "commandName": "Project",
- "launchBrowser": true,
- "launchUrl": "/",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- },
- "applicationUrl": "https://localhost:5001;http://localhost:5000"
- }
- }
-} \ No newline at end of file
diff --git a/src/SMAPI.Web.LegacyRedirects/SMAPI.Web.LegacyRedirects.csproj b/src/SMAPI.Web.LegacyRedirects/SMAPI.Web.LegacyRedirects.csproj
deleted file mode 100644
index 36831961..00000000
--- a/src/SMAPI.Web.LegacyRedirects/SMAPI.Web.LegacyRedirects.csproj
+++ /dev/null
@@ -1,21 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk.Web">
-
- <PropertyGroup>
- <TargetFramework>netcoreapp3.0</TargetFramework>
- </PropertyGroup>
-
- <ItemGroup>
- <Content Remove="aws-beanstalk-tools-defaults.json" />
- </ItemGroup>
-
- <ItemGroup>
- <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.2" />
- <PackageReference Include="Pathoschild.Http.FluentClient" Version="3.3.1" />
- </ItemGroup>
-
- <ItemGroup>
- <ProjectReference Include="..\SMAPI.Toolkit.CoreInterfaces\SMAPI.Toolkit.CoreInterfaces.csproj" />
- <ProjectReference Include="..\SMAPI.Toolkit\SMAPI.Toolkit.csproj" />
- </ItemGroup>
-
-</Project>