Browse Source

terms of service added

master
Christian Müller 10 years ago
parent
commit
29200e6671
  1. 2
      package.json
  2. 41
      resources/TOS.md
  3. 8
      resources/edit.html
  4. 6
      resources/public/js/publishing.js
  5. 6
      server.js
  6. 9
      src/view.js

2
package.json

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
"main": "server.js",
"scripts": {
"start": "node server.js",
"devser": "nodemon server.js",
"dev": "nodemon server.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {

41
resources/TOS.md

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
# NoteHub Terms of Service
### 1. Terms
By accessing the web site at <u>https://notehub.org</u>, you are agreeing to be bound by these web site Terms and Conditions of Use, all applicable laws and regulations, and agree that you are responsible for compliance with any applicable local laws. If you do not agree with any of these terms, you are prohibited from using or accessing this site. The materials contained in this web site are protected by applicable copyright and trademark law.
### 2. Use License
a. Under this license you may not:
- i. attempt to __modify, manipulate__ or __extend__ any software contained on NoteHub's web site;
- ii. create _any_ kind of law prohibited content;
b. This license shall automatically terminate if you violate any of these restrictions and may be terminated by NoteHub at any time. Upon terminating your viewing of these materials or upon the termination of this license, you must destroy any downloaded materials in your possession whether in electronic or printed format.
### 3. Disclaimer
a. The materials on NoteHub's web site are provided "as is". NoteHub makes no warranties, expressed or implied, and hereby disclaims and negates all other warranties, including without limitation, implied warranties or conditions of merchantability, fitness for a particular purpose, or non-infringement of intellectual property or other violation of rights. Further, NoteHub does not warrant or make any representations concerning the accuracy, likely results, or reliability of the use of the materials on its Internet web site or otherwise relating to such materials or on any sites linked to this site.
### 4. Limitations
In no event shall NoteHub or its suppliers be liable for any damages (including, without limitation, damages for loss of data or profit, or due to business interruption,) arising out of the use or inability to use the materials on NoteHub's Internet site, even if NoteHub or a NoteHub authorized representative has been notified orally or in writing of the possibility of such damage. Because some jurisdictions do not allow limitations on implied warranties, or limitations of liability for consequential or incidental damages, these limitations may not apply to you.
### 5. Revisions and Errata
The materials appearing on NoteHub's web site could include technical, typographical, or photographic errors. NoteHub does not warrant that any of the materials on its web site are accurate, complete, or current. NoteHub may make changes to the materials contained on its web site at any time without notice. NoteHub does not, however, make any commitment to update the materials.
### 6. Links
NoteHub has not reviewed all of the sites linked to its Internet web site and is not responsible for the contents of any such linked site. The inclusion of any link does not imply endorsement by NoteHub of the site. Use of any such linked web site is at the user's own risk.
### 7. Site Terms of Use Modifications
NoteHub may revise these terms of use for its web site at any time without notice. By using this web site you are agreeing to be bound by the then current version of these Terms and Conditions of Use.
### 8. Governing Law
Any claim relating to NoteHub's web site shall be governed by the laws of Germany without regard to its conflict of law provisions.
General Terms and Conditions applicable to Use of a Web Site.

8
resources/edit.html

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
<body onload="onLoad()" style="height: 100%">
<div id="editContainer">
<form id="editPane" action="/note" autocomplete="off" method="POST">
<form id="editPane" action="/note" autocomplete="off" method="POST" target="_self">
<input id="action" name="action" value="%ACTION%" type="hidden" />
<input id="id" name="id" value="%ID%" type="hidden" />
<input id="password" name="password" type="hidden" />
@ -23,7 +23,11 @@ @@ -23,7 +23,11 @@
<textarea id="note" name="note">%CONTENT%</textarea>
<fieldset id="input-elems">
<input class="ui-elem" id="plain-password" name="plain-password" placeholder="Password for editing" type="text">&nbsp;
<input class="button ui-elem" id="publish-button" name="button" type="submit" value="Publish">
<label style="margin-right: 1em">
<input id="tos" type="checkbox" onClick="enableButton()">
Accept <a href="/TOS">Terms of Service</a>
</label>
<input class="button ui-elem" disabled id="publish-button" name="button" type="submit" value="Publish">
<input class="button ui-elem" id="delete-button" name="button" type="submit" value="Delete">
<span id="tableau">
0 words

6
resources/public/js/publishing.js

@ -18,6 +18,12 @@ function saveDraft() { @@ -18,6 +18,12 @@ function saveDraft() {
localStorage.setItem("draft", $note.value);
}
function enableButton() {
var checkbox = $('tos');
var button = $('publish-button');
button.disabled = !checkbox.checked;
}
function onLoad() {
$note = $("note");
$action = $("action").value;

6
server.js

@ -38,6 +38,10 @@ var log = function() { @@ -38,6 +38,10 @@ var log = function() {
console.log.apply(console, message);
}
app.get('/TOS', function(req, res) {
res.send(view.renderTOS());
});
app.get('/new', function(req, res) {
log(req.ip, "opens /new");
res.send(view.newNotePage(getTimeStamp() + md5(Math.random())));
@ -52,6 +56,8 @@ app.post('/note', function(req, res) { @@ -52,6 +56,8 @@ app.post('/note', function(req, res) {
id = body.id;
log(req.ip, "calls /note to", action, id);
var goToNote = note => res.redirect("/" + note.id);
if (!note)
return sendResponse(res, 400, "Bad request");
if (session.indexOf(getTimeStamp()) != 0)
return sendResponse(res, 400, "Session expired");
var expectedSignature = md5(session + note.replace(/[\n\r]/g, ""));

9
src/view.js

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
var marked = require("marked");
var fs = require("fs");
var TOS = fs.readFileSync("resources/TOS.md", "utf-8");
var pageTemplate = fs.readFileSync("resources/template.html", "utf-8");
var footerTemplate = fs.readFileSync("resources/footer.html", "utf-8");
var editTemplate = fs.readFileSync("resources/edit.html", "utf-8");
@ -15,7 +16,7 @@ var renderPage = (id, title, content, footer) => pageTemplate @@ -15,7 +16,7 @@ var renderPage = (id, title, content, footer) => pageTemplate
.replace("%MISUSE%", misuses.has(id) ? misuseScript : "")
.replace("%TITLE%", title)
.replace("%CONTENT%", content.replace(/<meta.*?>/gi, "").replace(/<script[\s\S.]*?\/script>/gi, ""))
.replace("%FOOTER%", footer);
.replace("%FOOTER%", footer || "");
module.exports.renderPage = renderPage;
@ -25,8 +26,10 @@ module.exports.renderStats = note => renderPage(note.id, deriveTitle(note.text), @@ -25,8 +26,10 @@ module.exports.renderStats = note => renderPage(note.id, deriveTitle(note.text),
<tr><td>Published</td><td>${note.published}</td></tr>
<tr><td>Edited</td><td>${note.edited || "N/A"}</td></tr>
<tr><td>Views</td><td>${note.views}</td></tr>
</table>`,
"");
</table>`);
module.exports.renderTOS = () =>
renderPage("tos", "Terms of Service", marked(TOS));
module.exports.renderNote = note => renderPage(note.id, deriveTitle(note.text),
marked(note.text),

Loading…
Cancel
Save