diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2019-12-03 23:34:16 +0100 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2019-12-03 23:34:16 +0100 |
commit | 5bfdaff7780bc4299c3edab85c688eebf21f7d4e (patch) | |
tree | cf558f40eb7953a890cb03df98bcecc52d288e6c /src/MxcImageProvider.cpp | |
parent | a689118d71000adba36de19e8ad022ec69695627 (diff) |
Implement decryption of images
It is a bit of a hack, but it works...
Diffstat (limited to 'src/MxcImageProvider.cpp')
-rw-r--r-- | src/MxcImageProvider.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/MxcImageProvider.cpp b/src/MxcImageProvider.cpp index 556b019b..edf6ceb5 100644 --- a/src/MxcImageProvider.cpp +++ b/src/MxcImageProvider.cpp @@ -5,7 +5,7 @@ void MxcImageResponse::run() { - if (m_requestedSize.isValid()) { + if (m_requestedSize.isValid() && !m_encryptionInfo) { QString fileName = QString("%1_%2x%3_crop") .arg(m_id) .arg(m_requestedSize.width()) @@ -65,7 +65,12 @@ MxcImageResponse::run() return; } - auto data = QByteArray(res.data(), res.size()); + auto temp = res; + if (m_encryptionInfo) + temp = mtx::crypto::to_string( + mtx::crypto::decrypt_file(temp, m_encryptionInfo.value())); + + auto data = QByteArray(temp.data(), temp.size()); m_image.loadFromData(data); m_image.setText("original filename", QString::fromStdString(originalFilename)); |