diff options
author | Sefa Eyeoglu <contact@scrumplex.net> | 2022-04-16 18:03:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-16 18:03:03 +0200 |
commit | a42d2afceee9f6ea0d209cfb03b178defff1ce60 (patch) | |
tree | f0c0dedd898dea025796abc0bce8b303b84e18b4 /launcher/modplatform/modrinth | |
parent | db7cb125518e85f555b8816442b2ce2db4648cd8 (diff) | |
parent | 8e9eca6a970bf098c1045658368dc66b39e438ed (diff) | |
download | PrismLauncher-a42d2afceee9f6ea0d209cfb03b178defff1ce60.tar.gz PrismLauncher-a42d2afceee9f6ea0d209cfb03b178defff1ce60.tar.bz2 PrismLauncher-a42d2afceee9f6ea0d209cfb03b178defff1ce60.zip |
Merge pull request #392 from flowln/mod_filter
Diffstat (limited to 'launcher/modplatform/modrinth')
-rw-r--r-- | launcher/modplatform/modrinth/ModrinthAPI.h | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/launcher/modplatform/modrinth/ModrinthAPI.h b/launcher/modplatform/modrinth/ModrinthAPI.h index eefa4a85..6604d772 100644 --- a/launcher/modplatform/modrinth/ModrinthAPI.h +++ b/launcher/modplatform/modrinth/ModrinthAPI.h @@ -22,12 +22,12 @@ class ModrinthAPI : public NetworkModAPI { "limit=25&" "query=%2&" "index=%3&" - "facets=[[\"categories:%4\"],[\"versions:%5\"],[\"project_type:mod\"]]") + "facets=[[\"categories:%4\"],%5[\"project_type:mod\"]]") .arg(args.offset) .arg(args.search) .arg(args.sorting) .arg(getModLoaderString(args.mod_loader)) - .arg(args.version); + .arg(getGameVersionsArray(args.versions)); }; inline auto getVersionsURL(VersionSearchArgs& args) const -> QString override @@ -40,15 +40,14 @@ class ModrinthAPI : public NetworkModAPI { .arg(getModLoaderString(args.loader)); }; - inline auto getGameVersionsString(QList<QString> mcVersions) const -> QString + auto getGameVersionsArray(std::list<Version> mcVersions) const -> QString { QString s; - for(int i = 0; i < mcVersions.count(); i++){ - s += mcVersions.at(i); - if(i < mcVersions.count() - 1) - s += ","; + for(auto& ver : mcVersions){ + s += QString("\"versions:%1\",").arg(ver.toString()); } - return s; + s.remove(s.length() - 1, 1); //remove last comma + return s.isEmpty() ? QString() : QString("[%1],").arg(s); } static auto getModLoaderString(ModLoaderType type) -> const QString |