diff options
author | Ryan Cao <70191398+ryanccn@users.noreply.github.com> | 2022-06-01 00:12:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-01 00:12:14 +0800 |
commit | e06bf17d13b991fea5e49ff23b6fe9c8f5540e02 (patch) | |
tree | 3456de4848d8ef68f954a1fe5c288e62a075d789 /launcher/modplatform/modrinth | |
parent | 9673dac22b0ff81a54847d5db5438c099a6df587 (diff) | |
parent | 04a3669fc470130a5d7f2dfd32f06a3f2aceb165 (diff) | |
download | PrismLauncher-e06bf17d13b991fea5e49ff23b6fe9c8f5540e02.tar.gz PrismLauncher-e06bf17d13b991fea5e49ff23b6fe9c8f5540e02.tar.bz2 PrismLauncher-e06bf17d13b991fea5e49ff23b6fe9c8f5540e02.zip |
Merge branch 'PolyMC:develop' into macos-app-heuristic
Diffstat (limited to 'launcher/modplatform/modrinth')
-rw-r--r-- | launcher/modplatform/modrinth/ModrinthAPI.h | 8 | ||||
-rw-r--r-- | launcher/modplatform/modrinth/ModrinthPackManifest.cpp | 22 |
2 files changed, 14 insertions, 16 deletions
diff --git a/launcher/modplatform/modrinth/ModrinthAPI.h b/launcher/modplatform/modrinth/ModrinthAPI.h index 79bc5175..6119a4df 100644 --- a/launcher/modplatform/modrinth/ModrinthAPI.h +++ b/launcher/modplatform/modrinth/ModrinthAPI.h @@ -79,11 +79,11 @@ class ModrinthAPI : public NetworkModAPI { { return QString(BuildConfig.MODRINTH_PROD_URL + "/project/%1/version?" - "game_versions=[%2]" + "game_versions=[%2]&" "loaders=[\"%3\"]") - .arg(args.addonId) - .arg(getGameVersionsString(args.mcVersions)) - .arg(getModLoaderStrings(args.loaders).join("\",\"")); + .arg(args.addonId, + getGameVersionsString(args.mcVersions), + getModLoaderStrings(args.loaders).join("\",\"")); }; auto getGameVersionsArray(std::list<Version> mcVersions) const -> QString diff --git a/launcher/modplatform/modrinth/ModrinthPackManifest.cpp b/launcher/modplatform/modrinth/ModrinthPackManifest.cpp index f1ad39ce..33116231 100644 --- a/launcher/modplatform/modrinth/ModrinthPackManifest.cpp +++ b/launcher/modplatform/modrinth/ModrinthPackManifest.cpp @@ -42,6 +42,8 @@ #include "minecraft/MinecraftInstance.h" #include "minecraft/PackProfile.h" +#include <QSet> + static ModrinthAPI api; namespace Modrinth { @@ -95,19 +97,15 @@ void loadIndexedVersions(Modpack& pack, QJsonDocument& doc) auto validateDownloadUrl(QUrl url) -> bool { + static QSet<QString> domainWhitelist{ + "cdn.modrinth.com", + "github.com", + "raw.githubusercontent.com", + "gitlab.com" + }; + auto domain = url.host(); - if(domain == "cdn.modrinth.com") - return true; - if(domain == "edge.forgecdn.net") - return true; - if(domain == "media.forgecdn.net") - return true; - if(domain == "github.com") - return true; - if(domain == "raw.githubusercontent.com") - return true; - - return false; + return domainWhitelist.contains(domain); } auto loadIndexedVersion(QJsonObject &obj) -> ModpackVersion |