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

This commit is contained in:
yflory
2017-04-25 17:22:07 +02:00
12 changed files with 74 additions and 17 deletions

View File

@@ -139,6 +139,49 @@ define([
strungJSON(orig);
});
// check that old hashes parse correctly
assert(function () {
var secret = Cryptpad.parseHash('67b8385b07352be53e40746d2be6ccd7XAYSuJYYqa9NfmInyHci7LNy');
return secret.channel === "67b8385b07352be53e40746d2be6ccd7" &&
secret.key === "XAYSuJYYqa9NfmInyHci7LNy" &&
secret.version === 0;
}, "Old hash failed to parse");
// make sure version 1 hashes parse correctly
assert(function () {
var secret = Cryptpad.parseHash('/1/edit/3Ujt4F2Sjnjbis6CoYWpoQ/usn4+9CqVja8Q7RZOGTfRgqI');
return secret.version === 1 &&
secret.mode === "edit" &&
secret.channel === "3Ujt4F2Sjnjbis6CoYWpoQ" &&
secret.key === "usn4+9CqVja8Q7RZOGTfRgqI" &&
!secret.present;
}, "version 1 hash failed to parse");
// test support for present mode in hashes
assert(function () {
var secret = Cryptpad.parseHash('/1/edit/CmN5+YJkrHFS3NSBg-P7Sg/DNZ2wcG683GscU4fyOyqA87G/present');
return secret.version === 1
&& secret.mode === "edit"
&& secret.channel === "CmN5+YJkrHFS3NSBg-P7Sg"
&& secret.key === "DNZ2wcG683GscU4fyOyqA87G"
&& secret.present;
}, "version 1 hash failed to parse");
// test support for trailing slash
assert(function () {
var secret = Cryptpad.parseHash('/1/edit/3Ujt4F2Sjnjbis6CoYWpoQ/usn4+9CqVja8Q7RZOGTfRgqI/');
return secret.version === 1 &&
secret.mode === "edit" &&
secret.channel === "3Ujt4F2Sjnjbis6CoYWpoQ" &&
secret.key === "usn4+9CqVja8Q7RZOGTfRgqI" &&
!secret.present;
}, "test support for trailing slashes in version 1 hash failed to parse");
assert(function () {
// TODO
return true;
}, "version 2 hash failed to parse correctly");
var swap = function (str, dict) {
return str.replace(/\{\{(.*?)\}\}/g, function (all, key) {
return typeof dict[key] !== 'undefined'? dict[key] : all;

View File

@@ -1189,6 +1189,11 @@ define([
if (typeof(window.Proxy) === 'undefined') {
feedback("NO_PROXIES");
}
if (typeof(Array.isArray) === 'function') {
feedback("NO_ISARRAY");
}
$(function() {
// Race condition : if document.body is undefined when alertify.js is loaded, Alertify
// won't work. We have to reset it now to make sure it uses a correct "body"

View File

@@ -45,7 +45,6 @@ define([
};
Toolbar.create($bar, null, null, null, null, configTb);
});
};
Cryptpad.ready(function (err, anv) {