diff options
author | Jamie Mansfield <jmansfield@cadixdev.org> | 2022-04-02 00:11:33 +0100 |
---|---|---|
committer | Jamie Mansfield <jmansfield@cadixdev.org> | 2022-04-02 13:53:44 +0100 |
commit | 7f2615b2a5473064472cde9d5da739e6a27667ab (patch) | |
tree | 10a4d7bfc09e2ad47de72871de145fcc2a5e25a3 | |
parent | a232c2d50994d1e16b34ee84fbc24dcca80a4d9e (diff) | |
download | PrismLauncher-7f2615b2a5473064472cde9d5da739e6a27667ab.tar.gz PrismLauncher-7f2615b2a5473064472cde9d5da739e6a27667ab.tar.bz2 PrismLauncher-7f2615b2a5473064472cde9d5da739e6a27667ab.zip |
Technic: Verify checksums for pack build mods
-rw-r--r-- | launcher/modplatform/technic/SolderPackInstallTask.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/launcher/modplatform/technic/SolderPackInstallTask.cpp b/launcher/modplatform/technic/SolderPackInstallTask.cpp index abdfcd9e..89dbf4ca 100644 --- a/launcher/modplatform/technic/SolderPackInstallTask.cpp +++ b/launcher/modplatform/technic/SolderPackInstallTask.cpp @@ -42,6 +42,7 @@ #include "TechnicPackProcessor.h" #include "SolderPackManifest.h" +#include "net/ChecksumValidator.h" Technic::SolderPackInstallTask::SolderPackInstallTask( shared_qobject_ptr<QNetworkAccessManager> network, @@ -110,7 +111,14 @@ void Technic::SolderPackInstallTask::fileListSucceeded() int i = 0; for (const auto &mod : build.mods) { auto path = FS::PathCombine(m_outputDir.path(), QString("%1").arg(i)); - m_filesNetJob->addNetAction(Net::Download::makeFile(mod.url, path)); + + auto dl = Net::Download::makeFile(mod.url, path); + if (!mod.md5.isEmpty()) { + auto rawMd5 = QByteArray::fromHex(mod.md5.toLatin1()); + dl->addValidator(new Net::ChecksumValidator(QCryptographicHash::Md5, rawMd5)); + } + m_filesNetJob->addNetAction(dl); + i++; } |