mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2025-01-03 14:38:44 +00:00
NOISSUE Handle Modrinth files with multiple downloads
This commit is contained in:
parent
bea3251d9c
commit
496440cbc8
@ -88,6 +88,7 @@ void InstanceExportTask::executeTask()
|
||||
|
||||
m_responses.append(HashLookupData{
|
||||
QFileInfo(file),
|
||||
hash,
|
||||
QByteArray()
|
||||
});
|
||||
|
||||
@ -117,7 +118,19 @@ void InstanceExportTask::lookupSucceeded()
|
||||
try {
|
||||
auto document = Json::requireDocument(data.response);
|
||||
auto object = Json::requireObject(document);
|
||||
auto file = Json::requireIsArrayOf<QJsonObject>(object, "files").first();
|
||||
auto files = Json::requireIsArrayOf<QJsonObject>(object, "files");
|
||||
|
||||
QJsonObject file;
|
||||
|
||||
for (const auto &fileJson : files) {
|
||||
auto hashes = Json::requireObject(fileJson, "hashes");
|
||||
QString sha512 = Json::requireString(hashes, "sha512");
|
||||
|
||||
if (sha512 == data.sha512) {
|
||||
file = fileJson;
|
||||
}
|
||||
}
|
||||
|
||||
auto url = Json::requireString(file, "url");
|
||||
auto hashes = Json::requireObject(file, "hashes");
|
||||
|
||||
|
@ -38,6 +38,7 @@ struct ExportSettings
|
||||
struct HashLookupData
|
||||
{
|
||||
QFileInfo fileInfo;
|
||||
QString sha512;
|
||||
QByteArray response;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user