Skip to content

Commit d80817f

Browse files
authored
Merge pull request #302 from TeamWheelWizard/feat/dynamic-retro-rewind-install-url
Fetch Retro Rewind install URL dynamically
2 parents 1a03b9d + 147f99e commit d80817f

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

WheelWizard/Features/CustomDistributions/Domain/RetroRewindApi.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ namespace WheelWizard.CustomDistributions.Domain;
44

55
public interface IRetroRewindApi
66
{
7-
[Get("/RetroRewind/zip/RetroRewind.zip")]
8-
Task<HttpContent> DownloadRetroRewindZip();
7+
[Get("/RetroRewind/RetroRewindInstall.txt")]
8+
Task<string> GetInstallUrl();
99

1010
[Get("/RetroRewind/RetroRewindVersion.txt")]
1111
Task<string> GetVersionFile();

WheelWizard/Features/CustomDistributions/RetroRewind.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,16 @@ private async Task<OperationResult> DownloadAndExtractRetroRewind(ProgressWindow
9494
_fileSystem.Directory.Delete(tempExtractionPath, recursive: true);
9595
_fileSystem.Directory.CreateDirectory(tempExtractionPath);
9696

97+
var installUrlResult = await _api.CallApiAsync(api => api.GetInstallUrl());
98+
if (installUrlResult.IsFailure || string.IsNullOrWhiteSpace(installUrlResult.Value))
99+
return Fail("Failed to get Retro Rewind download URL.");
100+
97101
//todo, service
98-
var downloadedFilePath = await DownloadHelper.DownloadToLocationAsync(Endpoints.RRZipUrl, downloadedZipPath, progressWindow);
102+
var downloadedFilePath = await DownloadHelper.DownloadToLocationAsync(
103+
installUrlResult.Value.Trim(),
104+
downloadedZipPath,
105+
progressWindow
106+
);
99107
if (string.IsNullOrWhiteSpace(downloadedFilePath) || !_fileSystem.File.Exists(downloadedFilePath))
100108
return progressWindow.WasCancellationRequested ? Ok() : Fail("Failed to download Retro Rewind files.");
101109

WheelWizard/Services/Endpoints.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public static class Endpoints
3535
// Retro Rewind
3636
public const string OldRRUrl = "http://update.rwfc.net:8000/";
3737
public const string RRUrl = "https://update.rwfc.net/";
38-
public const string RRZipUrl = RRUrl + "RetroRewind/zip/RetroRewind.zip";
3938
public const string RRTestersZipUrl = RRUrl + "RetroRewind/zip/Testers.zip";
4039
public const string RRVersionUrl = RRUrl + "RetroRewind/RetroRewindVersion.txt";
4140
public const string RRVersionDeleteUrl = RRUrl + "RetroRewind/RetroRewindDelete.txt";

0 commit comments

Comments
 (0)