From dcb3a97727401c2b3704e277bc4062b3bd89448e Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 8 Jul 2022 17:44:27 -0400 Subject: add log parser warning for PyTK compatibility mode --- src/SMAPI.Web/Views/LogParser/Index.cshtml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/SMAPI.Web/Views') diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml index b824b768..57e26ace 100644 --- a/src/SMAPI.Web/Views/LogParser/Index.cshtml +++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml @@ -17,6 +17,7 @@ LogModInfo[] outdatedMods = log?.Mods.Where(mod => mod.HasUpdate).ToArray() ?? Array.Empty(); LogModInfo? errorHandler = log?.Mods.FirstOrDefault(p => p.IsCodeMod && p.Name == "Error Handler"); bool hasOlderErrorHandler = errorHandler?.GetParsedVersion() is not null && log?.ApiVersionParsed is not null && log.ApiVersionParsed.IsNewerThan(errorHandler.GetParsedVersion()); + bool isPyTkCompatibilityMode = log?.ApiVersionParsed?.IsOlderThan("3.15.0") is false && log.Mods.Any(p => p.IsCodeMod && p.Name == "PyTK" && p.GetParsedVersion()?.IsOlderThan("1.23.1") is true); // get filters IDictionary defaultFilters = Enum @@ -242,7 +243,7 @@ else if (log?.IsValid == true) @if (log?.IsValid == true) {
- @if (outdatedMods.Any() || errorHandler is null || hasOlderErrorHandler) + @if (outdatedMods.Any() || errorHandler is null || hasOlderErrorHandler || isPyTkCompatibilityMode) {

Suggested fixes

    @@ -254,6 +255,10 @@ else if (log?.IsValid == true) {
  • Your Error Handler mod is older than SMAPI. You may be missing some game/mod error fixes. You can reinstall SMAPI to update it.
  • } + @if (isPyTkCompatibilityMode) + { +
  • PyTK 1.23.0 or earlier isn't compatible with newer SMAPI performance optimizations. This may increase loading times or in-game lag.
  • + } @if (outdatedMods.Any()) {
  • -- cgit From 8eeda8b4c496f73d2101c59f5b443bb6c2a2a06b Mon Sep 17 00:00:00 2001 From: Ishan Jalan Date: Fri, 8 Jul 2022 12:28:53 +0530 Subject: SVGs for pufferchick and pufferchick-cool SVG > PNG --- .gitignore | 4 ++++ src/SMAPI.Web/Views/Index/Index.cshtml | 2 +- src/SMAPI.Web/wwwroot/Content/images/pufferchick-cool.svg | 1 + src/SMAPI.Web/wwwroot/Content/images/pufferchick.svg | 1 + src/SMAPI.Web/wwwroot/Content/js/index.js | 4 ++-- 5 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 src/SMAPI.Web/wwwroot/Content/images/pufferchick-cool.svg create mode 100644 src/SMAPI.Web/wwwroot/Content/images/pufferchick.svg (limited to 'src/SMAPI.Web/Views') diff --git a/.gitignore b/.gitignore index 527ac6bb..e4cc7c26 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,7 @@ appsettings.Development.json # Azure generated files src/SMAPI.Web/Properties/PublishProfiles/*.pubxml src/SMAPI.Web/Properties/ServiceDependencies/* - Web Deploy/ +src/SMAPI.Web/.DS_Store +src/SMAPI.Web/wwwroot/Content/images/.DS_Store +src/SMAPI.Web/wwwroot/Content/.DS_Store +src/SMAPI.Web/wwwroot/.DS_Store diff --git a/src/SMAPI.Web/Views/Index/Index.cshtml b/src/SMAPI.Web/Views/Index/Index.cshtml index acb8df78..308ed1e5 100644 --- a/src/SMAPI.Web/Views/Index/Index.cshtml +++ b/src/SMAPI.Web/Views/Index/Index.cshtml @@ -15,7 +15,7 @@

    SMAPI - +

    The mod loader for Stardew Valley.

    diff --git a/src/SMAPI.Web/wwwroot/Content/images/pufferchick-cool.svg b/src/SMAPI.Web/wwwroot/Content/images/pufferchick-cool.svg new file mode 100644 index 00000000..0b4c3ad1 --- /dev/null +++ b/src/SMAPI.Web/wwwroot/Content/images/pufferchick-cool.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/SMAPI.Web/wwwroot/Content/images/pufferchick.svg b/src/SMAPI.Web/wwwroot/Content/images/pufferchick.svg new file mode 100644 index 00000000..5e77e493 --- /dev/null +++ b/src/SMAPI.Web/wwwroot/Content/images/pufferchick.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/SMAPI.Web/wwwroot/Content/js/index.js b/src/SMAPI.Web/wwwroot/Content/js/index.js index d0734b02..04db5c2f 100644 --- a/src/SMAPI.Web/wwwroot/Content/js/index.js +++ b/src/SMAPI.Web/wwwroot/Content/js/index.js @@ -3,10 +3,10 @@ $(document).ready(function () { var pufferchick = $("#pufferchick"); $(".cta-dropdown").hover( function () { - pufferchick.attr("src", "Content/images/pufferchick-cool.png"); + pufferchick.attr("src", "Content/images/pufferchick-cool.svg"); }, function () { - pufferchick.attr("src", "Content/images/pufferchick.png"); + pufferchick.attr("src", "Content/images/pufferchick.svg"); } ); -- cgit From 477ecbab6ee4f011c68736c821cbe1476b384d29 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 8 Jul 2022 19:36:32 -0400 Subject: bypass browser cache & delete unused images --- src/SMAPI.Web/Views/Index/Index.cshtml | 2 +- .../wwwroot/Content/images/pufferchick-cool.png | Bin 1099 -> 0 bytes src/SMAPI.Web/wwwroot/Content/images/pufferchick.png | Bin 831 -> 0 bytes 3 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 src/SMAPI.Web/wwwroot/Content/images/pufferchick-cool.png delete mode 100644 src/SMAPI.Web/wwwroot/Content/images/pufferchick.png (limited to 'src/SMAPI.Web/Views') diff --git a/src/SMAPI.Web/Views/Index/Index.cshtml b/src/SMAPI.Web/Views/Index/Index.cshtml index 308ed1e5..d6472fcb 100644 --- a/src/SMAPI.Web/Views/Index/Index.cshtml +++ b/src/SMAPI.Web/Views/Index/Index.cshtml @@ -10,7 +10,7 @@ @section Head { - + }

    diff --git a/src/SMAPI.Web/wwwroot/Content/images/pufferchick-cool.png b/src/SMAPI.Web/wwwroot/Content/images/pufferchick-cool.png deleted file mode 100644 index f359146c..00000000 Binary files a/src/SMAPI.Web/wwwroot/Content/images/pufferchick-cool.png and /dev/null differ diff --git a/src/SMAPI.Web/wwwroot/Content/images/pufferchick.png b/src/SMAPI.Web/wwwroot/Content/images/pufferchick.png deleted file mode 100644 index 1de9cf47..00000000 Binary files a/src/SMAPI.Web/wwwroot/Content/images/pufferchick.png and /dev/null differ -- cgit From d813c4e2c8522584beaf1432725b4cdd2cc251b5 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 8 Aug 2022 22:27:07 -0400 Subject: fix log parsing for invalid content packs (#860) --- docs/release-notes.md | 1 + src/SMAPI.Web/Framework/LogParsing/LogParser.cs | 10 ++++---- .../Framework/LogParsing/Models/LogModInfo.cs | 22 ++++++++---------- .../Framework/LogParsing/Models/ModType.cs | 15 ++++++++++++ src/SMAPI.Web/ViewModels/LogParserModel.cs | 2 +- src/SMAPI.Web/Views/LogParser/Index.cshtml | 27 +++++++++++++++++----- 6 files changed, 52 insertions(+), 25 deletions(-) create mode 100644 src/SMAPI.Web/Framework/LogParsing/Models/ModType.cs (limited to 'src/SMAPI.Web/Views') diff --git a/docs/release-notes.md b/docs/release-notes.md index 14421c1a..46d910a9 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -29,6 +29,7 @@ * Added log parser warning about performance of PyTK 1.23.0 or earlier. * Converted images to SVG (thanks to ishan!). * Updated log parser for new update alert format in SMAPI 3.15.1. + * Fixed parsing for invalid content packs. ## 3.15.1 Released 06 July 2022 for Stardew Valley 1.5.6 or later. diff --git a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs index 4a110dcd..18ba754c 100644 --- a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs +++ b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs @@ -36,7 +36,7 @@ namespace StardewModdingAPI.Web.Framework.LogParsing private readonly Regex ContentPackListStartPattern = new(@"^Loaded \d+ content packs:$", RegexOptions.Compiled | RegexOptions.IgnoreCase); /// A regex pattern matching an entry in SMAPI's content pack list. - private readonly Regex ContentPackListEntryPattern = new(@"^ (?.+?) (?[^\s]+)(?: by (?[^\|]+))? \| for (?[^\|]+)(?: \| (?.+))?$", RegexOptions.Compiled | RegexOptions.IgnoreCase); + private readonly Regex ContentPackListEntryPattern = new(@"^ (?.+?) (?[^\s]+)(?: by (?[^\|]+))? \| for (?[^\|]*)(?: \| (?.+))?$", RegexOptions.Compiled | RegexOptions.IgnoreCase); /// A regex pattern matching the start of SMAPI's mod update list. private readonly Regex ModUpdateListStartPattern = new(@"^You can update \d+ mods?:$", RegexOptions.Compiled | RegexOptions.IgnoreCase); @@ -77,8 +77,8 @@ namespace StardewModdingAPI.Web.Framework.LogParsing }; // parse log messages - LogModInfo smapiMod = new(name: "SMAPI", author: "Pathoschild", version: "", description: "", loaded: true, isMod: false); - LogModInfo gameMod = new(name: "game", author: "", version: "", description: "", loaded: true, isMod: false); + LogModInfo smapiMod = new(ModType.Special, name: "SMAPI", author: "Pathoschild", version: "", description: "", loaded: true); + LogModInfo gameMod = new(ModType.Special, name: "game", author: "", version: "", description: "", loaded: true); IDictionary> mods = new Dictionary>(); bool inModList = false; bool inContentPackList = false; @@ -133,7 +133,7 @@ namespace StardewModdingAPI.Web.Framework.LogParsing if (!mods.TryGetValue(name, out List? entries)) mods[name] = entries = new List(); - entries.Add(new LogModInfo(name: name, author: author, version: version, description: description, loaded: true)); + entries.Add(new LogModInfo(ModType.CodeMod, name: name, author: author, version: version, description: description, loaded: true)); message.Section = LogSection.ModsList; } @@ -156,7 +156,7 @@ namespace StardewModdingAPI.Web.Framework.LogParsing if (!mods.TryGetValue(name, out List? entries)) mods[name] = entries = new List(); - entries.Add(new LogModInfo(name: name, author: author, version: version, description: description, contentPackFor: forMod, loaded: true)); + entries.Add(new LogModInfo(ModType.ContentPack, name: name, author: author, version: version, description: description, contentPackFor: forMod, loaded: true)); message.Section = LogSection.ContentPackList; } diff --git a/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs b/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs index 557f08ff..c81942e4 100644 --- a/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs +++ b/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs @@ -48,21 +48,24 @@ namespace StardewModdingAPI.Web.Framework.LogParsing.Models [MemberNotNullWhen(true, nameof(LogModInfo.UpdateVersion), nameof(LogModInfo.UpdateLink))] public bool HasUpdate => this.UpdateVersion != null && this.Version != this.UpdateVersion; + /// The mod type. + public ModType ModType { get; } + /// Whether this is an actual mod (rather than a special entry for SMAPI or the game itself). - public bool IsMod { get; } + public bool IsMod => this.ModType != ModType.Special; /// Whether this is a C# code mod. - public bool IsCodeMod { get; } + public bool IsCodeMod => this.ModType == ModType.CodeMod; /// Whether this is a content pack for another mod. - [MemberNotNullWhen(true, nameof(LogModInfo.ContentPackFor))] - public bool IsContentPack { get; } + public bool IsContentPack => this.ModType == ModType.ContentPack; /********* ** Public methods *********/ /// Construct an instance. + /// The mod type. /// The mod name. /// The mod author. /// The mod version. @@ -72,9 +75,9 @@ namespace StardewModdingAPI.Web.Framework.LogParsing.Models /// The name of the mod for which this is a content pack (if applicable). /// The number of errors logged by this mod. /// Whether the mod was loaded into the game. - /// Whether this is an actual mod (instead of a special entry for SMAPI or the game). - public LogModInfo(string name, string author, string version, string description, string? updateVersion = null, string? updateLink = null, string? contentPackFor = null, int errors = 0, bool loaded = true, bool isMod = true) + public LogModInfo(ModType modType, string name, string author, string version, string description, string? updateVersion = null, string? updateLink = null, string? contentPackFor = null, int errors = 0, bool loaded = true) { + this.ModType = modType; this.Name = name; this.Author = author; this.Description = description; @@ -84,13 +87,6 @@ namespace StardewModdingAPI.Web.Framework.LogParsing.Models this.Errors = errors; this.Loaded = loaded; - if (isMod) - { - this.IsMod = true; - this.IsContentPack = !string.IsNullOrWhiteSpace(this.ContentPackFor); - this.IsCodeMod = !this.IsContentPack; - } - this.OverrideVersion(version); } diff --git a/src/SMAPI.Web/Framework/LogParsing/Models/ModType.cs b/src/SMAPI.Web/Framework/LogParsing/Models/ModType.cs new file mode 100644 index 00000000..363aaaec --- /dev/null +++ b/src/SMAPI.Web/Framework/LogParsing/Models/ModType.cs @@ -0,0 +1,15 @@ +namespace StardewModdingAPI.Web.Framework.LogParsing.Models +{ + /// The type for a instance. + public enum ModType + { + /// A special non-mod entry (e.g. for SMAPI or the game itself). + Special, + + /// A C# mod. + CodeMod, + + /// A content pack loaded by a C# mod. + ContentPack + } +} diff --git a/src/SMAPI.Web/ViewModels/LogParserModel.cs b/src/SMAPI.Web/ViewModels/LogParserModel.cs index c39a9b0a..34d0b4df 100644 --- a/src/SMAPI.Web/ViewModels/LogParserModel.cs +++ b/src/SMAPI.Web/ViewModels/LogParserModel.cs @@ -107,7 +107,7 @@ namespace StardewModdingAPI.Web.ViewModels // group by mod return mods .Where(mod => mod.IsContentPack) - .GroupBy(mod => mod.ContentPackFor!) + .GroupBy(mod => mod.ContentPackFor ?? "") .ToDictionary(group => group.Key, group => group.ToArray()); } diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml index 57e26ace..f71c6ac1 100644 --- a/src/SMAPI.Web/Views/LogParser/Index.cshtml +++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml @@ -352,16 +352,31 @@ else if (log?.IsValid == true) toggle content packs in list } - @foreach (var mod in log.Mods.Where(p => p.Loaded && !p.IsContentPack)) - { - if (contentPacks == null || !contentPacks.TryGetValue(mod.Name, out LogModInfo[]? contentPackList)) - contentPackList = null; + @{ + var modsWithContentPacks = log.Mods + .Where(mod => mod.Loaded && !mod.IsContentPack) + .Select(mod => ( + Mod: mod, + ContentPacks: contentPacks?.TryGetValue(mod.Name, out LogModInfo[]? contentPackList) == true ? contentPackList : Array.Empty() + )) + .ToList(); + if (contentPacks?.TryGetValue("", out LogModInfo[] invalidPacks) == true) + { + modsWithContentPacks.Add(( + Mod: new LogModInfo(ModType.CodeMod, "", "", "", ""), + ContentPacks: invalidPacks + )); + } + } + + @foreach ((LogModInfo mod, LogModInfo[] contentPackList) in modsWithContentPacks) + { @mod.Name @mod.Version - @if (contentPackList != null) + @if (contentPackList.Any()) {
    @foreach (var contentPack in contentPackList) @@ -374,7 +389,7 @@ else if (log?.IsValid == true) @mod.Author - @if (contentPackList != null) + @if (contentPackList.Any()) {
    @foreach (var contentPack in contentPackList) -- cgit