Fix alertify logs in secureiframe

This commit is contained in:
yflory 2021-01-19 16:58:56 +01:00
parent 00e084f5ad
commit d223261776
3 changed files with 18 additions and 0 deletions

View File

@ -659,7 +659,16 @@ define([
// Put in the following function the RPC queries that should also work in filepicker
var _sframeChan = sframeChan;
var addCommonRpc = function (sframeChan, safe) {
// Send UI.log and UI.warn commands from the secureiframe to the normal iframe
sframeChan.on('EV_ALERTIFY_LOG', function (msg) {
_sframeChan.event('EV_ALERTIFY_LOG', msg);
});
sframeChan.on('EV_ALERTIFY_WARN', function (msg) {
_sframeChan.event('EV_ALERTIFY_WARN', msg);
});
Cryptpad.universal.onEvent.reg(function (data) {
sframeChan.event('EV_UNIVERSAL_EVENT', data);
});

View File

@ -851,6 +851,14 @@ define([
Feedback.init(feedback);
} catch (e) { Feedback.init(false); }
if (privateData.secureIframe) {
UI.log = function (msg) { ctx.sframeChan.event('EV_ALERTIFY_LOG', msg); };
UI.warn = function (msg) { ctx.sframeChan.event('EV_ALERTIFY_WARN', msg); };
} else {
ctx.sframeChan.on('EV_ALERTIFY_LOG', function (msg) { UI.log(msg); });
ctx.sframeChan.on('EV_ALERTIFY_WARN', function (msg) { UI.warn(msg); });
}
try {
var forbidden = privateData.disabledApp;
if (forbidden) {

View File

@ -102,6 +102,7 @@ define([
password: config.data.password,
isTemplate: isTemplate,
file: config.data.file,
secureIframe: true,
};
for (var k in additionalPriv) { metaObj.priv[k] = additionalPriv[k]; }