diff options
Diffstat (limited to 'src')
48 files changed, 667 insertions, 289 deletions
diff --git a/src/SMAPI.Installer/unix-install.sh b/src/SMAPI.Installer/unix-install.sh index e3a5d8cc..6d0c86ce 100644 --- a/src/SMAPI.Installer/unix-install.sh +++ b/src/SMAPI.Installer/unix-install.sh @@ -12,6 +12,9 @@ elif type type >/dev/null 2>&1; then COMMAND="type" fi +# if $TERM is not set to xterm, mono will bail out when attempting to write to the console. +export TERM=xterm + # validate Mono & run installer if $COMMAND mono >/dev/null 2>&1; then mono internal/unix-install.exe diff --git a/src/SMAPI.Installer/unix-launcher.sh b/src/SMAPI.Installer/unix-launcher.sh index f81828f0..bebba9fe 100644 --- a/src/SMAPI.Installer/unix-launcher.sh +++ b/src/SMAPI.Installer/unix-launcher.sh @@ -62,7 +62,7 @@ else fi # select terminal (prefer $TERMINAL for overrides and testing, then xterm for best compatibility, then known supported terminals) - for terminal in "$TERMINAL" xterm gnome-terminal kitty terminator xfce4-terminal konsole terminal termite x-terminal-emulator; do + for terminal in "$TERMINAL" xterm gnome-terminal kitty terminator xfce4-terminal konsole terminal termite alacritty x-terminal-emulator; do if $COMMAND "$terminal" 2>/dev/null; then # Find the true shell behind x-terminal-emulator if [ "$(basename "$(readlink -f $(which "$terminal"))")" != "x-terminal-emulator" ]; then @@ -100,6 +100,14 @@ else # Kitty overrides the TERM varible unless you set it explicitly kitty -o term=xterm $LAUNCHER ;; + alacritty) + # Alacritty doesn't like the double quotes or the variable + if [ "$ARCH" == "x86_64" ]; then + alacritty -e sh -c 'TERM=xterm ./StardewModdingAPI.bin.x86_64 $*' + else + alacritty -e sh -c 'TERM=xterm ./StardewModdingAPI.bin.x86 $*' + fi + ;; xterm|xfce4-terminal|gnome-terminal|terminal|termite) $LAUNCHTERM -e "sh -c 'TERM=xterm $LAUNCHER'" ;; diff --git a/src/SMAPI.Mods.ConsoleCommands/manifest.json b/src/SMAPI.Mods.ConsoleCommands/manifest.json index 802de3a6..badea825 100644 --- a/src/SMAPI.Mods.ConsoleCommands/manifest.json +++ b/src/SMAPI.Mods.ConsoleCommands/manifest.json @@ -1,9 +1,9 @@ { "Name": "Console Commands", "Author": "SMAPI", - "Version": "3.0.0", + "Version": "3.0.1", "Description": "Adds SMAPI console commands that let you manipulate the game.", "UniqueID": "SMAPI.ConsoleCommands", "EntryDll": "ConsoleCommands.dll", - "MinimumApiVersion": "3.0.0" + "MinimumApiVersion": "3.0.1" } diff --git a/src/SMAPI.Mods.SaveBackup/manifest.json b/src/SMAPI.Mods.SaveBackup/manifest.json index eddd3443..252c359f 100644 --- a/src/SMAPI.Mods.SaveBackup/manifest.json +++ b/src/SMAPI.Mods.SaveBackup/manifest.json @@ -1,9 +1,9 @@ { "Name": "Save Backup", "Author": "SMAPI", - "Version": "3.0.0", + "Version": "3.0.1", "Description": "Automatically backs up all your saves once per day into its folder.", "UniqueID": "SMAPI.SaveBackup", "EntryDll": "SaveBackup.dll", - "MinimumApiVersion": "3.0.0" + "MinimumApiVersion": "3.0.1" } diff --git a/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs b/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs index c91ec27f..48afcaa2 100644 --- a/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs +++ b/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs @@ -25,44 +25,50 @@ namespace SMAPI.Tests.Utilities [TestCase("1.2.3-some-tag.4", ExpectedResult = "1.2.3-some-tag.4")] [TestCase("1.2.3-SoME-tAg.4", ExpectedResult = "1.2.3-SoME-tAg.4")] [TestCase("1.2.3-some-tag.4 ", ExpectedResult = "1.2.3-some-tag.4")] + [TestCase("1.2.3-some-tag.4+build.004", ExpectedResult = "1.2.3-some-tag.4+build.004")] + [TestCase("1.2+3.4.5-build.004", ExpectedResult = "1.2.0+3.4.5-build.004")] public string Constructor_FromString(string input) { return new SemanticVersion(input).ToString(); } [Test(Description = "Assert that the constructor sets the expected values for all valid versions when constructed from the individual numbers.")] - [TestCase(1, 0, 0, null, ExpectedResult = "1.0.0")] - [TestCase(3000, 4000, 5000, null, ExpectedResult = "3000.4000.5000")] - [TestCase(1, 2, 3, "", ExpectedResult = "1.2.3")] - [TestCase(1, 2, 3, " ", ExpectedResult = "1.2.3")] - [TestCase(1, 2, 3, "0", ExpectedResult = "1.2.3-0")] - [TestCase(1, 2, 3, "some-tag.4", ExpectedResult = "1.2.3-some-tag.4")] - [TestCase(1, 2, 3, "sOMe-TaG.4", ExpectedResult = "1.2.3-sOMe-TaG.4")] - [TestCase(1, 2, 3, "some-tag.4 ", ExpectedResult = "1.2.3-some-tag.4")] - public string Constructor_FromParts(int major, int minor, int patch, string tag) + [TestCase(1, 0, 0, null, null, ExpectedResult = "1.0.0")] + [TestCase(3000, 4000, 5000, null, null, ExpectedResult = "3000.4000.5000")] + [TestCase(1, 2, 3, "", null, ExpectedResult = "1.2.3")] + [TestCase(1, 2, 3, " ", null, ExpectedResult = "1.2.3")] + [TestCase(1, 2, 3, "0", null, ExpectedResult = "1.2.3-0")] + [TestCase(1, 2, 3, "some-tag.4", null, ExpectedResult = "1.2.3-some-tag.4")] + [TestCase(1, 2, 3, "sOMe-TaG.4", null, ExpectedResult = "1.2.3-sOMe-TaG.4")] + [TestCase(1, 2, 3, "some-tag.4 ", null, ExpectedResult = "1.2.3-some-tag.4")] + [TestCase(1, 2, 3, "some-tag.4 ", "build.004", ExpectedResult = "1.2.3-some-tag.4+build.004")] + [TestCase(1, 2, 0, null, "3.4.5-build.004", ExpectedResult = "1.2.0+3.4.5-build.004")] + public string Constructor_FromParts(int major, int minor, int patch, string prerelease, string build) { // act - ISemanticVersion version = new SemanticVersion(major, minor, patch, tag); + ISemanticVersion version = new SemanticVersion(major, minor, patch, prerelease, build); // assert Assert.AreEqual(major, version.MajorVersion, "The major version doesn't match the given value."); Assert.AreEqual(minor, version.MinorVersion, "The minor version doesn't match the given value."); Assert.AreEqual(patch, version.PatchVersion, "The patch version doesn't match the given value."); - Assert.AreEqual(string.IsNullOrWhiteSpace(tag) ? null : tag.Trim(), version.PrereleaseTag, "The tag doesn't match the given value."); + Assert.AreEqual(string.IsNullOrWhiteSpace(prerelease) ? null : prerelease.Trim(), version.PrereleaseTag, "The prerelease tag doesn't match the given value."); + Assert.AreEqual(string.IsNullOrWhiteSpace(build) ? null : build.Trim(), version.BuildMetadata, "The build metadata doesn't match the given value."); return version.ToString(); } [Test(Description = "Assert that the constructor throws the expected exception for invalid versions when constructed from the individual numbers.")] - [TestCase(0, 0, 0, null)] - [TestCase(-1, 0, 0, null)] - [TestCase(0, -1, 0, null)] - [TestCase(0, 0, -1, null)] - [TestCase(1, 0, 0, "-tag")] - [TestCase(1, 0, 0, "tag spaces")] - [TestCase(1, 0, 0, "tag~")] - public void Constructor_FromParts_WithInvalidValues(int major, int minor, int patch, string tag) + [TestCase(0, 0, 0, null, null)] + [TestCase(-1, 0, 0, null, null)] + [TestCase(0, -1, 0, null, null)] + [TestCase(0, 0, -1, null, null)] + [TestCase(1, 0, 0, "-tag", null)] + [TestCase(1, 0, 0, "tag spaces", null)] + [TestCase(1, 0, 0, "tag~", null)] + [TestCase(1, 0, 0, null, "build~")] + public void Constructor_FromParts_WithInvalidValues(int major, int minor, int patch, string prerelease, string build) { - this.AssertAndLogException<FormatException>(() => new SemanticVersion(major, minor, patch, tag)); + this.AssertAndLogException<FormatException>(() => new SemanticVersion(major, minor, patch, prerelease, build)); } [Test(Description = "Assert that the constructor sets the expected values for all valid versions when constructed from an assembly version.")] @@ -98,6 +104,7 @@ namespace SMAPI.Tests.Utilities [TestCase("1.2.3--some-tag")] [TestCase("1.2.3-some-tag...")] [TestCase("1.2.3-some-tag...4")] + [TestCase("1.2.3-some-tag.4+build...4")] [TestCase("apple")] [TestCase("-apple")] [TestCase("-5")] @@ -119,6 +126,8 @@ namespace SMAPI.Tests.Utilities [TestCase("1.0-beta", "1.0-beta", ExpectedResult = 0)] [TestCase("1.0-beta.10", "1.0-beta.10", ExpectedResult = 0)] [TestCase("1.0-beta", "1.0-beta ", ExpectedResult = 0)] + [TestCase("1.0-beta+build.001", "1.0-beta+build.001", ExpectedResult = 0)] + [TestCase("1.0-beta+build.001", "1.0-beta+build.006", ExpectedResult = 0)] // build metadata must not affect precedence // less than [TestCase("0.5.7", "0.5.8", ExpectedResult = -1)] @@ -156,6 +165,8 @@ namespace SMAPI.Tests.Utilities [TestCase("1.0-beta", "1.0-beta", ExpectedResult = false)] [TestCase("1.0-beta.10", "1.0-beta.10", ExpectedResult = false)] [TestCase("1.0-beta", "1.0-beta ", ExpectedResult = false)] + [TestCase("1.0-beta+build.001", "1.0-beta+build.001", ExpectedResult = false)] // build metadata must not affect precedence + [TestCase("1.0-beta+build.001", "1.0-beta+build.006", ExpectedResult = false)] // build metadata must not affect precedence // less than [TestCase("0.5.7", "0.5.8", ExpectedResult = true)] @@ -192,6 +203,8 @@ namespace SMAPI.Tests.Utilities [TestCase("1.0-beta", "1.0-beta", ExpectedResult = false)] [TestCase("1.0-beta.10", "1.0-beta.10", ExpectedResult = false)] [TestCase("1.0-beta", "1.0-beta ", ExpectedResult = false)] + [TestCase("1.0-beta+build.001", "1.0-beta+build.001", ExpectedResult = false)] // build metadata must not affect precedence + [TestCase("1.0-beta+build.001", "1.0-beta+build.006", ExpectedResult = false)] // build metadata must not affect precedence // less than [TestCase("0.5.7", "0.5.8", ExpectedResult = false)] @@ -279,6 +292,8 @@ namespace SMAPI.Tests.Utilities [TestCase("1.11")] [TestCase("1.2")] [TestCase("1.2.15")] + [TestCase("1.4.0.1")] + [TestCase("1.4.0.6")] public void GameVersion(string versionStr) { // act @@ -286,7 +301,6 @@ namespace SMAPI.Tests.Utilities // assert Assert.AreEqual(versionStr, version.ToString(), "The game version did not round-trip to the same value."); - Assert.IsTrue(version.IsOlderThan(new SemanticVersion("1.2.30")), "The game version should be considered older than the later semantic versions."); } diff --git a/src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs b/src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs index 4ec87d7c..b8572d50 100644 --- a/src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs +++ b/src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs @@ -20,6 +20,9 @@ namespace StardewModdingAPI /// <summary>An optional prerelease tag.</summary> string PrereleaseTag { get; } + /// <summary>Optional build metadata. This is ignored when determining version precedence.</summary> + string BuildMetadata { get; } + /********* ** Accessors diff --git a/src/SMAPI.Toolkit/SemanticVersion.cs b/src/SMAPI.Toolkit/SemanticVersion.cs index 2ce3578e..4955dcae 100644 --- a/src/SMAPI.Toolkit/SemanticVersion.cs +++ b/src/SMAPI.Toolkit/SemanticVersion.cs @@ -7,8 +7,7 @@ namespace StardewModdingAPI.Toolkit /// <remarks> /// The implementation is defined by Semantic Version 2.0 (https://semver.org/), with a few deviations: /// - short-form "x.y" versions are supported (equivalent to "x.y.0"); - /// - hyphens are synonymous with dots in prerelease tags (like "-unofficial.3-pathoschild"); - /// - +build suffixes are not supported; + /// - hyphens are synonymous with dots in prerelease tags and build metadata (like "-unofficial.3-pathoschild"); /// - and "-unofficial" in prerelease tags is always lower-precedence (e.g. "1.0-beta" is newer than "1.0-unofficial"). /// </remarks> public class SemanticVersion : ISemanticVersion @@ -16,11 +15,11 @@ namespace StardewModdingAPI.Toolkit /********* ** Fields *********/ - /// <summary>A regex pattern matching a valid prerelease tag.</summary> + /// <summary>A regex pattern matching a valid prerelease or build metadata tag.</summary> internal const string TagPattern = @"(?>[a-z0-9]+[\-\.]?)+"; /// <summary>A regex pattern matching a version within a larger string.</summary> - internal const string UnboundedVersionPattern = @"(?>(?<major>0|[1-9]\d*))\.(?>(?<minor>0|[1-9]\d*))(?>(?:\.(?<patch>0|[1-9]\d*))?)(?:-(?<prerelease>" + SemanticVersion.TagPattern + "))?"; + internal const string UnboundedVersionPattern = @"(?>(?<major>0|[1-9]\d*))\.(?>(?<minor>0|[1-9]\d*))(?>(?:\.(?<patch>0|[1-9]\d*))?)(?:-(?<prerelease>" + SemanticVersion.TagPattern + "))?(?:\\+(?<buildmetadata>" + SemanticVersion.TagPattern + "))?"; /// <summary>A regular expression matching a semantic version string.</summary> /// <remarks>This pattern is derived from the BNF documentation in the <a href="https://github.com/mojombo/semver">semver repo</a>, with deviations to support the Stardew Valley mod conventions (see remarks on <see cref="SemanticVersion"/>).</remarks> @@ -42,6 +41,9 @@ namespace StardewModdingAPI.Toolkit /// <summary>An optional prerelease tag.</summary> public string PrereleaseTag { get; } + /// <summary>Optional build metadata. This is ignored when determining version precedence.</summary> + public string BuildMetadata { get; } + /********* ** Public methods @@ -51,12 +53,14 @@ namespace StardewModdingAPI.Toolkit /// <param name="minor">The minor version incremented for backwards-compatible changes.</param> /// <param name="patch">The patch version for backwards-compatible fixes.</param> /// <param name="prereleaseTag">An optional prerelease tag.</param> - public SemanticVersion(int major, int minor, int patch, string prereleaseTag = null) + /// <param name="buildMetadata">Optional build metadata. This is ignored when determining version precedence.</param> + public SemanticVersion(int major, int minor, int patch, string prereleaseTag = null, string buildMetadata = null) { this.MajorVersion = major; this.MinorVersion = minor; this.PatchVersion = patch; this.PrereleaseTag = this.GetNormalizedTag(prereleaseTag); + this.BuildMetadata = this.GetNormalizedTag(buildMetadata); this.AssertValid(); } @@ -94,6 +98,7 @@ namespace StardewModdingAPI.Toolkit this.MinorVersion = match.Groups["minor"].Success ? int.Parse(match.Groups["minor"].Value) : 0; this.PatchVersion = match.Groups["patch"].Success ? int.Parse(match.Groups["patch"].Value) : 0; this.PrereleaseTag = match.Groups["prerelease"].Success ? this.GetNormalizedTag(match.Groups["prerelease"].Value) : null; + this.BuildMetadata = match.Groups["buildmetadata"].Success ? this.GetNormalizedTag(match.Groups["buildmetadata"].Value) : null; this.AssertValid(); } @@ -175,6 +180,8 @@ namespace StardewModdingAPI.Toolkit string version = $"{this.MajorVersion}.{this.MinorVersion}.{this.PatchVersion}"; if (this.PrereleaseTag != null) version += $"-{this.PrereleaseTag}"; + if (this.BuildMetadata != null) + version += $"+{this.BuildMetadata}"; return version; } @@ -200,7 +207,7 @@ namespace StardewModdingAPI.Toolkit /********* ** Private methods *********/ - /// <summary>Get a normalized build tag.</summary> + /// <summary>Get a normalized prerelease or build tag.</summary> /// <param name="tag">The tag to normalize.</param> private string GetNormalizedTag(string tag) { @@ -277,12 +284,21 @@ namespace StardewModdingAPI.Toolkit throw new FormatException($"{this} isn't a valid semantic version. The major, minor, and patch numbers can't be negative."); if (this.MajorVersion == 0 && this.MinorVersion == 0 && this.PatchVersion == 0) throw new FormatException($"{this} isn't a valid semantic version. At least one of the major, minor, and patch numbers must be more than zero."); + if (this.PrereleaseTag != null) { if (this.PrereleaseTag.Trim() == "") - throw new FormatException($"{this} isn't a valid semantic version. The tag cannot be a blank string (but may be omitted)."); + throw new FormatException($"{this} isn't a valid semantic version. The prerelease tag cannot be a blank string (but may be omitted)."); if (!Regex.IsMatch(this.PrereleaseTag, $"^{SemanticVersion.TagPattern}$", RegexOptions.IgnoreCase)) - throw new FormatException($"{this} isn't a valid semantic version. The tag is invalid."); + throw new FormatException($"{this} isn't a valid semantic version. The prerelease tag is invalid."); + } + + if (this.BuildMetadata != null) + { + if (this.BuildMetadata.Trim() == "") + throw new FormatException($"{this} isn't a valid semantic version. The build metadata cannot be a blank string (but may be omitted)."); + if (!Regex.IsMatch(this.BuildMetadata, $"^{SemanticVersion.TagPattern}$", RegexOptions.IgnoreCase)) + throw new FormatException($"{this} isn't a valid semantic version. The build metadata is invalid."); } } } 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>(); + } + } +} diff --git a/src/SMAPI.Web.LegacyRedirects/Framework/LambdaRewriteRule.cs b/src/SMAPI.Web.LegacyRedirects/Framework/LambdaRewriteRule.cs new file mode 100644 index 00000000..e5138e5c --- /dev/null +++ b/src/SMAPI.Web.LegacyRedirects/Framework/LambdaRewriteRule.cs @@ -0,0 +1,37 @@ +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 new file mode 100644 index 00000000..6adee877 --- /dev/null +++ b/src/SMAPI.Web.LegacyRedirects/Program.cs @@ -0,0 +1,23 @@ +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 new file mode 100644 index 00000000..e9a1b210 --- /dev/null +++ b/src/SMAPI.Web.LegacyRedirects/Properties/launchSettings.json @@ -0,0 +1,29 @@ +{ + "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 new file mode 100644 index 00000000..a3d5c2b6 --- /dev/null +++ b/src/SMAPI.Web.LegacyRedirects/SMAPI.Web.LegacyRedirects.csproj @@ -0,0 +1,21 @@ +<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.0" /> + <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> diff --git a/src/SMAPI.Web.LegacyRedirects/Startup.cs b/src/SMAPI.Web.LegacyRedirects/Startup.cs new file mode 100644 index 00000000..4af51575 --- /dev/null +++ b/src/SMAPI.Web.LegacyRedirects/Startup.cs @@ -0,0 +1,94 @@ +using System.Net; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Rewrite; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Newtonsoft.Json; +using SMAPI.Web.LegacyRedirects.Framework; +using StardewModdingAPI.Toolkit.Serialization; + +namespace SMAPI.Web.LegacyRedirects +{ + /// <summary>The web app startup configuration.</summary> + public class Startup + { + /********* + ** Public methods + *********/ + /// <summary>The method called by the runtime to add services to the container.</summary> + /// <param name="services">The service injection container.</param> + public void ConfigureServices(ISe |
