drop pre-3.0 update-check support
This commit is contained in:
parent
8b1fd90c6e
commit
d68e4f9766
|
@ -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.
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
using System;
|
||||
|
||||
namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi
|
||||
{
|
||||
/// <summary>Metadata about a mod.</summary>
|
||||
|
@ -17,26 +15,6 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi
|
|||
/// <summary>Optional extended data which isn't needed for update checks.</summary>
|
||||
public ModExtendedMetadataModel Metadata { get; set; }
|
||||
|
||||
/// <summary>The main version.</summary>
|
||||
[Obsolete]
|
||||
public ModEntryVersionModel Main { get; set; }
|
||||
|
||||
/// <summary>The latest optional version, if newer than <see cref="Main"/>.</summary>
|
||||
[Obsolete]
|
||||
public ModEntryVersionModel Optional { get; set; }
|
||||
|
||||
/// <summary>The latest unofficial version, if newer than <see cref="Main"/> and <see cref="Optional"/>.</summary>
|
||||
[Obsolete]
|
||||
public ModEntryVersionModel Unofficial { get; set; }
|
||||
|
||||
/// <summary>The latest unofficial version for the current Stardew Valley or SMAPI beta, if any (see <see cref="HasBetaInfo"/>).</summary>
|
||||
[Obsolete]
|
||||
public ModEntryVersionModel UnofficialForBeta { get; set; }
|
||||
|
||||
/// <summary>Whether a Stardew Valley or SMAPI beta which affects mod compatibility is in progress. If this is true, <see cref="UnofficialForBeta"/> should be used for beta versions of SMAPI instead of <see cref="Unofficial"/>.</summary>
|
||||
[Obsolete]
|
||||
public bool? HasBetaInfo { get; set; }
|
||||
|
||||
/// <summary>The errors that occurred while fetching update data.</summary>
|
||||
public string[] Errors { get; set; } = new string[0];
|
||||
}
|
||||
|
|
|
@ -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<string, ModEntryModel> mods = new Dictionary<string, ModEntryModel>(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<string>(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.");
|
||||
|
|
Loading…
Reference in New Issue