diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-11-09 21:18:06 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-11-09 21:18:06 -0500 |
commit | fd6a719b02d1d45d27509f44f09eefe52124ee20 (patch) | |
tree | 9ed0be2a6dcf68a54bc1de0e252670c178726887 /src/SMAPI.Web/Framework/Caching/Wiki | |
parent | 01db5e364d0db74f480dacd20877cc5d4728d60c (diff) | |
download | SMAPI-fd6a719b02d1d45d27509f44f09eefe52124ee20.tar.gz SMAPI-fd6a719b02d1d45d27509f44f09eefe52124ee20.tar.bz2 SMAPI-fd6a719b02d1d45d27509f44f09eefe52124ee20.zip |
overhaul update checks
This commit moves the core update-check logic serverside, and adds support for community-defined version mappings. For example, that means false update alerts can now be solved by the community for all players.
Diffstat (limited to 'src/SMAPI.Web/Framework/Caching/Wiki')
-rw-r--r-- | src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs b/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs index fddf99ee..8569984a 100644 --- a/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs +++ b/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs @@ -1,6 +1,9 @@ using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using MongoDB.Bson; +using MongoDB.Bson.Serialization.Attributes; +using MongoDB.Bson.Serialization.Options; using StardewModdingAPI.Toolkit; using StardewModdingAPI.Toolkit.Framework.Clients.Wiki; @@ -109,6 +112,17 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki /// <summary>The URL to the latest unofficial update, if applicable.</summary> public string BetaUnofficialUrl { get; set; } + /**** + ** Version maps + ****/ + /// <summary>Maps local versions to a semantic version for update checks.</summary> + [BsonDictionaryOptions(Representation = DictionaryRepresentation.ArrayOfArrays)] + public IDictionary<string, string> MapLocalVersions { get; set; } + + /// <summary>Maps remote versions to a semantic version for update checks.</summary> + [BsonDictionaryOptions(Representation = DictionaryRepresentation.ArrayOfArrays)] + public IDictionary<string, string> MapRemoteVersions { get; set; } + /********* ** Accessors @@ -154,6 +168,10 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki this.BetaBrokeIn = mod.BetaCompatibility?.BrokeIn; this.BetaUnofficialVersion = mod.BetaCompatibility?.UnofficialVersion?.ToString(); this.BetaUnofficialUrl = mod.BetaCompatibility?.UnofficialUrl; + + // version maps + this.MapLocalVersions = mod.MapLocalVersions; + this.MapRemoteVersions = mod.MapRemoteVersions; } /// <summary>Reconstruct the original model.</summary> @@ -186,7 +204,11 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki BrokeIn = this.MainBrokeIn, UnofficialVersion = this.MainUnofficialVersion != null ? new SemanticVersion(this.MainUnofficialVersion) : null, UnofficialUrl = this.MainUnofficialUrl - } + }, + + // version maps + MapLocalVersions = this.MapLocalVersions, + MapRemoteVersions = this.MapRemoteVersions }; // beta compatibility |