diff options
| author | Trial97 <alexandru.tripon97@gmail.com> | 2023-06-24 20:04:56 +0300 | 
|---|---|---|
| committer | Trial97 <alexandru.tripon97@gmail.com> | 2023-06-24 20:04:56 +0300 | 
| commit | 81c1a951665962d066a9b51a16f219ff4b160b4e (patch) | |
| tree | a482e2fce09c07290bdd81f2777b059995e98c9b /launcher/modplatform/modrinth/ModrinthAPI.h | |
| parent | f825d7753afd6c00111c9ff9deedeee8ded5b27a (diff) | |
| parent | bcf45c74a1b0b3389c05927637bf8aa95b8e43cf (diff) | |
| download | PrismLauncher-81c1a951665962d066a9b51a16f219ff4b160b4e.tar.gz PrismLauncher-81c1a951665962d066a9b51a16f219ff4b160b4e.tar.bz2 PrismLauncher-81c1a951665962d066a9b51a16f219ff4b160b4e.zip | |
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into curse
Diffstat (limited to 'launcher/modplatform/modrinth/ModrinthAPI.h')
| -rw-r--r-- | launcher/modplatform/modrinth/ModrinthAPI.h | 23 | 
1 files changed, 14 insertions, 9 deletions
| diff --git a/launcher/modplatform/modrinth/ModrinthAPI.h b/launcher/modplatform/modrinth/ModrinthAPI.h index 98f20b51..e83ed2bf 100644 --- a/launcher/modplatform/modrinth/ModrinthAPI.h +++ b/launcher/modplatform/modrinth/ModrinthAPI.h @@ -38,7 +38,7 @@ class ModrinthAPI : public NetworkResourceAPI {      static auto getModLoaderStrings(const ModLoaderTypes types) -> const QStringList      {          QStringList l; -        for (auto loader : {Forge, Fabric, Quilt}) { +        for (auto loader : { Forge, Fabric, Quilt }) {              if (types & loader) {                  l << getModLoaderString(loader);              } @@ -51,8 +51,7 @@ class ModrinthAPI : public NetworkResourceAPI {      static auto getModLoaderFilters(ModLoaderTypes types) -> const QString      {          QStringList l; -        for (auto loader : getModLoaderStrings(types)) -        { +        for (auto loader : getModLoaderStrings(types)) {              l << QString("\"categories:%1\"").arg(loader);          }          return l.join(','); @@ -135,16 +134,22 @@ class ModrinthAPI : public NetworkResourceAPI {      auto getGameVersionsArray(std::list<Version> mcVersions) const -> QString      {          QString s; -        for(auto& ver : mcVersions){ +        for (auto& ver : mcVersions) {              s += QString("\"versions:%1\",").arg(ver.toString());          } -        s.remove(s.length() - 1, 1); //remove last comma +        s.remove(s.length() - 1, 1);  // remove last comma          return s.isEmpty() ? QString() : s;      } -    inline auto validateModLoaders(ModLoaderTypes loaders) const -> bool -    { -        return loaders & (Forge | Fabric | Quilt); -    } +    inline auto validateModLoaders(ModLoaderTypes loaders) const -> bool { return loaders & (Forge | Fabric | Quilt); } +    [[nodiscard]] std::optional<QString> getDependencyURL(DependencySearchArgs const& args) const override +    { +        return args.dependency.version.length() != 0 ? QString("%1/version/%2").arg(BuildConfig.MODRINTH_PROD_URL, args.dependency.version) +                                                     : 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(getModLoaderStrings(args.loader).join("\",\"")); +    };  }; | 
