From a40ef854f3769a0e5d3c2629de538e272a6fcecf Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 13 Sep 2021 18:20:36 -0400 Subject: fix JSON validator line numbers sometimes incorrect --- .../Controllers/JsonValidatorController.cs | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/SMAPI.Web') diff --git a/src/SMAPI.Web/Controllers/JsonValidatorController.cs b/src/SMAPI.Web/Controllers/JsonValidatorController.cs index c77a3036..e06c1236 100644 --- a/src/SMAPI.Web/Controllers/JsonValidatorController.cs +++ b/src/SMAPI.Web/Controllers/JsonValidatorController.cs @@ -90,21 +90,27 @@ namespace StardewModdingAPI.Web.Controllers // parse JSON JToken parsed; - try { - parsed = JToken.Parse(file.Content, new JsonLoadSettings + // load raw JSON + var settings = new JsonLoadSettings { DuplicatePropertyNameHandling = DuplicatePropertyNameHandling.Error, CommentHandling = CommentHandling.Load - }); - } - catch (JsonReaderException ex) - { - return this.View("Index", result.AddErrors(new JsonValidatorErrorModel(ex.LineNumber, ex.Path, ex.Message, ErrorType.None))); - } + }; + try + { + parsed = JToken.Parse(file.Content, settings); + } + catch (JsonReaderException ex) + { + return this.View("Index", result.AddErrors(new JsonValidatorErrorModel(ex.LineNumber, ex.Path, ex.Message, ErrorType.None))); + } - // format JSON - result.SetContent(parsed.ToString(Formatting.Indented), expiry: file.Expiry, uploadWarning: file.Warning); + // format JSON + string formatted = parsed.ToString(Formatting.Indented); + result.SetContent(formatted, expiry: file.Expiry, uploadWarning: file.Warning); + parsed = JToken.Parse(formatted); // update line number references + } // skip if no schema selected if (schemaName == "none") -- cgit From f6f4470d955c75531d40a9dc3a353d261c715d4a Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 13 Sep 2021 18:30:59 -0400 Subject: enable beta info on the mod compatibility list by default --- docs/release-notes.md | 1 + src/SMAPI.Web/Views/Mods/Index.cshtml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/SMAPI.Web') diff --git a/docs/release-notes.md b/docs/release-notes.md index ddd0526b..c706619c 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -9,6 +9,7 @@ * Improved SMAPI's crossplatform read/writing of `Color`, `Point`, `Rectangle`, and `Vector2` in JSON to support nullable fields too. * For the web UI: + * The mod compatibility list now shows the beta status by default (if any). * Fixed JSON validator line numbers sometimes incorrect. ## 3.12.6 diff --git a/src/SMAPI.Web/Views/Mods/Index.cshtml b/src/SMAPI.Web/Views/Mods/Index.cshtml index 7dcd0718..5df49afb 100644 --- a/src/SMAPI.Web/Views/Mods/Index.cshtml +++ b/src/SMAPI.Web/Views/Mods/Index.cshtml @@ -45,7 +45,7 @@ else @if (hasBeta) { -

Note: "@betaLabel" lines are for an unreleased version of SMAPI, not the stable version most players have. If a mod doesn't have that line, the info applies to both versions of SMAPI.

+

Note: "@betaLabel" lines are for the beta version of Stardew Valley, not the stable version most players have. If a mod doesn't have that line, the info applies to both versions.

} @@ -99,7 +99,7 @@ else
-
+
@betaLabel:
-- cgit