add CurseForge to mod metadata (#605)

This commit is contained in:
Jesse Plamondon-Willard 2019-11-08 13:44:49 -05:00
parent 8b09a2776d
commit 0aac0717bf
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
7 changed files with 47 additions and 9 deletions

View File

@ -28,6 +28,12 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi
/// <summary>The mod ID in the Chucklefish mod repo.</summary> /// <summary>The mod ID in the Chucklefish mod repo.</summary>
public int? ChucklefishID { get; set; } public int? ChucklefishID { get; set; }
/// <summary>The mod ID in the CurseForge mod repo.</summary>
public int? CurseForgeID { get; set; }
/// <summary>The mod key in the CurseForge mod repo (used in mod page URLs).</summary>
public string CurseForgeKey { get; set; }
/// <summary>The mod ID in the ModDrop mod repo.</summary> /// <summary>The mod ID in the ModDrop mod repo.</summary>
public int? ModDropID { get; set; } public int? ModDropID { get; set; }
@ -87,6 +93,8 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi
this.Name = wiki.Name.FirstOrDefault(); this.Name = wiki.Name.FirstOrDefault();
this.NexusID = wiki.NexusID; this.NexusID = wiki.NexusID;
this.ChucklefishID = wiki.ChucklefishID; this.ChucklefishID = wiki.ChucklefishID;
this.CurseForgeID = wiki.CurseForgeID;
this.CurseForgeKey = wiki.CurseForgeKey;
this.ModDropID = wiki.ModDropID; this.ModDropID = wiki.ModDropID;
this.GitHubRepo = wiki.GitHubRepo; this.GitHubRepo = wiki.GitHubRepo;
this.CustomSourceUrl = wiki.CustomSourceUrl; this.CustomSourceUrl = wiki.CustomSourceUrl;

View File

@ -93,6 +93,8 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki
string[] warnings = this.GetAttributeAsCsv(node, "data-warnings"); string[] warnings = this.GetAttributeAsCsv(node, "data-warnings");
int? nexusID = this.GetAttributeAsNullableInt(node, "data-nexus-id"); int? nexusID = this.GetAttributeAsNullableInt(node, "data-nexus-id");
int? chucklefishID = this.GetAttributeAsNullableInt(node, "data-cf-id"); int? chucklefishID = this.GetAttributeAsNullableInt(node, "data-cf-id");
int? curseForgeID = this.GetAttributeAsNullableInt(node, "data-curseforge-id");
string curseForgeKey = this.GetAttribute(node, "data-curseforge-key");
int? modDropID = this.GetAttributeAsNullableInt(node, "data-moddrop-id"); int? modDropID = this.GetAttributeAsNullableInt(node, "data-moddrop-id");
string githubRepo = this.GetAttribute(node, "data-github"); string githubRepo = this.GetAttribute(node, "data-github");
string customSourceUrl = this.GetAttribute(node, "data-custom-source"); string customSourceUrl = this.GetAttribute(node, "data-custom-source");
@ -145,6 +147,8 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki
Author = authors, Author = authors,
NexusID = nexusID, NexusID = nexusID,
ChucklefishID = chucklefishID, ChucklefishID = chucklefishID,
CurseForgeID = curseForgeID,
CurseForgeKey = curseForgeKey,
ModDropID = modDropID, ModDropID = modDropID,
GitHubRepo = githubRepo, GitHubRepo = githubRepo,
CustomSourceUrl = customSourceUrl, CustomSourceUrl = customSourceUrl,

View File

@ -23,6 +23,12 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki
/// <summary>The mod ID in the Chucklefish mod repo.</summary> /// <summary>The mod ID in the Chucklefish mod repo.</summary>
public int? ChucklefishID { get; set; } public int? ChucklefishID { get; set; }
/// <summary>The mod ID in the CurseForge mod repo.</summary>
public int? CurseForgeID { get; set; }
/// <summary>The mod key in the CurseForge mod repo (used in mod page URLs).</summary>
public string CurseForgeKey { get; set; }
/// <summary>The mod ID in the ModDrop mod repo.</summary> /// <summary>The mod ID in the ModDrop mod repo.</summary>
public int? ModDropID { get; set; } public int? ModDropID { get; set; }

View File

@ -280,11 +280,13 @@ namespace StardewModdingAPI.Web.Controllers
if (entry != null) if (entry != null)
{ {
if (entry.NexusID.HasValue) if (entry.NexusID.HasValue)
yield return $"Nexus:{entry.NexusID}"; yield return $"{ModRepositoryKey.Nexus}:{entry.NexusID}";
if (entry.ChucklefishID.HasValue)
yield return $"Chucklefish:{entry.ChucklefishID}";
if (entry.ModDropID.HasValue) if (entry.ModDropID.HasValue)
yield return $"ModDrop:{entry.ModDropID}"; yield return $"{ModRepositoryKey.ModDrop}:{entry.ModDropID}";
if (entry.CurseForgeID.HasValue)
yield return $"{ModRepositoryKey.CurseForge}:{entry.CurseForgeID}";
if (entry.ChucklefishID.HasValue)
yield return $"{ModRepositoryKey.Chucklefish}:{entry.ChucklefishID}";
} }
} }

View File

@ -40,6 +40,12 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki
/// <summary>The mod ID in the Chucklefish mod repo.</summary> /// <summary>The mod ID in the Chucklefish mod repo.</summary>
public int? ChucklefishID { get; set; } public int? ChucklefishID { get; set; }
/// <summary>The mod ID in the CurseForge mod repo.</summary>
public int? CurseForgeID { get; set; }
/// <summary>The mod key in the CurseForge mod repo (used in mod page URLs).</summary>
public string CurseForgeKey { get; set; }
/// <summary>The mod ID in the ModDrop mod repo.</summary> /// <summary>The mod ID in the ModDrop mod repo.</summary>
public int? ModDropID { get; set; } public int? ModDropID { get; set; }
@ -123,6 +129,8 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki
this.Author = mod.Author; this.Author = mod.Author;
this.NexusID = mod.NexusID; this.NexusID = mod.NexusID;
this.ChucklefishID = mod.ChucklefishID; this.ChucklefishID = mod.ChucklefishID;
this.CurseForgeID = mod.CurseForgeID;
this.CurseForgeKey = mod.CurseForgeKey;
this.ModDropID = mod.ModDropID; this.ModDropID = mod.ModDropID;
this.GitHubRepo = mod.GitHubRepo; this.GitHubRepo = mod.GitHubRepo;
this.CustomSourceUrl = mod.CustomSourceUrl; this.CustomSourceUrl = mod.CustomSourceUrl;
@ -158,6 +166,8 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki
Author = this.Author, Author = this.Author,
NexusID = this.NexusID, NexusID = this.NexusID,
ChucklefishID = this.ChucklefishID, ChucklefishID = this.ChucklefishID,
CurseForgeID = this.CurseForgeID,
CurseForgeKey = this.CurseForgeKey,
ModDropID = this.ModDropID, ModDropID = this.ModDropID,
GitHubRepo = this.GitHubRepo, GitHubRepo = this.GitHubRepo,
CustomSourceUrl = this.CustomSourceUrl, CustomSourceUrl = this.CustomSourceUrl,

View File

@ -100,16 +100,21 @@ namespace StardewModdingAPI.Web.ViewModels
anyFound = true; anyFound = true;
yield return new ModLinkModel($"https://www.nexusmods.com/stardewvalley/mods/{entry.NexusID}", "Nexus"); yield return new ModLinkModel($"https://www.nexusmods.com/stardewvalley/mods/{entry.NexusID}", "Nexus");
} }
if (entry.ChucklefishID.HasValue)
{
anyFound = true;
yield return new ModLinkModel($"https://community.playstarbound.com/resources/{entry.ChucklefishID}", "Chucklefish");
}
if (entry.ModDropID.HasValue) if (entry.ModDropID.HasValue)
{ {
anyFound = true; anyFound = true;
yield return new ModLinkModel($"https://www.moddrop.com/sdv/mod/{entry.ModDropID}", "ModDrop"); yield return new ModLinkModel($"https://www.moddrop.com/sdv/mod/{entry.ModDropID}", "ModDrop");
} }
if (!string.IsNullOrWhiteSpace(entry.CurseForgeKey))
{
anyFound = true;
yield return new ModLinkModel($"https://www.curseforge.com/stardewvalley/mods/{entry.CurseForgeKey}", "CurseForge");
}
if (entry.ChucklefishID.HasValue)
{
anyFound = true;
yield return new ModLinkModel($"https://community.playstarbound.com/resources/{entry.ChucklefishID}", "Chucklefish");
}
// fallback // fallback
if (!anyFound && !string.IsNullOrWhiteSpace(entry.CustomUrl)) if (!anyFound && !string.IsNullOrWhiteSpace(entry.CustomUrl))

View File

@ -44,6 +44,7 @@ smapi.modList = function (mods, enableBeta) {
download: { download: {
value: { value: {
chucklefish: { value: true, label: "Chucklefish" }, chucklefish: { value: true, label: "Chucklefish" },
curseforge: { value: true, label: "CurseForge" },
moddrop: { value: true, label: "ModDrop" }, moddrop: { value: true, label: "ModDrop" },
nexus: { value: true, label: "Nexus" }, nexus: { value: true, label: "Nexus" },
custom: { value: true } custom: { value: true }
@ -180,6 +181,8 @@ smapi.modList = function (mods, enableBeta) {
if (!filters.download.value.chucklefish.value) if (!filters.download.value.chucklefish.value)
ignoreSites.push("Chucklefish"); ignoreSites.push("Chucklefish");
if (!filters.download.value.curseforge.value)
ignoreSites.push("CurseForge");
if (!filters.download.value.moddrop.value) if (!filters.download.value.moddrop.value)
ignoreSites.push("ModDrop"); ignoreSites.push("ModDrop");
if (!filters.download.value.nexus.value) if (!filters.download.value.nexus.value)