revert: don't check modrinth whitelisted hosts
people didn't seem to like it, and its not required
This commit is contained in:
parent
1b878030aa
commit
b3c8f9d508
@ -586,7 +586,6 @@ void InstanceImportTask::processMultiMC()
|
|||||||
void InstanceImportTask::processModrinth()
|
void InstanceImportTask::processModrinth()
|
||||||
{
|
{
|
||||||
std::vector<Modrinth::File> files;
|
std::vector<Modrinth::File> files;
|
||||||
std::vector<Modrinth::File> non_whitelisted_files;
|
|
||||||
QString minecraftVersion, fabricVersion, quiltVersion, forgeVersion;
|
QString minecraftVersion, fabricVersion, quiltVersion, forgeVersion;
|
||||||
try {
|
try {
|
||||||
QString indexPath = FS::PathCombine(m_stagingPath, "modrinth.index.json");
|
QString indexPath = FS::PathCombine(m_stagingPath, "modrinth.index.json");
|
||||||
@ -663,12 +662,6 @@ void InstanceImportTask::processModrinth()
|
|||||||
throw JSONValidationError(tr("Download URL for %1 is not a correctly formatted URL").arg(file.path));
|
throw JSONValidationError(tr("Download URL for %1 is not a correctly formatted URL").arg(file.path));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!Modrinth::validateDownloadUrl(download_url)) {
|
|
||||||
qDebug() << QString("Download URL (%1) for %2 is from a non-whitelisted by Modrinth domain").arg(download_url.toString(), file.path);
|
|
||||||
if(is_last && file.downloads.isEmpty())
|
|
||||||
non_whitelisted_files.push_back(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
file.downloads.push_back(download_url);
|
file.downloads.push_back(download_url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -676,26 +669,6 @@ void InstanceImportTask::processModrinth()
|
|||||||
files.push_back(file);
|
files.push_back(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!non_whitelisted_files.empty()) {
|
|
||||||
QString text;
|
|
||||||
for (const auto& file : non_whitelisted_files) {
|
|
||||||
text += tr("Filepath: %1<br>").arg(file.path);
|
|
||||||
for(auto d : file.downloads)
|
|
||||||
text += tr("URL:") + QString("<a href='%1'>%2</a>").arg(d.toString());
|
|
||||||
text += "<br>";
|
|
||||||
}
|
|
||||||
|
|
||||||
auto message_dialog = new ScrollMessageBox(m_parent, tr("Non-whitelisted mods found"),
|
|
||||||
tr("The following mods have URLs that are not whitelisted by Modrinth.\n"
|
|
||||||
"Proceed with caution!"),
|
|
||||||
text);
|
|
||||||
message_dialog->setModal(true);
|
|
||||||
if (message_dialog->exec() == QDialog::Rejected) {
|
|
||||||
emitFailed("Aborted");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto dependencies = Json::requireObject(obj, "dependencies", "modrinth.index.json");
|
auto dependencies = Json::requireObject(obj, "dependencies", "modrinth.index.json");
|
||||||
for (auto it = dependencies.begin(), end = dependencies.end(); it != end; ++it) {
|
for (auto it = dependencies.begin(), end = dependencies.end(); it != end; ++it) {
|
||||||
QString name = it.key();
|
QString name = it.key();
|
||||||
|
@ -95,19 +95,6 @@ void loadIndexedVersions(Modpack& pack, QJsonDocument& doc)
|
|||||||
pack.versionsLoaded = true;
|
pack.versionsLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto validateDownloadUrl(QUrl url) -> bool
|
|
||||||
{
|
|
||||||
static QSet<QString> domainWhitelist{
|
|
||||||
"cdn.modrinth.com",
|
|
||||||
"github.com",
|
|
||||||
"raw.githubusercontent.com",
|
|
||||||
"gitlab.com"
|
|
||||||
};
|
|
||||||
|
|
||||||
auto domain = url.host();
|
|
||||||
return domainWhitelist.contains(domain);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto loadIndexedVersion(QJsonObject &obj) -> ModpackVersion
|
auto loadIndexedVersion(QJsonObject &obj) -> ModpackVersion
|
||||||
{
|
{
|
||||||
ModpackVersion file;
|
ModpackVersion file;
|
||||||
@ -137,9 +124,6 @@ auto loadIndexedVersion(QJsonObject &obj) -> ModpackVersion
|
|||||||
|
|
||||||
auto url = Json::requireString(parent, "url");
|
auto url = Json::requireString(parent, "url");
|
||||||
|
|
||||||
if(!validateDownloadUrl(url))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
file.download_url = url;
|
file.download_url = url;
|
||||||
if(is_primary)
|
if(is_primary)
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user