Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modrinth Game Versions don't show ranges #10346

Closed
n-aspen opened this issue Jul 10, 2024 · 5 comments · Fixed by #10350
Closed

Modrinth Game Versions don't show ranges #10346

n-aspen opened this issue Jul 10, 2024 · 5 comments · Fixed by #10350
Labels
service-badge New or updated service badge

Comments

@n-aspen
Copy link

n-aspen commented Jul 10, 2024

Are you experiencing an issue with...

shields.io

🐞 Description

When the latest release of a Modrinth project has a range of supported version, each version is listed individually instead of as a range as it is on Modrinth. This causes very long badges in some cases.

🔗 Link to the badge


image
https://img.shields.io/modrinth/game-versions/P1OZGk5p
https://modrinth.com/plugin/viaversion

💡 Possible Solution

Using the same range behavior when multiple versions are supported as Modrinth would be ideal and is what I was expecting.

@n-aspen n-aspen added the question Support questions, usage questions, unconfirmed bugs, discussions, ideas label Jul 10, 2024
@PyvesB
Copy link
Member

PyvesB commented Jul 10, 2024

Hello @n-aspen 👋🏻

Thanks for reporting, that badge is indeed very long. 😄

The API doesn't seem to be returning any range info, just a list of versions. If we get ["1.17", "1.18", "1.18.1", "1.18.2", "1.19"] back, one may be tempted to conclude that the range is 1.17-1.19, but that's technically not quite correct as version 1.17.1 is missing from the list. I'm wondering whether the Modrinth website handles these cases correctly.

A less elegant but more robust solution would be to put an ellipsis in the middle, e.g. 1.17 | 1.18 | ... | 1.19 | 1.19.1 when there are for example five or more versions returned by the API.

@PyvesB PyvesB added service-badge New or updated service badge and removed question Support questions, usage questions, unconfirmed bugs, discussions, ideas labels Jul 10, 2024
@n-aspen
Copy link
Author

n-aspen commented Jul 10, 2024

That's probably a reasonable solution for 90% of use cases tbh. Most of the time a project will support a lower and upper bound for versions.

I wanted to see how Modrinth handled it as their website is open source, and I think this is it? I'm not completely certain though, and best as I can tell it'd be way out of scope for this.

@n-aspen
Copy link
Author

n-aspen commented Jul 10, 2024

I found a definitive answer to this question

I'm wondering whether the Modrinth website handles these cases correctly.

This plugin 1u6JkXh5, has an old-ish release that only has 1.17.1, 1.18.2, 1.19.4-1.20.4 marked as supported, which matches this list in the API, where it's only made a range out of the 1.20.x entries because they're listed individually.

0	"1.17.1"
1	"1.18.2"
2	"1.19.4"
3	"1.20"
4	"1.20.1"
5	"1.20.2"
6	"1.20.3"
7	"1.20.4"

image

@PyvesB
Copy link
Member

PyvesB commented Jul 10, 2024

Thanks for digging that out! I'd foresee two issues with following a similar approach:

  • if the ranges are broken down in too many parts due to unsupported game versions here and there, the badge would still risk being too long.
  • we'd need to keep track of all known game versions, and make sure the listing is updated on a regular basis.

I'll let other maintainers weigh in, but I'd personally be in favour of a simpler and more robust solution, e.g. something ellipsis-based like 1.17 | 1.18 | ... | 1.19 | 1.19.1.

@chris48s
Copy link
Member

Ellipsis is definitely the easiest thing to do, and it puts a cap on the length. There are going to be some situations where it is not that helpful

There is a Modrinth API endpoint which gives all the available game versions. https://api.modrinth.com/v2/tag/game_version

curl "https://api.modrinth.com/v2/tag/game_version" | jq '[.[] | select(.version_type == "release") | .version]'

We could potentially use that to work out if a list of supported game versions on a project can be displayed as a range. It would be an extra API request, but we could do them in parallel or cache the game_version call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-badge New or updated service badge
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants