Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging
This commit is contained in:
@@ -22,6 +22,7 @@ define([
|
||||
http.send();
|
||||
};
|
||||
Feedback.send = function (action, force, cb) {
|
||||
if (typeof(cb) !== 'function') { cb = function () {}; }
|
||||
if (AppConfig.disableFeedback) { return void cb(); }
|
||||
if (!action) { return void cb(); }
|
||||
if (force !== true) {
|
||||
|
||||
@@ -76,9 +76,10 @@ define([
|
||||
return s.replace(/\/+/g, '/');
|
||||
};
|
||||
|
||||
Hash.createChannelId = function () {
|
||||
var id = uint8ArrayToHex(Crypto.Nacl.randomBytes(16));
|
||||
if (id.length !== 32 || /[^a-f0-9]/.test(id)) {
|
||||
Hash.ephemeralChannelLength = 34;
|
||||
Hash.createChannelId = function (ephemeral) {
|
||||
var id = uint8ArrayToHex(Crypto.Nacl.randomBytes(ephemeral? 17: 16));
|
||||
if ([32, 34].indexOf(id.length) === -1 || /[^a-f0-9]/.test(id)) {
|
||||
throw new Error('channel ids must consist of 32 hex characters');
|
||||
}
|
||||
return id;
|
||||
|
||||
@@ -1112,11 +1112,11 @@ define([
|
||||
};
|
||||
|
||||
common.isWebRTCSupported = function () {
|
||||
return navigator.getUserMedia ||
|
||||
return Boolean(navigator.getUserMedia ||
|
||||
navigator.webkitGetUserMedia ||
|
||||
navigator.mozGetUserMedia ||
|
||||
navigator.msGetUserMedia ||
|
||||
window.RTCPeerConnection;
|
||||
window.RTCPeerConnection);
|
||||
};
|
||||
|
||||
common.ready = (function () {
|
||||
|
||||
@@ -958,12 +958,20 @@ define([
|
||||
history: [],
|
||||
pushHistory: function (msg, isCp) {
|
||||
if (isCp) {
|
||||
// the current message is a checkpoint.
|
||||
// push it to your worker's history, prepending it with cp|
|
||||
// cp| and anything else related to checkpoints has already
|
||||
// been stripped by chainpad-netflux-worker or within async store
|
||||
// when the message was outgoing.
|
||||
channel.history.push('cp|' + msg);
|
||||
// since the latest message is a checkpoint, we are able to drop
|
||||
// some of the older history, but we can't rely on checkpoints being
|
||||
// correct, as they might be checkpoints from different forks
|
||||
var i;
|
||||
for (i = channel.history.length - 2; i > 0; i--) {
|
||||
for (i = channel.history.length - 101; i > 0; i--) {
|
||||
if (/^cp\|/.test(channel.history[i])) { break; }
|
||||
}
|
||||
channel.history = channel.history.slice(i);
|
||||
channel.history = channel.history.slice(Math.max(i, 0));
|
||||
return;
|
||||
}
|
||||
channel.history.push(msg);
|
||||
|
||||
@@ -197,7 +197,10 @@ define([
|
||||
};
|
||||
funcs.openCursorChannel = function (saveChanges) {
|
||||
var md = JSON.parse(JSON.stringify(ctx.metadataMgr.getMetadata()));
|
||||
var channel = md.cursor || Hash.createChannelId();
|
||||
var channel = md.cursor;
|
||||
if (typeof(channel) !== 'string' || channel.length !== Hash.ephemeralChannelLength) {
|
||||
channel = Hash.createChannelId(true); // true indicates that it's an ephemeral channel
|
||||
}
|
||||
if (!md.cursor) {
|
||||
md.cursor = channel;
|
||||
ctx.metadataMgr.updateMetadata(md);
|
||||
|
||||
@@ -452,8 +452,8 @@ define([
|
||||
var $iframe = $('html').find('iframe').contents();
|
||||
var ifrWindow = $html.find('iframe')[0].contentWindow;
|
||||
|
||||
var customCss = '/customize/ckeditor-contents.css?' + CKEDITOR.CRYPTPAD_URLARGS;
|
||||
$iframe.find('head').append('<link href="' + customCss + '" type="text/css" rel="stylesheet" _fcktemp="true"/>')
|
||||
var customCss = '/customize/ckeditor-contents.css?' + window.CKEDITOR.CRYPTPAD_URLARGS;
|
||||
$iframe.find('head').append('<link href="' + customCss + '" type="text/css" rel="stylesheet" _fcktemp="true"/>');
|
||||
|
||||
framework._.sfCommon.addShortcuts(ifrWindow);
|
||||
|
||||
|
||||
@@ -930,6 +930,7 @@ define([
|
||||
$(cancel).click(function () {
|
||||
UI.confirm(Messages.settings_exportCancel, function (yes) {
|
||||
if (!yes) { return; }
|
||||
Feedback.send('FULL_DRIVE_EXPORT_CANCEL');
|
||||
_onCancel.forEach(function (h) { h(); });
|
||||
});
|
||||
}).appendTo(actions);
|
||||
@@ -1078,6 +1079,7 @@ define([
|
||||
|
||||
// Backup all the pads
|
||||
var exportDrive = function () {
|
||||
Feedback.send('FULL_DRIVE_EXPORT_START');
|
||||
var todo = function (data, filename) {
|
||||
var getPad = function (data, cb) {
|
||||
sframeChan.query("Q_CRYPTGET", data, function (err, obj) {
|
||||
@@ -1094,6 +1096,7 @@ define([
|
||||
saveAs(blob, filename);
|
||||
sframeChan.event('EV_CRYPTGET_DISCONNECT');
|
||||
ui.complete(function () {
|
||||
Feedback.send('FULL_DRIVE_EXPORT_COMPLETE');
|
||||
saveAs(blob, filename);
|
||||
}, errors);
|
||||
}, ui.update);
|
||||
|
||||
Reference in New Issue
Block a user