From d68e4f97665898027f45782b8e66333912ae08ea Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 12 Jan 2020 19:41:14 -0500 Subject: [PATCH] drop pre-3.0 update-check support --- docs/release-notes.md | 1 + .../Framework/Clients/WebApi/ModEntryModel.cs | 22 ------------------- .../Controllers/ModsApiController.cs | 17 ++------------ 3 files changed, 3 insertions(+), 37 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index bc30bed7..e2c6d500 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -15,6 +15,7 @@ For modders: For SMAPI/tool developers: * The `/mods` web API endpoint now includes version mappings from the wiki. + * Dropped API support for the pre-3.0 update-check format. ## 3.1 Released 05 January 2019 for Stardew Valley 1.4 or later. diff --git a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryModel.cs b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryModel.cs index f1bcfccc..2f58a3f1 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryModel.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryModel.cs @@ -1,5 +1,3 @@ -using System; - namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi { /// Metadata about a mod. @@ -17,26 +15,6 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi /// Optional extended data which isn't needed for update checks. public ModExtendedMetadataModel Metadata { get; set; } - /// The main version. - [Obsolete] - public ModEntryVersionModel Main { get; set; } - - /// The latest optional version, if newer than . - [Obsolete] - public ModEntryVersionModel Optional { get; set; } - - /// The latest unofficial version, if newer than and . - [Obsolete] - public ModEntryVersionModel Unofficial { get; set; } - - /// The latest unofficial version for the current Stardew Valley or SMAPI beta, if any (see ). - [Obsolete] - public ModEntryVersionModel UnofficialForBeta { get; set; } - - /// Whether a Stardew Valley or SMAPI beta which affects mod compatibility is in progress. If this is true, should be used for beta versions of SMAPI instead of . - [Obsolete] - public bool? HasBetaInfo { get; set; } - /// The errors that occurred while fetching update data. public string[] Errors { get; set; } = new string[0]; } diff --git a/src/SMAPI.Web/Controllers/ModsApiController.cs b/src/SMAPI.Web/Controllers/ModsApiController.cs index 3e3b81c8..f194b4d0 100644 --- a/src/SMAPI.Web/Controllers/ModsApiController.cs +++ b/src/SMAPI.Web/Controllers/ModsApiController.cs @@ -94,8 +94,6 @@ namespace StardewModdingAPI.Web.Controllers if (model?.Mods == null) return new ModEntryModel[0]; - bool legacyMode = SemanticVersion.TryParse(version, out ISemanticVersion parsedVersion) && parsedVersion.IsOlderThan("3.0.0-beta.20191109"); - // fetch wiki data WikiModEntry[] wikiData = this.WikiCache.GetWikiMods().Select(p => p.GetModel()).ToArray(); IDictionary mods = new Dictionary(StringComparer.CurrentCultureIgnoreCase); @@ -104,19 +102,8 @@ namespace StardewModdingAPI.Web.Controllers if (string.IsNullOrWhiteSpace(mod.ID)) continue; - ModEntryModel result = await this.GetModData(mod, wikiData, model.IncludeExtendedMetadata || legacyMode, model.ApiVersion); - if (legacyMode) - { - result.Main = result.Metadata.Main; - result.Optional = result.Metadata.Optional; - result.Unofficial = result.Metadata.Unofficial; - result.UnofficialForBeta = result.Metadata.UnofficialForBeta; - result.HasBetaInfo = result.Metadata.BetaCompatibilityStatus != null; - result.SuggestedUpdate = null; - if (!model.IncludeExtendedMetadata) - result.Metadata = null; - } - else if (!model.IncludeExtendedMetadata && (model.ApiVersion == null || mod.InstalledVersion == null)) + ModEntryModel result = await this.GetModData(mod, wikiData, model.IncludeExtendedMetadata, model.ApiVersion); + if (!model.IncludeExtendedMetadata && (model.ApiVersion == null || mod.InstalledVersion == null)) { var errors = new List(result.Errors); errors.Add($"This API can't suggest an update because {nameof(model.ApiVersion)} or {nameof(mod.InstalledVersion)} are null, and you didn't specify {nameof(model.IncludeExtendedMetadata)} to get other info. See the SMAPI technical docs for usage.");