From 84164123b606650feb73585b95379c8cd1e519a8 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Fri, 30 Jan 2015 18:12:20 +0100 Subject: [PATCH] not quite finished --- .gitignore | 1 + ChainPadSrv.js | 14 +++++++------- bower.json | 1 + customize.dist/DecorateToolbar.js | 7 +++++++ customize.dist/fr.png | Bin 0 -> 545 bytes customize.dist/france.png | Bin 0 -> 545 bytes customize.dist/heart.png | Bin 0 -> 749 bytes {www => customize.dist}/index.css | 0 {www => customize.dist}/index.html | 6 +++--- customize.dist/pad.js | 6 ++++++ customize.dist/readme.md | 18 ++++++++++++++++++ readme.md | 3 +++ server.js | 8 ++++++++ 13 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 customize.dist/DecorateToolbar.js create mode 100755 customize.dist/fr.png create mode 100644 customize.dist/france.png create mode 100644 customize.dist/heart.png rename {www => customize.dist}/index.css (100%) rename {www => customize.dist}/index.html (84%) create mode 100644 customize.dist/pad.js create mode 100644 customize.dist/readme.md 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 0000000000000000000000000000000000000000..8332c4ec23c853944c29b02d7b32a88033f48a71 GIT binary patch literal 545 zcmV++0^a?JP)lgG%);U`26kn-@hOg zU%!6+4+cOs(0HIde9xZz`}Onxub&LUB0x(30+2WcIRJn#2ut|?gWYu1Cf+!-K%B8# zdf?1WA}#uZ8oj7u>$I1i0Al&`=O0k%-@icgAIJnM0xA6maSq6BK-ECw|NZ*S`0Lj% z1_pot6puj;05Ax`F!=umqj7^frO?t|3^&I1kxUq9yECc+jQpY84SWH_0#pxl$?v~F z@*hy-KN0|X07U)z`4{NpU%#2aHUI<=%a31wK(7Du52Oc(|3O^?R1IN+RRjI-n*kVB z3=9AP#PZ|EACPLGJ%9cJNh|>9B%spYzZw7h1%?tp0I_@ndg9MNE>313@6R75NcceF zkr51-#U+7;F#`Sf7i0rK0I_`g_NQ&ZlgG%);U`26kn-@hOg zU%!6+4+cOs(0HIde9xZz`}Onxub&LUB0x(30+2WcIRJn#2ut|?gWYu1Cf+!-K%B8# zdf?1WA}#uZ8oj7u>$I1i0Al&`=O0k%-@icgAIJnM0xA6maSq6BK-ECw|NZ*S`0Lj% z1_pot6puj;05Ax`F!=umqj7^frO?t|3^&I1kxUq9yECc+jQpY84SWH_0#pxl$?v~F z@*hy-KN0|X07U)z`4{NpU%#2aHUI<=%a31wK(7Du52Oc(|3O^?R1IN+RRjI-n*kVB z3=9AP#PZ|EACPLGJ%9cJNh|>9B%spYzZw7h1%?tp0I_@ndg9MNE>313@6R75NcceF zkr51-#U+7;F#`Sf7i0rK0I_`g_NQ&Z{UrO36YoGex>*KgTU04Sb0lNGJEiq?mmQbVHD$?08PR{#RY@(Jtf90i82`&dI!dW7jO<!P=IT3`*tHLxxjwl=}>+*)uJ zQXzyPPN^^yrLNn-L6|)gDrKnEAdbPP1a+KXt(F*+N-)2L{Eb_PQs+ab)QQT6Pw(ST zBha=K(orHRSCfHi4O9%(3e<(Lb`^!uF>+VB$3*L{zr`0-_;)Y*n?E-k7dr!rf-5ve?cY>d<{Q2T>(phfG`V$89Qfr0$5PaI$GcI;T;lseVaJa_ff4eP;K@^|hsa{cCz zXuY%j{{3s?^}(OQ^lJ0wCa2U<(RxpI&Wzye%Qu%q>x1omeM7&Az4w3Z$LrQ@df3^y f|6iKmf8+cE7K65BSFA1B00000NkvXXu0mjfxAtvo literal 0 HcmV?d00001 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 = '';