diff --git a/.gitignore b/.gitignore index aa661d690..fe33e3f97 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ www/bower_components/* node_modules /config.js +customization diff --git a/ChainPadSrv.js b/ChainPadSrv.js index 178f70d25..865be9036 100644 --- a/ChainPadSrv.js +++ b/ChainPadSrv.js @@ -142,14 +142,14 @@ console.log("[" + userPass + "] registered"); var sendMsgs = function () { sendChannelMessage(ctx, chan, msg, function () { chan.push(client); - try { - ctx.store.getMessages(chan.name, function (msg) { + ctx.store.getMessages(chan.name, function (msg) { + try { sendMsg(msg, socket); - }); - } catch (e) { - console.log(e.stack); - try { socket.close(); } catch (e) { } - } + } catch (e) { + console.log(e.stack); + try { socket.close(); } catch (e) { } + } + }); }); }; if (newChan) { diff --git a/bower.json b/bower.json index 34511bc3e..f80f16fb4 100644 --- a/bower.json +++ b/bower.json @@ -18,6 +18,7 @@ "tests" ], "dependencies": { + "markdown": "~0.5.0", "jquery.sheet": "master", "jquery": "~2.1.3", "tweetnacl": "~0.12.2", diff --git a/customize.dist/DecorateToolbar.js b/customize.dist/DecorateToolbar.js new file mode 100644 index 000000000..6481966d7 --- /dev/null +++ b/customize.dist/DecorateToolbar.js @@ -0,0 +1,7 @@ +define([ + '/bower_components/jquery/dist/jquery.min.js' +], function ($) { + var main = function ($toolbar) { + $toolbar.append('

Made With in Paris

') + Dt.main($('.rtwysiwyg-toolbar-rightside')); +}); diff --git a/customize.dist/fr.png b/customize.dist/fr.png new file mode 100755 index 000000000..8332c4ec2 Binary files /dev/null and b/customize.dist/fr.png differ diff --git a/customize.dist/france.png b/customize.dist/france.png new file mode 100644 index 000000000..8332c4ec2 Binary files /dev/null and b/customize.dist/france.png differ diff --git a/customize.dist/heart.png b/customize.dist/heart.png new file mode 100644 index 000000000..d9ee53e59 Binary files /dev/null and b/customize.dist/heart.png differ diff --git a/www/index.css b/customize.dist/index.css similarity index 100% rename from www/index.css rename to customize.dist/index.css diff --git a/www/index.html b/customize.dist/index.html similarity index 84% rename from www/index.html rename to customize.dist/index.html index ce3cbc7a6..c0679045c 100644 --- a/www/index.html +++ b/customize.dist/index.html @@ -3,7 +3,7 @@ - + - Fork me on GitHub + Fork me on GitHub
-

Unity is Strength - Collaboration is Key

+

CryptPad: Unity is Strength - Collaboration is Key

CryptPad is the zero knowledge realtime collaborative editor. Encryption carried out in your web browser protects the data from the server, the cloud and the NSA. This project uses the CKEditor Visual Editor and the ChainPad realtime diff --git a/customize.dist/pad.js b/customize.dist/pad.js new file mode 100644 index 000000000..48d6044d5 --- /dev/null +++ b/customize.dist/pad.js @@ -0,0 +1,6 @@ +require([ + '/customize/DecorateToolbar.js', + '/bower_components/jquery/dist/jquery.min.js' +], function (Dt, $) { + Dt.main($('.rtwysiwyg-toolbar-rightside')); +}); diff --git a/customize.dist/readme.md b/customize.dist/readme.md new file mode 100644 index 000000000..8f67926da --- /dev/null +++ b/customize.dist/readme.md @@ -0,0 +1,18 @@ +# Customizing CryptPad + +In order allow the content of the main page to be changed and to allow site-specific changes +to the pad and sheet while still keeping the git repository pristine, this directory exists +to allow a set of hooks to be run. + +The server is configured to check for a directory called `/customize/` and if that is not +found, to fallback on `/customize.dist/`. In order to customize cryptpad, please **copy** +`/customize.dist/` to `/customize` and then edit it there, this way you will still be able +to pull from (and make pull requests to (!) the git repository. + + +* pad.js will be run whenever the (CKEditor) **pad** is loaded. +* sheet.js will be run whenever the (JQuery.sheet) **spreadsheet** is loaded. +* index.html is the main page. + +All other content which is placed in this directory will be referencable at the `/customize/` +URL location. diff --git a/readme.md b/readme.md index 91704f131..ec5f9daa9 100644 --- a/readme.md +++ b/readme.md @@ -58,8 +58,11 @@ published by the Free Software Foundation, either version 3 of the License, or ( any later version. If you wish to use this technology in a proprietary product, please contact sales@xwiki.com +* Icons thanks to http://www.famfamfam.com/ licensed [Creative Commons Attribution 2.5 License] + [ChainPad]: https://github.com/xwiki-contrib/chainpad [CKEditor]: http://ckeditor.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/ diff --git a/server.js b/server.js index 4a1f8e39a..f3fe5cab8 100644 --- a/server.js +++ b/server.js @@ -18,6 +18,14 @@ app.use(Express.static(__dirname + '/www')); app.use("/bower_components/jquery.sheet/bower_components", Express.static(__dirname + '/www/bower_components')); +var customize = "/customize"; +if (!Fs.existsSync(__dirname + "/customize")) { + customize = "/customize.dist"; + console.log("Cryptpad is customizable, see customize.dist/readme.md for details"); +} +app.use("/customize/", Express.static(__dirname + customize)); +app.get("/", function(req, res) { res.sendfile(__dirname + customize + '/index.html'); }); + var httpsOpts; if (config.privKeyAndCertFiles) { var privKeyAndCerts = '';