Skip to content

Commit

Permalink
Merge KSP-CKAN#4274 Stop trying to get remote version files from the …
Browse files Browse the repository at this point in the history
…forum
  • Loading branch information
HebaruSan committed Dec 7, 2024
2 parents 1cade54 + 4fe8a6f commit fda489c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ All notable changes to this project will be documented in this file.
- [Netkan] Handle raw GitHub URLs containing refs/heads/ (#4263 by: HebaruSan)
- [Netkan] Restore default version support for SpaceDock (#4272 by: HebaruSan)
- [Netkan] Don't raise inflation errors for single-hosted prereleases of multi-hosted mods (#4273 by: HebaruSan)
- [Netkan] Stop trying to get remote version files from the forum (#4274 by: HebaruSan)

## v1.35.2 (Penrose)

Expand Down
20 changes: 16 additions & 4 deletions Netkan/Transformers/AvcTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,17 @@ public IEnumerable<Metadata> Transform(Metadata metadata, TransformOptions? opts

try
{
if ((_github?.DownloadText(remoteUri)
?? _http.DownloadText(remoteUri)) is string remoteJson
&& JsonConvert.DeserializeObject<AvcVersion>(remoteJson) is AvcVersion remoteAvc
&& avc.version.CompareTo(remoteAvc.version) == 0)
if (BadHosts.Contains(remoteUri.Host))
{
Log.WarnFormat("AVC host does not contain version files: {0}",
remoteUri.Host);
}
else if ((_github?.DownloadText(remoteUri)
?? _http.DownloadText(remoteUri))
is string remoteJson
&& JsonConvert.DeserializeObject<AvcVersion>(remoteJson)
is AvcVersion remoteAvc
&& avc.version.Equals(remoteAvc.version))
{
// Local AVC and Remote AVC describe the same version, prefer
Log.Info("Remote AVC version file describes same version as local AVC version file, using it preferentially.");
Expand Down Expand Up @@ -161,5 +168,10 @@ public static void ApplyVersions(JObject json, AvcVersion avc)

return Net.GetRawUri(remoteUri);
}

private static readonly HashSet<string> BadHosts = new HashSet<string>()
{
"forum.kerbalspaceprogram.com",
};
}
}

0 comments on commit fda489c

Please sign in to comment.