diff options
Diffstat (limited to 'src/SMAPI.Web')
-rw-r--r-- | src/SMAPI.Web/Controllers/ModsApiController.cs | 8 | ||||
-rw-r--r-- | src/SMAPI.Web/Framework/Extensions.cs | 2 | ||||
-rw-r--r-- | src/SMAPI.Web/wwwroot/schemas/content-patcher.json | 102 |
3 files changed, 89 insertions, 23 deletions
diff --git a/src/SMAPI.Web/Controllers/ModsApiController.cs b/src/SMAPI.Web/Controllers/ModsApiController.cs index cd5b6779..1956bf29 100644 --- a/src/SMAPI.Web/Controllers/ModsApiController.cs +++ b/src/SMAPI.Web/Controllers/ModsApiController.cs @@ -156,7 +156,7 @@ namespace StardewModdingAPI.Web.Controllers // get unofficial version if (wikiEntry?.Compatibility.UnofficialVersion != null && this.IsNewer(wikiEntry.Compatibility.UnofficialVersion, main?.Version) && this.IsNewer(wikiEntry.Compatibility.UnofficialVersion, optional?.Version)) - unofficial = new ModEntryVersionModel(wikiEntry.Compatibility.UnofficialVersion, $"{this.Url.PlainAction("Index", "Mods")}#{wikiEntry.Anchor}"); + unofficial = new ModEntryVersionModel(wikiEntry.Compatibility.UnofficialVersion, $"{this.Url.PlainAction("Index", "Mods", absoluteUrl: true)}#{wikiEntry.Anchor}"); // get unofficial version for beta if (wikiEntry?.HasBetaInfo == true) @@ -166,7 +166,7 @@ namespace StardewModdingAPI.Web.Controllers if (wikiEntry.BetaCompatibility.UnofficialVersion != null) { unofficialForBeta = (wikiEntry.BetaCompatibility.UnofficialVersion != null && this.IsNewer(wikiEntry.BetaCompatibility.UnofficialVersion, main?.Version) && this.IsNewer(wikiEntry.BetaCompatibility.UnofficialVersion, optional?.Version)) - ? new ModEntryVersionModel(wikiEntry.BetaCompatibility.UnofficialVersion, $"{this.Url.PlainAction("Index", "Mods")}#{wikiEntry.Anchor}") + ? new ModEntryVersionModel(wikiEntry.BetaCompatibility.UnofficialVersion, $"{this.Url.PlainAction("Index", "Mods", absoluteUrl: true)}#{wikiEntry.Anchor}") : null; } else @@ -198,9 +198,9 @@ namespace StardewModdingAPI.Web.Controllers List<ModEntryVersionModel> updates = new List<ModEntryVersionModel>(); if (this.IsRecommendedUpdate(installedVersion, main?.Version, useBetaChannel: true)) updates.Add(main); - if (this.IsRecommendedUpdate(installedVersion, optional?.Version, useBetaChannel: installedVersion.IsPrerelease())) + if (this.IsRecommendedUpdate(installedVersion, optional?.Version, useBetaChannel: installedVersion.IsPrerelease() || search.IsBroken)) updates.Add(optional); - if (this.IsRecommendedUpdate(installedVersion, unofficial?.Version, useBetaChannel: search.IsBroken)) + if (this.IsRecommendedUpdate(installedVersion, unofficial?.Version, useBetaChannel: true)) updates.Add(unofficial); if (this.IsRecommendedUpdate(installedVersion, unofficialForBeta?.Version, useBetaChannel: apiVersion.IsPrerelease())) updates.Add(unofficialForBeta); diff --git a/src/SMAPI.Web/Framework/Extensions.cs b/src/SMAPI.Web/Framework/Extensions.cs index 3a246245..5305b142 100644 --- a/src/SMAPI.Web/Framework/Extensions.cs +++ b/src/SMAPI.Web/Framework/Extensions.cs @@ -19,7 +19,7 @@ namespace StardewModdingAPI.Web.Framework /**** ** View helpers ****/ - /// <summary>Get a URL with the absolute path for an action method. Unlike <see cref="IUrlHelper.Action"/>, only the specified <paramref name="values"/> are added to the URL without merging values from the current HTTP request.</summary> + /// <summary>Get a URL for an action method. Unlike <see cref="IUrlHelper.Action"/>, only the specified <paramref name="values"/> are added to the URL without merging values from the current HTTP request.</summary> /// <param name="helper">The URL helper to extend.</param> /// <param name="action">The name of the action method.</param> /// <param name="controller">The name of the controller.</param> diff --git a/src/SMAPI.Web/wwwroot/schemas/content-patcher.json b/src/SMAPI.Web/wwwroot/schemas/content-patcher.json index 6e8a4e52..3fd24e4e 100644 --- a/src/SMAPI.Web/wwwroot/schemas/content-patcher.json +++ b/src/SMAPI.Web/wwwroot/schemas/content-patcher.json @@ -11,9 +11,9 @@ "title": "Format version", "description": "The format version. You should always use the latest version to enable the latest features and avoid obsolete behavior.", "type": "string", - "const": "1.15.0", + "const": "1.17.0", "@errorMessages": { - "const": "Incorrect value '@value'. This should be set to the latest format version, currently '1.15.0'." + "const": "Incorrect value '@value'. This should be set to the latest format version, currently '1.17.0'." } }, "ConfigSchema": { @@ -102,7 +102,7 @@ "title": "Action", "description": "The kind of change to make.", "type": "string", - "enum": [ "Load", "EditImage", "EditData", "EditMap" ] + "enum": [ "Load", "EditImage", "EditData", "EditMap", "Include" ] }, "Target": { "title": "Target asset", @@ -125,21 +125,27 @@ "description": "Whether to apply this patch. Default true. This fields supports immutable tokens (e.g. config tokens) if they return true/false.", "anyOf": [ { + "type": "boolean" + }, + { "type": "string", "enum": [ "true", "false" ] }, { "type": "string", "pattern": "\\{\\{[^{}]+\\}\\}" - }, - { - "type": "boolean" } ], "@errorMessages": { "anyOf": "Invalid value; must be true, false, or a single token which evaluates to true or false." } }, + "Update": { + "title": "Update", + "description": "When the patch should update if it changed. The possible values are 'OnDayStart' and 'OnLocationChange' (defaults to OnDayStart).", + "type": "string", + "enum": [ "OnDayStart", "OnLocationChange" ] + }, "FromFile": { "title": "Source file", "description": "The relative file path in your content pack folder to load instead (like 'assets/dinosaur.png'). This can be a .json (data), .png (image), .tbin or .tmx (map), or .xnb file. This field supports tokens and capitalization doesn't matter.", @@ -327,9 +333,17 @@ } }, "then": { - "required": [ "FromFile" ], + "required": [ "FromFile", "Target" ], "propertyNames": { - "enum": [ "Action", "Target", "LogName", "Enabled", "When", "FromFile" ] + "enum": [ + "Action", + "Enabled", + "FromFile", + "LogName", + "Target", + "Update", + "When" + ] } } }, @@ -340,9 +354,21 @@ } }, "then": { - "required": [ "FromFile" ], + "required": [ "FromFile", "Target" ], "propertyNames": { - "enum": [ "Action", "Target", "LogName", "Enabled", "When", "FromFile", "FromArea", "ToArea", "PatchMode" ] + "enum": [ + "Action", + "Enabled", + "FromFile", + "LogName", + "Target", + "Update", + "When", + + "FromArea", + "PatchMode", + "ToArea" + ] } } }, @@ -354,7 +380,19 @@ }, "then": { "propertyNames": { - "enum": [ "Action", "Target", "LogName", "Enabled", "When", "FromFile", "Fields", "Entries", "MoveEntries" ] + "enum": [ + "Action", + "Enabled", + "FromFile", + "LogName", + "Target", + "Update", + "When", + + "Entries", + "Fields", + "MoveEntries" + ] } } }, @@ -377,16 +415,44 @@ } }, "propertyNames": { - "enum": [ "Action", "Target", "LogName", "Enabled", "When", "FromFile", "FromArea", "ToArea", "MapProperties", "MapTiles" ] + "enum": [ + "Action", + "Enabled", + "FromFile", + "LogName", + "Target", + "Update", + "When", + + "FromArea", + "MapProperties", + "MapTiles", + "ToArea" + ] + } + } + }, + { + "if": { + "properties": { + "Action": { "const": "Include" } + } + }, + "then": { + "required": [ "FromFile" ], + "propertyNames": { + "enum": [ + "Action", + "Enabled", + "FromFile", + "LogName", + "Update", + "When" + ] } } } - ], - - "required": [ "Action", "Target" ], - "@errorMessages": { - "allOf": "$transparent" - } + ] } }, "$schema": { |