aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/modrinth
diff options
context:
space:
mode:
authorRyan Cao <70191398+ryanccn@users.noreply.github.com>2022-06-01 00:12:14 +0800
committerGitHub <noreply@github.com>2022-06-01 00:12:14 +0800
commite06bf17d13b991fea5e49ff23b6fe9c8f5540e02 (patch)
tree3456de4848d8ef68f954a1fe5c288e62a075d789 /launcher/modplatform/modrinth
parent9673dac22b0ff81a54847d5db5438c099a6df587 (diff)
parent04a3669fc470130a5d7f2dfd32f06a3f2aceb165 (diff)
downloadPrismLauncher-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.h8
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackManifest.cpp22
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