change: update whitelisted hosts in Modrinth modpacks
This commit is contained in:
parent
699ad316f0
commit
f4604bbf79
@ -641,10 +641,15 @@ void InstanceImportTask::processModrinth()
|
|||||||
file.hashAlgorithm = hashAlgorithm;
|
file.hashAlgorithm = hashAlgorithm;
|
||||||
// Do not use requireUrl, which uses StrictMode, instead use QUrl's default TolerantMode
|
// Do not use requireUrl, which uses StrictMode, instead use QUrl's default TolerantMode
|
||||||
// (as Modrinth seems to incorrectly handle spaces)
|
// (as Modrinth seems to incorrectly handle spaces)
|
||||||
|
|
||||||
file.download = Json::requireString(Json::ensureArray(modInfo, "downloads").first(), "Download URL for " + file.path);
|
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);
|
files.push_back(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,10 +98,6 @@ auto validateDownloadUrl(QUrl url) -> bool
|
|||||||
auto domain = url.host();
|
auto domain = url.host();
|
||||||
if(domain == "cdn.modrinth.com")
|
if(domain == "cdn.modrinth.com")
|
||||||
return true;
|
return true;
|
||||||
if(domain == "edge.forgecdn.net")
|
|
||||||
return true;
|
|
||||||
if(domain == "media.forgecdn.net")
|
|
||||||
return true;
|
|
||||||
if(domain == "github.com")
|
if(domain == "github.com")
|
||||||
return true;
|
return true;
|
||||||
if(domain == "raw.githubusercontent.com")
|
if(domain == "raw.githubusercontent.com")
|
||||||
|
Loading…
Reference in New Issue
Block a user