implement simple build system for static html

pull/1/head
ansuz 8 years ago
parent eb797aa7cd
commit 6b86c11b2c

@ -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);
});

@ -0,0 +1,18 @@
<!-- Piwik -->
<script type="text/javascript">
if (window.location.href.indexOf('cryptpad.fr') !== -1) {
// This piwik is only relevant to cryptpad.fr
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//piwik.xwiki.com/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 12]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
}
</script>
<!-- End Piwik Code -->

@ -0,0 +1,2 @@
<a href="https://github.com/xwiki-labs/cryptpad" class="github-corner" title="Star it, Fork it, or submit issues on Github!" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" style="position: absolute; top: 0; border: 0; right: 0;"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style><!-- Thanks! http://tholman.com/github-corners/ -->

@ -0,0 +1,49 @@
<center>
<img class="imgcenter cryptofist" src="/customize/cryptofist_small.png" />
<h1>Unity is Strength - Collaboration is Key</h1>
</center>
<p>CryptPad is the <strong>zero knowledge</strong> 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 <a href="https://en.wikipedia.org/wiki/Fragment_identifier">fragment identifier</a> 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.</p>
<p>This project uses the <a href="http://ckeditor.com/">CKEditor</a> Visual Editor, <a href="https://codemirror.net/">CodeMirror</a>, and the <a href="https://github.com/xwiki-contrib/chainpad">ChainPad</a> realtime engine.</p>
<h2 id="howitworks">How It Works</h2>
<p>CryptPad uses a variant of the <a href="https://en.wikipedia.org/wiki/Operational_transformation">Operational transformation</a> algorithm which is able to find distributed consensus using a Nakamoto Blockchain, a construct popularized by <a href="https://en.wikipedia.org/wiki/Bitcoin">Bitcoin</a>. 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.</p>
<h2 id="about-us">About</h2>
<p>You can read more about our <a href="/privacy.html" title="">privacy policy</a> and <a href="/terms.html">terms of service</a>.</p>
<p>If you have any questions or comments, you can <a href="https://twitter.com/cryptpad">tweet us</a>, open an issue <a href="https://github.com/xwiki-labs/cryptpad/issues/" title="our issue tracker">on github</a>, come say hi on irc (<a href="http://webchat.freenode.net?channels=%23cryptpad&uio=MT1mYWxzZSY5PXRydWUmMTE9Mjg3JjE1PXRydWUe7" title="freenode webchat">irc.freenode.net</a>), or <a href="mailto:sftfbsdiAyxjlj/dpn">send us an email</a>.</p>
<center>
<noscript>
<p>
<strong>OOPS</strong> In order to do encryption in your browser, Javascript is really
<strong>really</strong> required.
</p>
</noscript>
<h5 id="tryit">Try it out!</h5>
<table class="recent scroll" style="display:none">
<tbody>
<tr>
<th>Type</th>
<th>Link</th>
<th>Created</th>
<th>Last Accessed</th>
<th class="table-refresh" title="refresh list">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 861.143 861.144" style="enable-background:new 0 0 861.143 861.144;" xml:space="preserve"><path d="M803.661,613.847c21.129-49.956,31.842-102.991,31.842-157.634c0-46.664-7.883-92.431-23.43-136.031 c-15.025-42.134-36.846-81.294-64.859-116.393c-27.734-34.751-60.746-64.539-98.117-88.534 c-38.072-24.445-79.621-42.192-123.492-52.748c-28.191-6.782-56.543,10.571-63.326,38.761s10.572,56.542,38.762,63.325 c64.291,15.47,122.572,52.651,164.109,104.694c20.75,26.001,36.908,54.99,48.023,86.162c11.5,32.249,17.332,66.151,17.332,100.764 c0,80.114-31.197,155.435-87.848,212.083c-56.65,56.649-131.971,87.848-212.084,87.848c-80.114,0-155.434-31.198-212.083-87.849 c-56.65-56.648-87.848-131.969-87.848-212.083c0-59.197,17.208-116.435,49.763-165.521c28.053-42.3,66.007-76.562,110.547-100.007 v58.027c0,28.995,23.505,52.5,52.5,52.5s52.5-23.505,52.5-52.5V52.5c0-28.995-23.505-52.5-52.5-52.5H144.567 c-28.995,0-52.5,23.505-52.5,52.5c0,28.995,23.505,52.5,52.5,52.5h84.328C174.456,136.276,127.939,179.822,92.9,232.655 c-44.001,66.346-67.259,143.65-67.259,223.557c0,54.643,10.714,107.679,31.843,157.634c20.398,48.225,49.587,91.524,86.759,128.695 c37.171,37.171,80.471,66.361,128.696,86.759c49.956,21.13,102.991,31.844,157.634,31.844c54.644,0,107.677-10.714,157.634-31.844 c48.225-20.397,91.523-49.587,128.695-86.759C754.073,705.371,783.262,662.071,803.661,613.847z"/></svg>
</th> <!-- remove column -->
</tr>
</tbody>
</table>
<div id="buttons" class="buttons">
<a id="create-pad" class="button create" href="/pad/">CREATE NEW WYSIWYG PAD</a>
<a id="create-code" class="button create" href="/code/">CREATE NEW CODE PAD</a>
<a id="create-poll" class="button create" href="/poll/">CREATE NEW POLL</a>
</div>
</center>

@ -0,0 +1,43 @@
<center>
<img class="imgcenter cryptofist" src="/customize/cryptofist_small.png" />
<h1>Cryptpad Privacy Policy</h1>
</center>
<h2>What we know about you</h2>
<p>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 <a target="_blank" href="https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending" title="what http headers is my browser sending">WhatIsMyBrowser.com</a>.
</p>
<p>We use <a href="https://piwik.org/" target="_blank" title="open source analytics platform">Piwik</a>, 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.
</p>
<p>
<strong>These analytics tools are only used on informational pages. We do not collect any information about your usage of our zero-knowledge applications.</strong>
</p>
<h2>How we use what we learn</h2>
<p>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.
</p>
<p>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.</p>
<h2>What we tell others about you</h2>
<p>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.</p>
<h2>Links to other sites</h2>
<p>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.</p>
<h2>Advertisement</h2>
<p>We do not display any online advertising, though we may link to the bodies which are financing our research.</p>
<h2>Choices you have</h2>
<p>Our code is open source, so you always have the option of hosting your own instance of Cryptpad.</p>
<p>If you want to use our hosted instance, but don't want to expose your IP address, you can protect your IP using the <a href="https://www.torproject.org/projects/torbrowser.html.en" title="downloads from the Tor project" target="_blank">Tor browser bundle</a>, or a <a href="https://riseup.net/en/vpn" title="VPNs provided by Riseup" target="_blank">VPN</a>.</p>
<p>If you just want to block our analytics platform, you can use adblocking tools like <a href="https://www.eff.org/privacybadger" title="download privacy badger" target="_blank">Privacy Badger</a>.</p>
<br />

@ -0,0 +1,12 @@
<center>
<img class="imgcenter cryptofist" src="/customize/cryptofist_small.png" />
<h1>Cryptpad Terms of Service</h1>
</center>
<p>Please don't be malicious, abusive, or do anything illegal.</p>
<p>We hope you find this service useful, but availability or performance cannot be guaranteed. Please export your data regularly.</p>
<p>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.</p>
<p>Metadata provided by your browser to the server may be logged for the purpose of maintaining the service.</p>
<p>We do not provide individualized data to third parties unless required to by law.</p>

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<title>Cryptpad: Zero Knowledge, Collaborative Real Time Editing</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link rel="stylesheet" type="text/css" href="customize/main.css" />
<link rel="icon" type="image/png" href="/customize/main-favicon.png" id="favicon"/>
<script data-main="/customize/main" src="/bower_components/requirejs/require.js"></script>
<script src="/bower_components/requirejs/require.js"></script>
<script>
require.config({
waitSeconds: 60,
});
</script>
{{analytics}}
</head>
<body>
{{fork}}
<div id="main">
{{main}}
</div>
<div id="bottom-bar"></div>
</body>
</html>

@ -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"
}
}

Loading…
Cancel
Save