fix: issue with main Forge library not downloading correctly from our CDN

This commit is contained in:
Ryan Dowling 2022-07-23 18:11:36 +10:00
parent 5f33907199
commit 02d7b831f2
No known key found for this signature in database
GPG key ID: 5539FCDB88950EFD
3 changed files with 8 additions and 4 deletions

View file

@ -12,6 +12,7 @@ This changelog only contains the changes that are unreleased. For changes for in
- Add --debug-level option back in
- Noisy logs around images for instance/server cards
- Some incorrect colours on light themes
- Issue with main Forge library not downloading correctly from our CDN
### Misc
- Remove headless dependency from debian package

View file

@ -39,6 +39,10 @@ public class LibraryTypeAdapter implements JsonDeserializer<Library> {
library = new Gson().fromJson(object, ForgeLibrary.class);
} else {
library = new Gson().fromJson(object, Library.class);
if (library.name.contains("forge") && library.downloads.artifact.url.endsWith("-launcher.jar")) {
library.downloads.artifact.url = library.downloads.artifact.url.replace("-launcher.jar", ".jar");
}
}
return library;

View file

@ -57,10 +57,9 @@ public class ForgeLibraryTypeAdapter implements JsonDeserializer<ForgeLibrary> {
library.downloads = new Gson().fromJson(object.get("downloads").getAsJsonObject(), Downloads.class);
if (library.downloads.artifact.url.isEmpty()) {
// forge installer provides this out the zip, but when the file is removed from
// shared libraries, we need to change the url to grab the launcher jar (same)
library.downloads.artifact.url = Constants.FORGE_MAVEN_BASE
+ library.downloads.artifact.path.replace(".jar", "-launcher.jar");
// forge installer provides this out the zip (14.23.5.2851 and later), but when
// the file is removed from shared libraries, we need to add the url
library.downloads.artifact.url = Constants.FORGE_MAVEN_BASE + library.downloads.artifact.path;
}
// use our own mirror for Forge downloads