Merge branch 'pad2' of github.com:xwiki-labs/cryptpad into pad2

This commit is contained in:
yflory
2017-08-22 18:19:06 +02:00
10 changed files with 56 additions and 22 deletions

View File

@@ -2,7 +2,7 @@
define([
'/common/requireconfig.js'
], function (RequireConfig) {
require.config(RequireConfig);
require.config(RequireConfig());
// most of CryptPad breaks if you don't support isArray
if (!Array.isArray) {

View File

@@ -21,5 +21,7 @@ define([
}
};
Object.keys(ApiConfig.requireConf).forEach(function (k) { out[k] = ApiConfig.requireConf[k]; });
return out;
return function () {
return JSON.parse(JSON.stringify(out));
};
});

View File

@@ -2,20 +2,18 @@
// Note that this file is meant to be executed only inside of a sandbox iframe.
;(function () {
var req = JSON.parse(decodeURIComponent(window.location.hash.substring(1)));
if (req.cfg) { require.config(req.cfg); }
req.cfg = req.cfg || {};
if (req.pfx) {
require.config({
onNodeCreated: function (node, config, module, path) {
node.setAttribute('src', req.pfx + node.getAttribute('src'));
}
});
req.cfg.onNodeCreated = function (node, config, module, path) {
node.setAttribute('src', req.pfx + node.getAttribute('src'));
};
}
require.config(req.cfg);
if (req.req) { require(req.req, function () { }); }
window.addEventListener('message', function (msg) {
var data = JSON.parse(msg.data);
if (data.q !== 'INIT') { return; }
msg.source.postMessage(JSON.stringify({ txid: data.txid, content: 'OK' }), '*');
if (data.content && data.content.requireConf) { require.config(data.content.requireConf); }
require(['/common/sframe-boot2.js'], function () { });
});
}());

View File

@@ -1,7 +1,7 @@
// This is stage 1, it can be changed but you must bump the version of the project.
// Note: This must only be loaded from inside of a sandbox-iframe.
define(['/common/requireconfig.js'], function (RequireConfig) {
require.config(RequireConfig);
require.config(RequireConfig());
// most of CryptPad breaks if you don't support isArray
if (!Array.isArray) {

View File

@@ -145,7 +145,7 @@ define([
intr = setInterval(function () {
ow.postMessage(JSON.stringify({
txid: txid,
content: { requireConf: RequireConfig },
content: { requireConf: RequireConfig() },
q: 'INIT'
}), '*');
}, 1);

View File

@@ -606,7 +606,7 @@ define([
title: buttonTitle,
'class': "cryptpad-logo"
}).append($('<img>', {
src: '/customize/images/logo_white.png'
src: '/customize/images/logo_white.png?' + ApiConfig.requireConf.urlArgs
}));
var onClick = function (e) {
e.preventDefault();