aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/modrinth/ModrinthAPI.h
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/modplatform/modrinth/ModrinthAPI.h')
-rw-r--r--launcher/modplatform/modrinth/ModrinthAPI.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/launcher/modplatform/modrinth/ModrinthAPI.h b/launcher/modplatform/modrinth/ModrinthAPI.h
index cf4dec1a..30952e99 100644
--- a/launcher/modplatform/modrinth/ModrinthAPI.h
+++ b/launcher/modplatform/modrinth/ModrinthAPI.h
@@ -30,11 +30,27 @@ class ModrinthAPI : public NetworkModAPI {
.arg(args.version);
};
- inline auto getVersionsURL(const QString& addonId) const -> QString override
+ inline auto getVersionsURL(VersionSearchArgs& args) const -> QString override
{
- return QString("https://api.modrinth.com/v2/project/%1/version").arg(addonId);
+ return QString("https://api.modrinth.com/v2/project/%1/version?"
+ "game_versions=[%2]"
+ "loaders=[%3]")
+ .arg(args.addonId)
+ .arg(getGameVersionsString(args.mcVersions))
+ .arg(getModLoaderString(args.loader));
};
+ inline auto getGameVersionsString(QList<QString> mcVersions) const -> QString
+ {
+ QString s;
+ for(int i = 0; i < mcVersions.count(); i++){
+ s += mcVersions.at(i);
+ if(i < mcVersions.count() - 1)
+ s += ",";
+ }
+ return s;
+ }
+
inline auto getModLoaderString(ModLoaderType modLoader) const -> QString
{
switch (modLoader) {