From 609ceedaba6cd42e7025f1a15ebfeb26c69bab80 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 11 Jan 2020 16:53:58 -0500 Subject: update for compatibility list change --- src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs | 12 ++---------- src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs | 4 ++-- src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs | 8 ++++---- src/SMAPI.Web/ViewModels/ModModel.cs | 7 +++---- src/SMAPI.Web/Views/Mods/Index.cshtml | 7 ++----- 5 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs index 384f23fc..c829c0f4 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs @@ -102,6 +102,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki string anchor = this.GetAttribute(node, "id"); string contentPackFor = this.GetAttribute(node, "data-content-pack-for"); string devNote = this.GetAttribute(node, "data-dev-note"); + string pullRequestUrl = this.GetAttribute(node, "data-pr"); IDictionary mapLocalVersions = this.GetAttributeAsVersionMapping(node, "data-map-local-versions"); IDictionary mapRemoteVersions = this.GetAttributeAsVersionMapping(node, "data-map-remote-versions"); @@ -132,15 +133,6 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki } } - // parse links - List> metadataLinks = new List>(); - foreach (HtmlNode linkElement in node.Descendants("td").Last().Descendants("a").Skip(1)) // skip anchor link - { - string text = linkElement.InnerText.Trim(); - Uri url = new Uri(linkElement.GetAttributeValue("href", "")); - metadataLinks.Add(Tuple.Create(url, text)); - } - // yield model yield return new WikiModEntry { @@ -159,7 +151,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki Compatibility = compatibility, BetaCompatibility = betaCompatibility, Warnings = warnings, - MetadataLinks = metadataLinks.ToArray(), + PullRequestUrl = pullRequestUrl, DevNote = devNote, MapLocalVersions = mapLocalVersions, MapRemoteVersions = mapRemoteVersions, diff --git a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs index 931dcd43..474dce3d 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs @@ -57,8 +57,8 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki /// The human-readable warnings for players about this mod. public string[] Warnings { get; set; } - /// Extra metadata links (usually for open pull requests). - public Tuple[] MetadataLinks { get; set; } + /// The URL of the pull request which submits changes for an unofficial update to the author, if any. + public string PullRequestUrl { get; set; } /// Special notes intended for developers who maintain unofficial updates or submit pull requests. public string DevNote { get; set; } diff --git a/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs b/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs index 8569984a..7e7c99bc 100644 --- a/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs +++ b/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs @@ -67,8 +67,8 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki /// The human-readable warnings for players about this mod. public string[] Warnings { get; set; } - /// Extra metadata links (usually for open pull requests). - public Tuple[] MetadataLinks { get; set; } + /// The URL of the pull request which submits changes for an unofficial update to the author, if any. + public string PullRequestUrl { get; set; } /// Special notes intended for developers who maintain unofficial updates or submit pull requests. public string DevNote { get; set; } @@ -150,7 +150,7 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki this.CustomSourceUrl = mod.CustomSourceUrl; this.CustomUrl = mod.CustomUrl; this.ContentPackFor = mod.ContentPackFor; - this.MetadataLinks = mod.MetadataLinks; + this.PullRequestUrl = mod.PullRequestUrl; this.Warnings = mod.Warnings; this.DevNote = mod.DevNote; this.Anchor = mod.Anchor; @@ -192,7 +192,7 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki CustomUrl = this.CustomUrl, ContentPackFor = this.ContentPackFor, Warnings = this.Warnings, - MetadataLinks = this.MetadataLinks, + PullRequestUrl = this.PullRequestUrl, DevNote = this.DevNote, Anchor = this.Anchor, diff --git a/src/SMAPI.Web/ViewModels/ModModel.cs b/src/SMAPI.Web/ViewModels/ModModel.cs index 2b478c81..56316ab7 100644 --- a/src/SMAPI.Web/ViewModels/ModModel.cs +++ b/src/SMAPI.Web/ViewModels/ModModel.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Linq; using StardewModdingAPI.Toolkit.Framework.Clients.Wiki; @@ -38,8 +37,8 @@ namespace StardewModdingAPI.Web.ViewModels /// The human-readable warnings for players about this mod. public string[] Warnings { get; set; } - /// Extra metadata links (usually for open pull requests). - public Tuple[] MetadataLinks { get; set; } + /// The URL of the pull request which submits changes for an unofficial update to the author, if any. + public string PullRequestUrl { get; set; } /// Special notes intended for developers who maintain unofficial updates or submit pull requests. public string DevNote { get; set; } @@ -68,7 +67,7 @@ namespace StardewModdingAPI.Web.ViewModels this.BetaCompatibility = entry.BetaCompatibility != null ? new ModCompatibilityModel(entry.BetaCompatibility) : null; this.ModPages = this.GetModPageUrls(entry).ToArray(); this.Warnings = entry.Warnings; - this.MetadataLinks = entry.MetadataLinks; + this.PullRequestUrl = entry.PullRequestUrl; this.DevNote = entry.DevNote; this.Slug = entry.Anchor; } diff --git a/src/SMAPI.Web/Views/Mods/Index.cshtml b/src/SMAPI.Web/Views/Mods/Index.cshtml index 50b59b45..5b310d55 100644 --- a/src/SMAPI.Web/Views/Mods/Index.cshtml +++ b/src/SMAPI.Web/Views/Mods/Index.cshtml @@ -110,11 +110,8 @@ else # - - - [dev note] + PR + [dev note] -- cgit