summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Framework/Clients
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-07-24 21:28:33 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-09-14 18:59:05 -0400
commit08d83aa039dd57efcc6ab50595fe5c0ea1003527 (patch)
tree56c6a4b10da5585295011893bc44bedff671ad3a /src/SMAPI.Web/Framework/Clients
parentedc00ddaab46a2a2d0ba07591a6206159421ef41 (diff)
downloadSMAPI-08d83aa039dd57efcc6ab50595fe5c0ea1003527.tar.gz
SMAPI-08d83aa039dd57efcc6ab50595fe5c0ea1003527.tar.bz2
SMAPI-08d83aa039dd57efcc6ab50595fe5c0ea1003527.zip
treat hidden/unpublished Nexus mods as not found (#651)
Diffstat (limited to 'src/SMAPI.Web/Framework/Clients')
-rw-r--r--src/SMAPI.Web/Framework/Clients/Nexus/NexusMod.cs4
-rw-r--r--src/SMAPI.Web/Framework/Clients/Nexus/NexusModStatus.cs18
-rw-r--r--src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs8
3 files changed, 29 insertions, 1 deletions
diff --git a/src/SMAPI.Web/Framework/Clients/Nexus/NexusMod.cs b/src/SMAPI.Web/Framework/Clients/Nexus/NexusMod.cs
index f4909155..0f1b29d5 100644
--- a/src/SMAPI.Web/Framework/Clients/Nexus/NexusMod.cs
+++ b/src/SMAPI.Web/Framework/Clients/Nexus/NexusMod.cs
@@ -21,6 +21,10 @@ namespace StardewModdingAPI.Web.Framework.Clients.Nexus
[JsonProperty("mod_page_uri")]
public string Url { get; set; }
+ /// <summary>The mod's publication status.</summary>
+ [JsonIgnore]
+ public NexusModStatus Status { get; set; } = NexusModStatus.Ok;
+
/// <summary>A user-friendly error which indicates why fetching the mod info failed (if applicable).</summary>
[JsonIgnore]
public string Error { get; set; }
diff --git a/src/SMAPI.Web/Framework/Clients/Nexus/NexusModStatus.cs b/src/SMAPI.Web/Framework/Clients/Nexus/NexusModStatus.cs
new file mode 100644
index 00000000..c5723093
--- /dev/null
+++ b/src/SMAPI.Web/Framework/Clients/Nexus/NexusModStatus.cs
@@ -0,0 +1,18 @@
+namespace StardewModdingAPI.Web.Framework.Clients.Nexus
+{
+ /// <summary>The status of a Nexus mod.</summary>
+ internal enum NexusModStatus
+ {
+ /// <summary>The mod is published and valid.</summary>
+ Ok,
+
+ /// <summary>The mod is hidden by the author.</summary>
+ Hidden,
+
+ /// <summary>The mod hasn't been published yet.</summary>
+ NotPublished,
+
+ /// <summary>The Nexus API returned an unhandled error.</summary>
+ Other
+ }
+}
diff --git a/src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs b/src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs
index e83a6041..061de5de 100644
--- a/src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs
+++ b/src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs
@@ -74,8 +74,14 @@ namespace StardewModdingAPI.Web.Framework.Clients.Nexus
case "not found":
return null;
+ case "hidden mod":
+ return new NexusMod { Error = $"Nexus error: {errorCode} ({errorText}).", Status = NexusModStatus.Hidden };
+
+ case "not published":
+ return new NexusMod { Error = $"Nexus error: {errorCode} ({errorText}).", Status = NexusModStatus.NotPublished };
+
default:
- return new NexusMod { Error = $"Nexus error: {errorCode} ({errorText})." };
+ return new NexusMod { Error = $"Nexus error: {errorCode} ({errorText}).", Status = NexusModStatus.Other };
}
}