Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions WheelWizard.Test/Features/GameBananaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ private GameBananaModPreview CreateFakeModPreview(int id)
},
ModelName = "Mod",
PreviewMedia = new(),
HasContentRatings = false,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,8 @@ public class GameBananaModDetails
public required int DownloadCount { get; set; }

[JsonPropertyName("_aFiles")]
public required List<GameBananaModFiles> Files { get; set; }
public List<GameBananaModFiles>? Files { get; set; }

[JsonPropertyName("_aArchivedFiles")]
public List<GameBananaModFiles>? ArchivedFiles { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public class GameBananaModPreview
[JsonPropertyName("_aPreviewMedia")]
public required GameBananaPreviewMedia PreviewMedia { get; set; }

[JsonPropertyName("_bHasContentRatings")]
public required bool HasContentRatings { get; set; }

[JsonPropertyName("_nLikeCount")]
public int LikeCount { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public GameBananaModPreview GetLoadingPreview()
AvatarUrl = "",
},
PreviewMedia = new(),
HasContentRatings = false,
};
}
}
5 changes: 1 addition & 4 deletions WheelWizard/Services/Endpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static class Endpoints
/// <summary>
/// The base address for accessing the GameBanana API
/// </summary>
public const string GameBananaBaseAddress = "https://gamebanana.com/apiv11";
public const string GameBananaBaseAddress = "https://gamebanana.com/apiv12";

/// <summary>
/// The address for the GitHub API
Expand Down Expand Up @@ -48,7 +48,4 @@ public static class Endpoints

// Other
public const string MiiChannelWAD = "-";

//GameBanana
public const string GameBananaBaseUrl = "https://gamebanana.com/apiv11";
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private async Task LoadMods(int page, string searchTerm = "", bool ensurePatchRe
}

var metadata = result.Value.MetaData;
var newMods = result.Value.Records.Where(mod => mod.ModelName == "Mod").ToList();
var newMods = result.Value.Records.Where(mod => mod.ModelName == "Mod" && !mod.HasContentRatings).ToList();

foreach (var mod in newMods)
{
Expand Down
11 changes: 8 additions & 3 deletions WheelWizard/Views/Popups/ModManagement/ModContent.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Avalonia.Interactivity;
using Avalonia.Interactivity;
using Avalonia.Media.Imaging;
using WheelWizard.GameBanana;
using WheelWizard.GameBanana.Domain;
Expand Down Expand Up @@ -216,8 +216,13 @@ private async Task<OperationResult> DownloadAndInstallCurrentModAsync()
if (prepareResult.IsFailure)
return prepareResult.Error;

var downloadUrls = OverrideDownloadUrl != null ? [OverrideDownloadUrl] : CurrentMod.Files.Select(f => f.DownloadUrl).ToList();
if (!downloadUrls.Any())
var downloadUrls =
OverrideDownloadUrl != null
? [OverrideDownloadUrl]
: CurrentMod.Files?.Select(f => f.DownloadUrl).ToList()
?? CurrentMod.ArchivedFiles?.Select(f => f.DownloadUrl).ToList()
?? [];
if (downloadUrls.Count == 0)
return Fail("No downloadable files were found for this mod.");

var progressWindow = new ProgressWindow(t("progress.downloading_mod", CurrentMod.Name)!);
Expand Down
Loading