little flowey

This commit is contained in:
Caleb James DeLisle 2017-04-25 16:04:17 +02:00
parent 5194677443
commit 211113fb1a
8 changed files with 25 additions and 15 deletions

7
.flowconfig Normal file
View File

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

View File

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

View File

@ -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.
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.
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

View File

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

View File

@ -4,12 +4,12 @@
mkdir -p customize
[ -z "$(ls -A customize)" ] && echo "Creating customize folder" \
&& 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
# Configure
# Configure
[ -n "$USE_SSL" ] && echo "Using secure websockets: $USE_SSL" \
&& sed -i "s/useSecureWebsockets: .*/useSecureWebsockets: ${USE_SSL},/g" customize/config.js

View File

@ -32,8 +32,8 @@ npm install
npm install -g bower ## if necessary
bower install
## copy config.js.dist to config.js
cp config.js.dist config.js
## copy config.example.js to config.js
cp config.example.js config.js
node ./server.js
```
@ -162,4 +162,3 @@ sales@xwiki.com
[fragment identifier]: https://en.wikipedia.org/wiki/Fragment_identifier
[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/

11
rpc.js
View File

@ -1,3 +1,4 @@
/*@flow*/
/* Use Nacl for checking signatures of messages */
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...
console.log('loading rpc module...');
@ -384,7 +386,11 @@ RPC.create = function (config, cb) {
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)) {
return void respond('INVALID_ARG_FORMAT');
}
@ -494,4 +500,3 @@ RPC.create = function (config, cb) {
}, 60000);
});
};

View File

@ -46,14 +46,14 @@ While we migrate to our new Netflux API, only the leveldb adaptor will be suppor
## 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.
## Documenting your adaptor
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.
The current configuration file should serve as an example of what to add, and how to comment.