Allow for a repo that can be better parsed


#1

I contribute to the Pterodactyl Panel and there is something called “nests” which allow a User to automatically select what type of software they wish to download. Be it a source game to Minecraft Forge project. Typically, there is a var called “version” that allow a user to pick which MC and Software version they wish to download.

For Forge, the Install script’s version catch is this:

(curl -sl http://files.minecraftforge.net/maven/net/minecraftforge/forge/ | grep -A1 Latest | grep -o -e ‘[1].[0-9][0-9]]?.?[0-9]?[0-9] - [0-9][0-9].[0-9][0-9].[0-9]?[0-9].[0-9][0-9][0-9][0-9]’)

Thanks to the Javascript, Curl doesnt work, and we cannot automatically parse the version numbers. Is it possible to get a repo that we may beable to parse through curl and possibly a “latest version” link that always points to the latest. Maybe a “Stable” link too.


#2

If I understand correctly, you’re looking for a way to query for versions.

Firstly, both forge and sponge use a maven repository. So rather than scraping the page content (which is bound to break at some point), you can parse the maven XML data:

Forge: https://files.minecraftforge.net/maven/net/minecraftforge/forge/maven-metadata.xml

SpongeForge: https://repo.spongepowered.org/maven/org/spongepowered/spongeforge/maven-metadata.xml
Alternative: http://files.minecraftforge.net/maven/org/spongepowered/spongeforge/maven-metadata.xml

SpongeVanilla: https://repo.spongepowered.org/maven/org/spongepowered/spongevanilla/maven-metadata.xml

In addition, There are other ways to query for versions:

Every version of Forge as a JSON object: http://files.minecraftforge.net/maven/net/minecraftforge/forge/json
Reccommended forge versions:
http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions.json
and http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json

The Sponge download site (https://www.spongepowered.org/downloads) also has an API, documented here: https://spongedownloads.docs.apiary.io/

For example,
Stable SpongeForge 1.12.2 builds: https://dl-api.spongepowered.org/v1/org.spongepowered/spongeforge/downloads?type=stable&minecraft=1.12.2

Get the latest stable SpongeVanilla build: https://dl-api.spongepowered.org/v1/org.spongepowered/spongevanilla