diff options
author | Petr Mrázek <peterix@users.noreply.github.com> | 2021-06-25 12:20:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-25 12:20:27 +0200 |
commit | d92733feaeca6a471063a86afe8dad613bedd689 (patch) | |
tree | 670eed6bc00107519f73d1ad7b95f46e4d38f6fe /api/logic/modplatform/atlauncher/ATLPackInstallTask.cpp | |
parent | 27d3ae145a2efd00be76b2c5b5c797b7807b852c (diff) | |
parent | a20a7e987fcc6e2d43a1686a175447495245615c (diff) | |
download | PrismLauncher-d92733feaeca6a471063a86afe8dad613bedd689.tar.gz PrismLauncher-d92733feaeca6a471063a86afe8dad613bedd689.tar.bz2 PrismLauncher-d92733feaeca6a471063a86afe8dad613bedd689.zip |
Merge pull request #3897 from jamierocks/atl-opt-mod-install-btn
NOISSUE Close optional mod dialog with Install button
Diffstat (limited to 'api/logic/modplatform/atlauncher/ATLPackInstallTask.cpp')
-rw-r--r-- | api/logic/modplatform/atlauncher/ATLPackInstallTask.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/api/logic/modplatform/atlauncher/ATLPackInstallTask.cpp b/api/logic/modplatform/atlauncher/ATLPackInstallTask.cpp index 89829c05..dac80e8c 100644 --- a/api/logic/modplatform/atlauncher/ATLPackInstallTask.cpp +++ b/api/logic/modplatform/atlauncher/ATLPackInstallTask.cpp @@ -4,6 +4,7 @@ #include <MMCZip.h> #include <minecraft/OneSixVersionFormat.h> #include <Version.h> +#include <net/ChecksumValidator.h> #include "ATLPackInstallTask.h" #include "BuildConfig.h" @@ -407,7 +408,12 @@ void PackInstallTask::installConfigs() auto entry = ENV.metacache()->resolveEntry("ATLauncherPacks", path); entry->setStale(true); - jobPtr->addNetAction(Net::Download::makeCached(url, entry)); + auto dl = Net::Download::makeCached(url, entry); + if (!m_version.configs.sha1.isEmpty()) { + auto rawSha1 = QByteArray::fromHex(m_version.configs.sha1.toLatin1()); + dl->addValidator(new Net::ChecksumValidator(QCryptographicHash::Sha1, rawSha1)); + } + jobPtr->addNetAction(dl); archivePath = entry->getFullPath(); connect(jobPtr.get(), &NetJob::succeeded, this, [&]() @@ -508,6 +514,10 @@ void PackInstallTask::downloadMods() modsToExtract.insert(entry->getFullPath(), mod); auto dl = Net::Download::makeCached(url, entry); + if (!mod.md5.isEmpty()) { + auto rawMd5 = QByteArray::fromHex(mod.md5.toLatin1()); + dl->addValidator(new Net::ChecksumValidator(QCryptographicHash::Md5, rawMd5)); + } jobPtr->addNetAction(dl); } else if(mod.type == ModType::Decomp) { @@ -516,6 +526,10 @@ void PackInstallTask::downloadMods() modsToDecomp.insert(entry->getFullPath(), mod); auto dl = Net::Download::makeCached(url, entry); + if (!mod.md5.isEmpty()) { + auto rawMd5 = QByteArray::fromHex(mod.md5.toLatin1()); + dl->addValidator(new Net::ChecksumValidator(QCryptographicHash::Md5, rawMd5)); + } jobPtr->addNetAction(dl); } else { @@ -526,6 +540,10 @@ void PackInstallTask::downloadMods() entry->setStale(true); auto dl = Net::Download::makeCached(url, entry); + if (!mod.md5.isEmpty()) { + auto rawMd5 = QByteArray::fromHex(mod.md5.toLatin1()); + dl->addValidator(new Net::ChecksumValidator(QCryptographicHash::Md5, rawMd5)); + } jobPtr->addNetAction(dl); auto path = FS::PathCombine(m_stagingPath, "minecraft", relpath, mod.file); |