mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-06-12 05:07:46 +02:00
ensure that the snapshot mapping is on all apis
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
@ -81,6 +81,21 @@ class ModrinthAPI : public NetworkResourceAPI {
|
||||
return {};
|
||||
}
|
||||
|
||||
[[nodiscard]] static inline QString mapMCVersionFromModrinth(QString v)
|
||||
{
|
||||
static const QString preString = " Pre-Release ";
|
||||
bool pre = false;
|
||||
if (v.contains("-pre")) {
|
||||
pre = true;
|
||||
v.replace("-pre", preString);
|
||||
}
|
||||
v.replace("-", " ");
|
||||
if (pre) {
|
||||
v.replace(" Pre Release ", preString);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
private:
|
||||
[[nodiscard]] static QString resourceTypeParameter(ModPlatform::ResourceType type)
|
||||
{
|
||||
@ -170,16 +185,9 @@ class ModrinthAPI : public NetworkResourceAPI {
|
||||
|
||||
QString getGameVersionsArray(std::list<Version> mcVersions) const
|
||||
{
|
||||
static const QString preString = " Pre-Release ";
|
||||
QString s;
|
||||
for (auto& ver : mcVersions) {
|
||||
auto verStr = ver.toString();
|
||||
|
||||
if (verStr.contains(preString)) {
|
||||
verStr.replace(preString, "-pre");
|
||||
}
|
||||
verStr.replace(" ", "-");
|
||||
s += QString("\"versions:%1\",").arg(verStr);
|
||||
s += QString("\"versions:%1\",").arg(mapMCVersionToModrinth(ver));
|
||||
}
|
||||
s.remove(s.length() - 1, 1); // remove last comma
|
||||
return s.isEmpty() ? QString() : s;
|
||||
@ -196,7 +204,7 @@ class ModrinthAPI : public NetworkResourceAPI {
|
||||
: QString("%1/project/%2/version?game_versions=[\"%3\"]&loaders=[\"%4\"]")
|
||||
.arg(BuildConfig.MODRINTH_PROD_URL)
|
||||
.arg(args.dependency.addonId.toString())
|
||||
.arg(args.mcVersion.toString())
|
||||
.arg(mapMCVersionToModrinth(args.mcVersion))
|
||||
.arg(getModLoaderStrings(args.loader).join("\",\""));
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user