update mod compatibility page URLs
This commit is contained in:
parent
a4a1777ca4
commit
724d3fccb1
|
@ -47,8 +47,8 @@ namespace StardewModdingAPI.Web.Controllers
|
||||||
/// <summary>The internal mod metadata list.</summary>
|
/// <summary>The internal mod metadata list.</summary>
|
||||||
private readonly ModDatabase ModDatabase;
|
private readonly ModDatabase ModDatabase;
|
||||||
|
|
||||||
/// <summary>The web URL for the wiki compatibility list.</summary>
|
/// <summary>The web URL for the compatibility list.</summary>
|
||||||
private readonly string WikiCompatibilityPageUrl;
|
private readonly string CompatibilityPageUrl;
|
||||||
|
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
|
@ -65,7 +65,7 @@ namespace StardewModdingAPI.Web.Controllers
|
||||||
{
|
{
|
||||||
this.ModDatabase = new ModToolkit().GetModDatabase(Path.Combine(environment.WebRootPath, "StardewModdingAPI.metadata.json"));
|
this.ModDatabase = new ModToolkit().GetModDatabase(Path.Combine(environment.WebRootPath, "StardewModdingAPI.metadata.json"));
|
||||||
ModUpdateCheckConfig config = configProvider.Value;
|
ModUpdateCheckConfig config = configProvider.Value;
|
||||||
this.WikiCompatibilityPageUrl = config.WikiCompatibilityPageUrl;
|
this.CompatibilityPageUrl = config.CompatibilityPageUrl;
|
||||||
|
|
||||||
this.Cache = cache;
|
this.Cache = cache;
|
||||||
this.SuccessCacheMinutes = config.SuccessCacheMinutes;
|
this.SuccessCacheMinutes = config.SuccessCacheMinutes;
|
||||||
|
@ -163,7 +163,7 @@ namespace StardewModdingAPI.Web.Controllers
|
||||||
|
|
||||||
// get unofficial version
|
// get unofficial version
|
||||||
if (wikiEntry?.Compatibility.UnofficialVersion != null && this.IsNewer(wikiEntry.Compatibility.UnofficialVersion, result.Main?.Version) && this.IsNewer(wikiEntry.Compatibility.UnofficialVersion, result.Optional?.Version))
|
if (wikiEntry?.Compatibility.UnofficialVersion != null && this.IsNewer(wikiEntry.Compatibility.UnofficialVersion, result.Main?.Version) && this.IsNewer(wikiEntry.Compatibility.UnofficialVersion, result.Optional?.Version))
|
||||||
result.Unofficial = new ModEntryVersionModel(wikiEntry.Compatibility.UnofficialVersion, this.WikiCompatibilityPageUrl);
|
result.Unofficial = new ModEntryVersionModel(wikiEntry.Compatibility.UnofficialVersion, $"{this.CompatibilityPageUrl}/#{wikiEntry.Anchor}");
|
||||||
|
|
||||||
// get unofficial version for beta
|
// get unofficial version for beta
|
||||||
if (wikiEntry?.HasBetaInfo == true)
|
if (wikiEntry?.HasBetaInfo == true)
|
||||||
|
@ -174,7 +174,7 @@ namespace StardewModdingAPI.Web.Controllers
|
||||||
if (wikiEntry.BetaCompatibility.UnofficialVersion != null)
|
if (wikiEntry.BetaCompatibility.UnofficialVersion != null)
|
||||||
{
|
{
|
||||||
result.UnofficialForBeta = (wikiEntry.BetaCompatibility.UnofficialVersion != null && this.IsNewer(wikiEntry.BetaCompatibility.UnofficialVersion, result.Main?.Version) && this.IsNewer(wikiEntry.BetaCompatibility.UnofficialVersion, result.Optional?.Version))
|
result.UnofficialForBeta = (wikiEntry.BetaCompatibility.UnofficialVersion != null && this.IsNewer(wikiEntry.BetaCompatibility.UnofficialVersion, result.Main?.Version) && this.IsNewer(wikiEntry.BetaCompatibility.UnofficialVersion, result.Optional?.Version))
|
||||||
? new ModEntryVersionModel(wikiEntry.BetaCompatibility.UnofficialVersion, this.WikiCompatibilityPageUrl)
|
? new ModEntryVersionModel(wikiEntry.BetaCompatibility.UnofficialVersion, $"{this.CompatibilityPageUrl}/#{wikiEntry.Anchor}")
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -17,6 +17,6 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels
|
||||||
public string SemanticVersionRegex { get; set; }
|
public string SemanticVersionRegex { get; set; }
|
||||||
|
|
||||||
/// <summary>The web URL for the wiki compatibility list.</summary>
|
/// <summary>The web URL for the wiki compatibility list.</summary>
|
||||||
public string WikiCompatibilityPageUrl { get; set; }
|
public string CompatibilityPageUrl { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ namespace StardewModdingAPI.Web
|
||||||
|
|
||||||
// shortcut redirects
|
// shortcut redirects
|
||||||
redirects.Add(new RedirectToUrlRule(@"^/buildmsg(?:/?(.*))$", "https://github.com/Pathoschild/SMAPI/blob/develop/docs/mod-build-config.md#$1"));
|
redirects.Add(new RedirectToUrlRule(@"^/buildmsg(?:/?(.*))$", "https://github.com/Pathoschild/SMAPI/blob/develop/docs/mod-build-config.md#$1"));
|
||||||
redirects.Add(new RedirectToUrlRule(@"^/compat\.?$", "https://stardewvalleywiki.com/Modding:SMAPI_compatibility"));
|
redirects.Add(new RedirectToUrlRule(@"^/compat\.?$", "https://mods.smapi.io"));
|
||||||
redirects.Add(new RedirectToUrlRule(@"^/docs\.?$", "https://stardewvalleywiki.com/Modding:Index"));
|
redirects.Add(new RedirectToUrlRule(@"^/docs\.?$", "https://stardewvalleywiki.com/Modding:Index"));
|
||||||
redirects.Add(new RedirectToUrlRule(@"^/install\.?$", "https://stardewvalleywiki.com/Modding:Player_Guide/Getting_Started#Install_SMAPI"));
|
redirects.Add(new RedirectToUrlRule(@"^/install\.?$", "https://stardewvalleywiki.com/Modding:Player_Guide/Getting_Started#Install_SMAPI"));
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,6 @@
|
||||||
"SuccessCacheMinutes": 60,
|
"SuccessCacheMinutes": 60,
|
||||||
"ErrorCacheMinutes": 5,
|
"ErrorCacheMinutes": 5,
|
||||||
"SemanticVersionRegex": "^(?>(?<major>0|[1-9]\\d*))\\.(?>(?<minor>0|[1-9]\\d*))(?>(?:\\.(?<patch>0|[1-9]\\d*))?)(?:-(?<prerelease>(?>[a-z0-9]+[\\-\\.]?)+))?$",
|
"SemanticVersionRegex": "^(?>(?<major>0|[1-9]\\d*))\\.(?>(?<minor>0|[1-9]\\d*))(?>(?:\\.(?<patch>0|[1-9]\\d*))?)(?:-(?<prerelease>(?>[a-z0-9]+[\\-\\.]?)+))?$",
|
||||||
"WikiCompatibilityPageUrl": "https://smapi.io/compat"
|
"CompatibilityPageUrl": "https://mods.smapi.io"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ namespace StardewModdingAPI.Framework.ModLoading
|
||||||
updateUrls.Add(mod.DataRecord.AlternativeUrl);
|
updateUrls.Add(mod.DataRecord.AlternativeUrl);
|
||||||
|
|
||||||
// default update URL
|
// default update URL
|
||||||
updateUrls.Add("https://smapi.io/compat");
|
updateUrls.Add("https://mods.smapi.io");
|
||||||
|
|
||||||
// build error
|
// build error
|
||||||
string error = $"{reasonPhrase}. Please check for a ";
|
string error = $"{reasonPhrase}. Please check for a ";
|
||||||
|
|
|
@ -942,7 +942,7 @@ namespace StardewModdingAPI.Framework
|
||||||
}
|
}
|
||||||
catch (IncompatibleInstructionException) // details already in trace logs
|
catch (IncompatibleInstructionException) // details already in trace logs
|
||||||
{
|
{
|
||||||
string[] updateUrls = new[] { modDatabase.GetModPageUrlFor(manifest.UniqueID), "https://smapi.io/compat" }.Where(p => p != null).ToArray();
|
string[] updateUrls = new[] { modDatabase.GetModPageUrlFor(manifest.UniqueID), "https://mods.smapi.io" }.Where(p => p != null).ToArray();
|
||||||
errorReasonPhrase = $"it's no longer compatible. Please check for a new version at {string.Join(" or ", updateUrls)}.";
|
errorReasonPhrase = $"it's no longer compatible. Please check for a new version at {string.Join(" or ", updateUrls)}.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue