summary refs log tree commit diff
path: root/src/MxcImageProvider.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2019-12-03 23:34:16 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2019-12-03 23:34:16 +0100
commit5bfdaff7780bc4299c3edab85c688eebf21f7d4e (patch)
treecf558f40eb7953a890cb03df98bcecc52d288e6c /src/MxcImageProvider.cpp
parentlint (diff)
downloadnheko-5bfdaff7780bc4299c3edab85c688eebf21f7d4e.tar.xz
Implement decryption of images
It is a bit of a hack, but it works...
Diffstat (limited to '')
-rw-r--r--src/MxcImageProvider.cpp9
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));