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

pull/1/head
yflory 8 years ago
commit 771348720b

@ -211,6 +211,15 @@ module.exports = {
*/ */
restrictUploads: true, restrictUploads: true,
/* clients can use the /settings/ app to opt out of usage feedback
* which informs the server of things like how much each app is being
* used, and whether certain clientside features are supported by
* the client's browser. The intent is to provide feedback to the admin
* such that the service can be improved. Enable this with `true`
* and ignore feedback with `false` or by commenting the attribute
*/
//logFeedback: true,
/* it is recommended that you serve cryptpad over https /* it is recommended that you serve cryptpad over https
* the filepaths below are used to configure your certificates * the filepaths below are used to configure your certificates
*/ */

@ -153,50 +153,50 @@ define([
// check that old hashes parse correctly // check that old hashes parse correctly
assert(function (cb) { assert(function (cb) {
var secret = Cryptpad.parseHash('67b8385b07352be53e40746d2be6ccd7XAYSuJYYqa9NfmInyHci7LNy'); var secret = Cryptpad.parsePadUrl('/pad/#67b8385b07352be53e40746d2be6ccd7XAYSuJYYqa9NfmInyHci7LNy');
return cb(secret.channel === "67b8385b07352be53e40746d2be6ccd7" && return cb(secret.hashData.channel === "67b8385b07352be53e40746d2be6ccd7" &&
secret.key === "XAYSuJYYqa9NfmInyHci7LNy" && secret.hashData.key === "XAYSuJYYqa9NfmInyHci7LNy" &&
secret.version === 0); secret.hashData.version === 0);
}, "Old hash failed to parse"); }, "Old hash failed to parse");
// make sure version 1 hashes parse correctly // make sure version 1 hashes parse correctly
assert(function (cb) { assert(function (cb) {
var secret = Cryptpad.parseHash('/1/edit/3Ujt4F2Sjnjbis6CoYWpoQ/usn4+9CqVja8Q7RZOGTfRgqI'); var secret = Cryptpad.parsePadUrl('/pad/#/1/edit/3Ujt4F2Sjnjbis6CoYWpoQ/usn4+9CqVja8Q7RZOGTfRgqI');
return cb(secret.version === 1 && return cb(secret.hashData.version === 1 &&
secret.mode === "edit" && secret.hashData.mode === "edit" &&
secret.channel === "3Ujt4F2Sjnjbis6CoYWpoQ" && secret.hashData.channel === "3Ujt4F2Sjnjbis6CoYWpoQ" &&
secret.key === "usn4+9CqVja8Q7RZOGTfRgqI" && secret.hashData.key === "usn4+9CqVja8Q7RZOGTfRgqI" &&
!secret.present); !secret.hashData.present);
}, "version 1 hash failed to parse"); }, "version 1 hash (without present mode) failed to parse");
// test support for present mode in hashes // test support for present mode in hashes
assert(function (cb) { assert(function (cb) {
var secret = Cryptpad.parseHash('/1/edit/CmN5+YJkrHFS3NSBg-P7Sg/DNZ2wcG683GscU4fyOyqA87G/present'); var secret = Cryptpad.parsePadUrl('/pad/#/1/edit/CmN5+YJkrHFS3NSBg-P7Sg/DNZ2wcG683GscU4fyOyqA87G/present');
return cb(secret.version === 1 return cb(secret.hashData.version === 1
&& secret.mode === "edit" && secret.hashData.mode === "edit"
&& secret.channel === "CmN5+YJkrHFS3NSBg-P7Sg" && secret.hashData.channel === "CmN5+YJkrHFS3NSBg-P7Sg"
&& secret.key === "DNZ2wcG683GscU4fyOyqA87G" && secret.hashData.key === "DNZ2wcG683GscU4fyOyqA87G"
&& secret.present); && secret.hashData.present);
}, "version 1 hash failed to parse"); }, "version 1 hash failed to parse");
// test support for present mode in hashes // test support for present mode in hashes
assert(function (cb) { assert(function (cb) {
var secret = Cryptpad.parseHash('/1/edit//CmN5+YJkrHFS3NSBg-P7Sg/DNZ2wcG683GscU4fyOyqA87G//present'); var secret = Cryptpad.parsePadUrl('/pad/#/1/edit//CmN5+YJkrHFS3NSBg-P7Sg/DNZ2wcG683GscU4fyOyqA87G//present');
return cb(secret.version === 1 return cb(secret.hashData.version === 1
&& secret.mode === "edit" && secret.hashData.mode === "edit"
&& secret.channel === "CmN5+YJkrHFS3NSBg-P7Sg" && secret.hashData.channel === "CmN5+YJkrHFS3NSBg-P7Sg"
&& secret.key === "DNZ2wcG683GscU4fyOyqA87G" && secret.hashData.key === "DNZ2wcG683GscU4fyOyqA87G"
&& secret.present); && secret.hashData.present);
}, "Couldn't handle multiple successive slashes"); }, "Couldn't handle multiple successive slashes");
// test support for trailing slash // test support for trailing slash
assert(function (cb) { assert(function (cb) {
var secret = Cryptpad.parseHash('/1/edit/3Ujt4F2Sjnjbis6CoYWpoQ/usn4+9CqVja8Q7RZOGTfRgqI/'); var secret = Cryptpad.parsePadUrl('/pad/#/1/edit/3Ujt4F2Sjnjbis6CoYWpoQ/usn4+9CqVja8Q7RZOGTfRgqI/');
return cb(secret.version === 1 && return cb(secret.hashData.version === 1 &&
secret.mode === "edit" && secret.hashData.mode === "edit" &&
secret.channel === "3Ujt4F2Sjnjbis6CoYWpoQ" && secret.hashData.channel === "3Ujt4F2Sjnjbis6CoYWpoQ" &&
secret.key === "usn4+9CqVja8Q7RZOGTfRgqI" && secret.hashData.key === "usn4+9CqVja8Q7RZOGTfRgqI" &&
!secret.present); !secret.hashData.present);
}, "test support for trailing slashes in version 1 hash failed to parse"); }, "test support for trailing slashes in version 1 hash failed to parse");
assert(function (cb) { assert(function (cb) {

@ -10,5 +10,13 @@ define([], function () {
"json.sortify": "/bower_components/json.sortify/dist/JSON.sortify" "json.sortify": "/bower_components/json.sortify/dist/JSON.sortify"
} }
}); });
// most of CryptPad breaks if you don't support isArray
if (!Array.isArray) {
Array.isArray = function(arg) { // CRYPTPAD_SHIM
return Object.prototype.toString.call(arg) === '[object Array]';
};
}
require([document.querySelector('script[data-bootload]').getAttribute('data-bootload')]); require([document.querySelector('script[data-bootload]').getAttribute('data-bootload')]);
}); });

@ -58,7 +58,7 @@ Version 1
if (hash.slice(0,1) !== '/' && hash.length >= 56) { if (hash.slice(0,1) !== '/' && hash.length >= 56) {
// Old hash // Old hash
parsed.channel = hash.slice(0, 32); parsed.channel = hash.slice(0, 32);
parsed.key = hash.slice(32); parsed.key = hash.slice(32, 56);
parsed.version = 0; parsed.version = 0;
return parsed; return parsed;
} }

@ -1270,7 +1270,7 @@ define([
feedback("NO_PROXIES"); feedback("NO_PROXIES");
} }
if (typeof(Array.isArray) !== 'function') { if (!/CRYPTPAD_SHIM/.test(Array.isArray.toString())) {
feedback("NO_ISARRAY"); feedback("NO_ISARRAY");
} }

Loading…
Cancel
Save