diff options
author | flow <flowlnlnln@gmail.com> | 2022-05-28 09:19:53 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2022-05-28 17:01:52 -0300 |
commit | f4604bbf797673b089367ec6af42723084b17181 (patch) | |
tree | 4f4ac6f74291d2f75bb465d3c2530d5ec838c74e | |
parent | 699ad316f0d90580fa13d570d6c25aff903a470d (diff) | |
download | PrismLauncher-f4604bbf797673b089367ec6af42723084b17181.tar.gz PrismLauncher-f4604bbf797673b089367ec6af42723084b17181.tar.bz2 PrismLauncher-f4604bbf797673b089367ec6af42723084b17181.zip |
change: update whitelisted hosts in Modrinth modpacks
-rw-r--r-- | launcher/InstanceImportTask.cpp | 11 | ||||
-rw-r--r-- | launcher/modplatform/modrinth/ModrinthPackManifest.cpp | 4 |
2 files changed, 8 insertions, 7 deletions
diff --git a/launcher/InstanceImportTask.cpp b/launcher/InstanceImportTask.cpp index 68a497cc..e3f54aeb 100644 --- a/launcher/InstanceImportTask.cpp +++ b/launcher/InstanceImportTask.cpp @@ -641,10 +641,15 @@ void InstanceImportTask::processModrinth() file.hashAlgorithm = hashAlgorithm; // Do not use requireUrl, which uses StrictMode, instead use QUrl's default TolerantMode // (as Modrinth seems to incorrectly handle spaces) + file.download = Json::requireString(Json::ensureArray(modInfo, "downloads").first(), "Download URL for " + file.path); - if (!file.download.isValid() || !Modrinth::validateDownloadUrl(file.download)) { - throw JSONValidationError("Download URL for " + file.path + " is not a correctly formatted URL"); - } + + if(!file.download.isValid()) + throw JSONValidationError(tr("Download URL for %1 is not a correctly formatted URL").arg(file.path)); + else if(!Modrinth::validateDownloadUrl(file.download)) + throw JSONValidationError( + tr("Download URL for %1 is from a non-whitelisted by Modrinth domain: %2").arg(file.path, file.download.host())); + files.push_back(file); } diff --git a/launcher/modplatform/modrinth/ModrinthPackManifest.cpp b/launcher/modplatform/modrinth/ModrinthPackManifest.cpp index f1ad39ce..b1c4fbcd 100644 --- a/launcher/modplatform/modrinth/ModrinthPackManifest.cpp +++ b/launcher/modplatform/modrinth/ModrinthPackManifest.cpp @@ -98,10 +98,6 @@ auto validateDownloadUrl(QUrl url) -> bool 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") |