Skip to content

Commit 990732d

Browse files
fix: TuxFamily client should now properly grab checksums from internet archive snapshot for older releases.
1 parent c7e8a37 commit 990732d

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

GDVM/Godot/TuxFamilyClient.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ public interface ITuxFamilyClient
1212
// TuxFamily has had inconsistent connectivity and is seeminlgy down, so we just use the internet archive version.
1313
public class TuxFamilyClient(HttpClient httpClient, ILogger<TuxFamilyClient> logger) : ITuxFamilyClient
1414
{
15-
private const string BaseUrl = "https://web.archive.org/web/20240927142429/https://downloads.tuxfamily.org/godotengine";
15+
// Use a stable archive snapshot; the live endpoint is unreliable.
16+
private const string BaseUrl = "https://web.archive.org/web/20211106101031if_/https://downloads.tuxfamily.org/godotengine";
1617

1718
// TODO: Replace with Task<Result<string, NetworkError>> GetSha512Async(Release godotRelease, CancellationToken cancellationToken)
1819
public async Task<string> GetSha512Async(Release godotRelease, CancellationToken cancellationToken)
@@ -25,6 +26,7 @@ public async Task<string> GetSha512Async(Release godotRelease, CancellationToken
2526

2627
if (response.IsSuccessStatusCode)
2728
{
29+
logger.LogInformation("Found SHA512 for {Version} at {Url}", godotRelease.Version, url);
2830
return await response.Content.ReadAsStringAsync(cancellationToken);
2931
}
3032

@@ -50,6 +52,7 @@ public async Task<HttpResponseMessage> GetZipFileAsync(string filename, Release
5052

5153
if (response.IsSuccessStatusCode)
5254
{
55+
logger.LogInformation("Found {File} for {Release} at {Url}", filename, godotRelease.ReleaseNameWithRuntime, url);
5356
return response;
5457
}
5558

@@ -66,13 +69,12 @@ public async Task<HttpResponseMessage> GetZipFileAsync(string filename, Release
6669

6770
private static string BuildUrl(string filename, Release godotRelease)
6871
{
69-
// stable is the root path on Tux Family
70-
var baseUrl = godotRelease.Type is null || godotRelease.Type == "stable"
72+
var basePath = godotRelease.Type is null || godotRelease.Type == "stable"
7173
? $"{BaseUrl}/{godotRelease.Version}"
7274
: $"{BaseUrl}/{godotRelease.Version}/{godotRelease.Type}";
7375

7476
return godotRelease.RuntimeEnvironment == RuntimeEnvironment.Mono
75-
? $"{baseUrl}/mono/{filename}"
76-
: $"{baseUrl}/{filename}";
77+
? $"{basePath}/mono/{filename}"
78+
: $"{basePath}/{filename}";
7779
}
7880
}

GDVM/Services/InstallationService.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public async Task<Result<InstallationOutcome, InstallationError>> InstallRelease
133133

134134
// TODO: Revisit this to use the godot-builds JSON artifacts instead
135135
// Verify checksum if available
136-
if (godotRelease is { Major: 4, Minor: >= 3 })
136+
if (ShouldVerifyChecksum(godotRelease))
137137
{
138138
progress.Report(new OperationProgress<InstallationStage>(InstallationStage.VerifyingChecksum, "Verifying checksum..."));
139139
memStream.Position = 0;
@@ -291,6 +291,10 @@ private static async Task<string> CalculateChecksum(MemoryStream memStream, Canc
291291
return checksum;
292292
}
293293

294+
// TODO: Update once manifest-based releases are used
295+
private static bool ShouldVerifyChecksum(Release release) =>
296+
release.Major > 3 || release is { Major: 3, Minor: >= 3 };
297+
294298
// TODO: Replace with Result<string, ParseError> ParseSha512SumsContent(string fileName, string content)
295299
public static string? TryParseSha512SumsContent(string fileName, string content)
296300
{

0 commit comments

Comments
 (0)