Repository navigation
Add hangar command to download plugins from Hangar - #947
Conversation
Adds a `hangar` command that downloads plugins from Hangar, PaperMC's plugin repository, for the requested platform and Minecraft version. - Projects are given as slug or ID with an optional version name, `@` listing files, and a `?` suffix for optional projects - When no version is given, the newest version of `--channel` (default Release) supporting the platform and game version is used - Hangar hosted files are verified against their SHA-256 and replaced when an existing file with the same name has different content - External downloads are refreshed when the remote file was modified - Previously downloaded files of removed projects are cleaned up via the manifest
itzg
left a comment
There was a problem hiding this comment.
Thanks for adding this. I'll have the merge trigger a minor version bump. You can update the version in the Dockerfile of your draft PR. Or I can let Renovate apply the upgrade first.
| throw e; | ||
| } | ||
|
|
||
| return Stream.of(download(sharedFetch, download)); |
There was a problem hiding this comment.
A stream-of-one seems unnecessary here. It's a stream in others like modrinth since a single project reference could result in transitive dependencies getting pulled also.
For future proofing, I'm good with leaving this as is.
| download = resolveDownload(hangarApiClient, projectRef) | ||
| .block(); | ||
| } catch (InvalidParameterException e) { | ||
| if (projectRef.isOptional()) { | ||
| log.warn("Optional project '{}' is not available β skipping: {}", projectRef.getSlugOrId(), e.getMessage()); | ||
| return Stream.empty(); | ||
| } | ||
| throw e; | ||
| } | ||
|
|
||
| return Stream.of(download(sharedFetch, download)); |
There was a problem hiding this comment.
It would have been ideal to keep the reactive chain between the metadata resolution and the file download; however, I can appreciate that retries within a reactive chain get ugly.
|
Could also add support to the mc-proxy image after this itzg/docker-mc-proxy#427 |
|
Image updated with itzg/docker-minecraft-server#4395 |
|
Thanks for the merge! π€β€οΈ |
For itzg/docker-minecraft-server#2103
Draft PR itzg/docker-minecraft-server#4392
Adds a
hangarcommand, modeled aftermodrinthas suggested in that issue, that downloads plugins from Hangar.--projectstakes slugs or IDs with an optional:version,@listing files and a?suffix for optional projects, likemodrinth--channel(defaultRelease, Hangar's default channel) that supports--platform(defaultPAPER) and--game-versionis selectedTesting
HangarCommandTestwith WireMock (./gradlew checkandcheckReadmepass)ViaVersion,Maintenance:4.3.0,Floodgateand an optional missing project, then again with Floodgate removed: downloads, skipping on re-run, the optional skip and cleanup - all worked