mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2025-01-05 21:54:15 +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{
|
m_responses.append(HashLookupData{
|
||||||
QFileInfo(file),
|
QFileInfo(file),
|
||||||
|
hash,
|
||||||
QByteArray()
|
QByteArray()
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -117,7 +118,19 @@ void InstanceExportTask::lookupSucceeded()
|
|||||||
try {
|
try {
|
||||||
auto document = Json::requireDocument(data.response);
|
auto document = Json::requireDocument(data.response);
|
||||||
auto object = Json::requireObject(document);
|
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 url = Json::requireString(file, "url");
|
||||||
auto hashes = Json::requireObject(file, "hashes");
|
auto hashes = Json::requireObject(file, "hashes");
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ struct ExportSettings
|
|||||||
struct HashLookupData
|
struct HashLookupData
|
||||||
{
|
{
|
||||||
QFileInfo fileInfo;
|
QFileInfo fileInfo;
|
||||||
|
QString sha512;
|
||||||
QByteArray response;
|
QByteArray response;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user