From 6b86c11b2c19f1d58ffdde74031ee6f9a27ff77a Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 16 Aug 2016 17:57:57 +0200 Subject: [PATCH] implement simple build system for static html --- customize.dist/src/build.js | 42 ++++++++++++++++++ customize.dist/src/fragments/analytics.html | 18 ++++++++ customize.dist/src/fragments/fork.html | 2 + customize.dist/src/fragments/index.html | 49 +++++++++++++++++++++ customize.dist/src/fragments/privacy.html | 43 ++++++++++++++++++ customize.dist/src/fragments/terms.html | 12 +++++ customize.dist/src/template.html | 27 ++++++++++++ package.json | 3 +- 8 files changed, 195 insertions(+), 1 deletion(-) create mode 100644 customize.dist/src/build.js create mode 100644 customize.dist/src/fragments/analytics.html create mode 100644 customize.dist/src/fragments/fork.html create mode 100644 customize.dist/src/fragments/index.html create mode 100644 customize.dist/src/fragments/privacy.html create mode 100644 customize.dist/src/fragments/terms.html create mode 100644 customize.dist/src/template.html diff --git a/customize.dist/src/build.js b/customize.dist/src/build.js new file mode 100644 index 000000000..ade53b906 --- /dev/null +++ b/customize.dist/src/build.js @@ -0,0 +1,42 @@ +var Fs = require("fs"); + +// read a file +var read = function (path) { + return Fs.readFileSync(path, 'utf-8'); +}; + +// write a file +var write = function (path, src) { + return Fs.writeFileSync(path, src); +}; + +// basic templating +var swap = function (src, dict) { + return src.replace(/\{\{(.*?)\}\}/g, function (a, b) { + return dict[b] || b; + }); +}; + +// read the template file +var template = read('./template.html'); + +// read page fragments +var fragments = {}; +[ 'analytics', + 'index', + 'fork', + 'terms', + 'privacy', +].forEach(function (name) { + fragments[name] = read('./fragments/' + name + '.html'); +}); + +// build static pages +['index', 'privacy', 'terms'].forEach(function (page) { + var source = swap(template, { + fork: fragments.fork, + analytics: fragments.analytics, + main: fragments[page], + }); + write('../' + page + '.html', source); +}); diff --git a/customize.dist/src/fragments/analytics.html b/customize.dist/src/fragments/analytics.html new file mode 100644 index 000000000..7187a85da --- /dev/null +++ b/customize.dist/src/fragments/analytics.html @@ -0,0 +1,18 @@ + + + + diff --git a/customize.dist/src/fragments/fork.html b/customize.dist/src/fragments/fork.html new file mode 100644 index 000000000..92bbf8f87 --- /dev/null +++ b/customize.dist/src/fragments/fork.html @@ -0,0 +1,2 @@ + + diff --git a/customize.dist/src/fragments/index.html b/customize.dist/src/fragments/index.html new file mode 100644 index 000000000..0ad997b9e --- /dev/null +++ b/customize.dist/src/fragments/index.html @@ -0,0 +1,49 @@ +
+ +

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. The secret encryption key is stored in the URL fragment identifier which is never sent to the server but is available to javascript so by sharing the URL, you give authorization to others who want to participate.

+ +

This project uses the CKEditor Visual Editor, CodeMirror, and the ChainPad realtime engine.

+ +

How It Works

+

CryptPad uses a variant of the Operational transformation algorithm which is able to find distributed consensus using a Nakamoto Blockchain, a construct popularized by Bitcoin. This way the algorithm can avoid the need for a central server to resolve Operational Transform Edit Conflicts and without the need for resolving conflicts, the server can be kept unaware of the content which is being edited on the pad.

+ +

About

+ +

You can read more about our privacy policy and terms of service.

+

If you have any questions or comments, you can tweet us, open an issue on github, come say hi on irc (irc.freenode.net), or send us an email.

+ +
+ +
Try it out!
+ + + + + + + + + + + + + + + + +
+ diff --git a/customize.dist/src/fragments/privacy.html b/customize.dist/src/fragments/privacy.html new file mode 100644 index 000000000..f1fde5b71 --- /dev/null +++ b/customize.dist/src/fragments/privacy.html @@ -0,0 +1,43 @@ +
+ +

Cryptpad Privacy Policy

+
+ +

What we know about you

+

As an application that is hosted on the web, Cryptpad has access to metadata exposed by the HTTP protocol. + This includes your IP address, and various other HTTP headers that can be used to identify your particular browser. + You can see what information your browser is sharing by visiting WhatIsMyBrowser.com. +

+

We use Piwik, an open source analytics platform, to learn more about our users. + Piwik tells us about how you found Cryptpad, via direct entry, through a search engine, or via a referral from another web service like Reddit or Twitter. + We also learn when you visit, what links you click while on our informational pages, and how long you stay on a particular page. +

+

+ These analytics tools are only used on informational pages. We do not collect any information about your usage of our zero-knowledge applications. +

+ +

How we use what we learn

+

We use this information to make better decisions about promoting Cryptpad, by evaluating which of our past efforts were successful. + Information about your location lets us know whether we should consider providing better support for languages other than English. +

+

Information about your browser (whether it's a desktop or mobile operating system) helps us make decisions when prioritizing feature improvements. + Our development team is small, and we try to make choices that will improve as many users' experience as possible.

+ +

What we tell others about you

+

We do not furnish to third parties the information that we gather or that you provide to us unless we are legally required to do so.

+ +

Links to other sites

+

This site contains links to other sites, including those produced by other organizations. We are not responsible for the privacy practices or the contents of any outside sites. As a general rule, links to outside sites are launched in a new browser window, to make clear that you are leaving Cryptpad.fr.

+ +

Advertisement

+

We do not display any online advertising, though we may link to the bodies which are financing our research.

+ +

Choices you have

+

Our code is open source, so you always have the option of hosting your own instance of Cryptpad.

+

If you want to use our hosted instance, but don't want to expose your IP address, you can protect your IP using the Tor browser bundle, or a VPN.

+

If you just want to block our analytics platform, you can use adblocking tools like Privacy Badger.

+ +
+ + + diff --git a/customize.dist/src/fragments/terms.html b/customize.dist/src/fragments/terms.html new file mode 100644 index 000000000..6109927d7 --- /dev/null +++ b/customize.dist/src/fragments/terms.html @@ -0,0 +1,12 @@ +
+ +

Cryptpad Terms of Service

+
+ +

Please don't be malicious, abusive, or do anything illegal.

+

We hope you find this service useful, but availability or performance cannot be guaranteed. Please export your data regularly.

+

Cryptpad documents can be read or modified by anyone who can guess or otherwise obtain the document's fragment identifier. + We recommend that you use end-to-end-encrypted (e2ee) messaging technology to share URLs, and assume no liability in the event that such a URL is leaked.

+

Metadata provided by your browser to the server may be logged for the purpose of maintaining the service.

+

We do not provide individualized data to third parties unless required to by law.

+ diff --git a/customize.dist/src/template.html b/customize.dist/src/template.html new file mode 100644 index 000000000..6e186323e --- /dev/null +++ b/customize.dist/src/template.html @@ -0,0 +1,27 @@ + + + + Cryptpad: Zero Knowledge, Collaborative Real Time Editing + + + + + + + {{analytics}} + + + {{fork}} + +
+{{main}} +
+ +
+ + + diff --git a/package.json b/package.json index cdd27bbe3..06d115bab 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "scripts": { "lint": "jshint --config .jshintrc --exclude-path .jshintignore .", "test": "node TestSelenium.js", - "style": "lessc ./customize.dist/src/cryptpad.less > ./customize.dist/main.css && lessc ./customize.dist/src/alertify.less > ./customize.dist/alertify.css && lessc ./customize.dist/src/toolbar.less > ./customize.dist/toolbar.css" + "style": "lessc ./customize.dist/src/cryptpad.less > ./customize.dist/main.css && lessc ./customize.dist/src/alertify.less > ./customize.dist/alertify.css && lessc ./customize.dist/src/toolbar.less > ./customize.dist/toolbar.css", + "template": "cd customize.dist/src && node build.js" } }