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

pull/1/head
yflory 8 years ago
commit 2a417ddae8

@ -0,0 +1,7 @@
[ignore]
[include]
[libs]
[options]

@ -9,4 +9,4 @@ server.js
NetFluxWebsocketSrv.js NetFluxWebsocketSrv.js
NetFluxWebsocketServer.js NetFluxWebsocketServer.js
WebRTCSrv.js WebRTCSrv.js
www/common/media-tag.js

@ -12,7 +12,7 @@ node_js:
- "6.6.0" - "6.6.0"
before_script: before_script:
- npm run-script lint - npm run-script lint
- cp config.js.dist config.js - cp config.example.js config.js
- npm install bower - npm install bower
- ./node_modules/bower/bin/bower install - ./node_modules/bower/bin/bower install
- node ./server.js & - node ./server.js &

@ -76,7 +76,7 @@ Chainpad can handle out of order messages, but it performs best when its message
By architecting your system such that all clients send to a server which then relays to other clients, you guarantee that a particular chain of patches is consistent between the participants of your session. By architecting your system such that all clients send to a server which then relays to other clients, you guarantee that a particular chain of patches is consistent between the participants of your session.
Cryptpad is capable of using a variety of data stores. Cryptpad is capable of using a variety of data stores.
Which data store your instance employs can be [easily configured](https://github.com/xwiki-labs/cryptpad/blob/master/config.js.dist). Which data store your instance employs can be [easily configured](https://github.com/xwiki-labs/cryptpad/blob/master/config.example.js).
You simply need to write an adaptor which conforms to a simple API. You simply need to write an adaptor which conforms to a simple API.
The documentation for writing such an adaptor, and the complete list of implemented adaptors, is available [here](https://github.com/xwiki-labs/cryptpad/tree/master/storage). The documentation for writing such an adaptor, and the complete list of implemented adaptors, is available [here](https://github.com/xwiki-labs/cryptpad/tree/master/storage).
@ -243,5 +243,3 @@ A session could still have difficulty with very large chains, however, in practi
## Conclusion ## Conclusion

@ -1,3 +1,4 @@
/*@flow*/
/* /*
globals module globals module
*/ */

@ -4,7 +4,7 @@
mkdir -p customize mkdir -p customize
[ -z "$(ls -A customize)" ] && echo "Creating customize folder" \ [ -z "$(ls -A customize)" ] && echo "Creating customize folder" \
&& cp -R customize.dist/* customize/ \ && cp -R customize.dist/* customize/ \
&& cp config.js.dist customize/config.js && cp config.example.js customize/config.js
# Linking config.js # Linking config.js
[ ! -h config.js ] && echo "Linking config.js" && ln -s customize/config.js config.js [ ! -h config.js ] && echo "Linking config.js" && ln -s customize/config.js config.js

@ -32,8 +32,8 @@ npm install
npm install -g bower ## if necessary npm install -g bower ## if necessary
bower install bower install
## copy config.js.dist to config.js ## copy config.example.js to config.js
cp config.js.dist config.js cp config.example.js config.js
node ./server.js node ./server.js
``` ```
@ -162,4 +162,3 @@ sales@xwiki.com
[fragment identifier]: https://en.wikipedia.org/wiki/Fragment_identifier [fragment identifier]: https://en.wikipedia.org/wiki/Fragment_identifier
[active attack]: https://en.wikipedia.org/wiki/Attack_(computing)#Types_of_attacks [active attack]: https://en.wikipedia.org/wiki/Attack_(computing)#Types_of_attacks
[Creative Commons Attribution 2.5 License]: http://creativecommons.org/licenses/by/2.5/ [Creative Commons Attribution 2.5 License]: http://creativecommons.org/licenses/by/2.5/

@ -1,3 +1,4 @@
/*@flow*/
/* Use Nacl for checking signatures of messages */ /* Use Nacl for checking signatures of messages */
var Nacl = require("tweetnacl"); var Nacl = require("tweetnacl");
@ -375,7 +376,8 @@ var resetUserPins = function (store, Sessions, publicKey, channelList, cb) {
}); });
}; };
RPC.create = function (config, cb) { /*::const ConfigType = require('./config.example.js');*/
RPC.create = function (config /*:typeof(ConfigType)*/, cb /*:(?Error, ?Function)=>void*/) {
// load pin-store... // load pin-store...
console.log('loading rpc module...'); console.log('loading rpc module...');
@ -384,7 +386,11 @@ RPC.create = function (config, cb) {
var store; var store;
var rpc = function (ctx, data, respond) { var rpc = function (
ctx /*:{ store: Object }*/,
data /*:Array<Array<any>>*/,
respond /*:(?string, ?Array<any>)=>void*/)
{
if (!Array.isArray(data)) { if (!Array.isArray(data)) {
return void respond('INVALID_ARG_FORMAT'); return void respond('INVALID_ARG_FORMAT');
} }
@ -494,4 +500,3 @@ RPC.create = function (config, cb) {
}, 60000); }, 60000);
}); });
}; };

@ -46,14 +46,14 @@ While we migrate to our new Netflux API, only the leveldb adaptor will be suppor
## removeChannel(channelName, callback) ## removeChannel(channelName, callback)
This method is called (optionally, see config.js.dist for more info) some amount of time after the last client in a channel disconnects. This method is called (optionally, see config.example.js for more info) some amount of time after the last client in a channel disconnects.
It should remove any history of that channel, and execute a callback which takes an error message as an argument. It should remove any history of that channel, and execute a callback which takes an error message as an argument.
## Documenting your adaptor ## Documenting your adaptor
Naturally, you should comment your code well before making a PR. Naturally, you should comment your code well before making a PR.
Failing that, you should definitely add notes to `cryptpad/config.js.dist` such that people who wish to install your adaptor know how to do so. Failing that, you should definitely add notes to `cryptpad/config.example.js` such that people who wish to install your adaptor know how to do so.
Notes on how to install the back end, as well as how to install the client for connecting to the back end (as is the case with many datastores), as well as how to configure cryptpad to use your adaptor. Notes on how to install the back end, as well as how to install the client for connecting to the back end (as is the case with many datastores), as well as how to configure cryptpad to use your adaptor.
The current configuration file should serve as an example of what to add, and how to comment. The current configuration file should serve as an example of what to add, and how to comment.

@ -139,6 +139,49 @@ define([
strungJSON(orig); 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) { var swap = function (str, dict) {
return str.replace(/\{\{(.*?)\}\}/g, function (all, key) { return str.replace(/\{\{(.*?)\}\}/g, function (all, key) {
return typeof dict[key] !== 'undefined'? dict[key] : all; return typeof dict[key] !== 'undefined'? dict[key] : all;

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

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

Loading…
Cancel
Save