Fix images in onlyoffice

pull/1/head
yflory 5 years ago
parent b76d308db8
commit 7b026868fd

@ -674,6 +674,11 @@ define([
case "saveChanges":
// We're sending our changes to netflux
handleChanges(obj, send);
// If we're alone, clean up the medias
var m = metadataMgr.getChannelMembers().slice().filter(function (nId) {
return nId.length === 32;
});
if (m.length === 1 && !APP.loadingImage) {
try {
var docs = window.frames[0].AscCommon.g_oDocumentUrls.urls || {};
var mediasSources = getMediasSources();
@ -684,6 +689,7 @@ define([
});
APP.onLocal();
} catch (e) {}
}
break;
case "unLockDocument":
if (obj.releaseLocks && content.locks && content.locks[getId()]) {
@ -829,6 +835,7 @@ define([
});
};
APP.loadingImage = 0;
APP.getImageURL = function(name, callback) {
var mediasSources = getMediasSources();
var data = mediasSources[name];
@ -844,10 +851,16 @@ define([
return void callback(blobUrl);
}
APP.loadingImage++;
Util.fetch(data.src, function (err, u8) {
if (err) {
APP.loadingImage--;
return void console.error(err);
}
try {
debug("Decrypt with key " + data.key);
FileCrypto.decrypt(u8, Nacl.util.decodeBase64(data.key), function (err, res) {
APP.loadingImage--;
if (err || !res.content) {
debug("Decrypting failed");
return void callback("");
@ -868,6 +881,7 @@ define([
callback(blobUrl);
});
} catch (e) {
APP.loadingImage--;
debug("Exception decrypting image " + data.name);
console.error(e);
callback("");

Loading…
Cancel
Save