Fix e2e attachment download by using iframes. (#562)

* Render attachments inside iframes.

* Fix up the image and video views

* Fix m.audio

* Comments, and only use the cross domain renderer if the attachment is encrypted

* Fix whitespace

* Don't decrypt file attachments immediately

* Use https://usercontent.riot.im/v1.html by default

* typos

* Put the config in the React context.

Use it in MFileBody to configure the cross origin renderer URL.

* Call it appConfig in the context

* Return the promises so they don't get dropped
This commit is contained in:
Mark Haines 2016-12-02 14:21:07 +00:00 committed by GitHub
parent 0a42a78b13
commit 81e429eb14
6 changed files with 253 additions and 85 deletions

View file

@ -27,7 +27,7 @@ import q from 'q';
* Read blob as a data:// URI.
* @return {Promise} A promise that resolves with the data:// URI.
*/
function readBlobAsDataUri(file) {
export function readBlobAsDataUri(file) {
var deferred = q.defer();
var reader = new FileReader();
reader.onload = function(e) {
@ -62,6 +62,6 @@ export function decryptFile(file) {
}).then(function(dataArray) {
// Turn the array into a Blob and give it the correct MIME-type.
var blob = new Blob([dataArray], {type: file.mimetype});
return readBlobAsDataUri(blob);
return blob;
});
}