make signatures trustable
This commit is contained in:
parent
08bb1985b1
commit
17810013c1
1 changed files with 3 additions and 3 deletions
6
index.js
6
index.js
|
@ -45,7 +45,7 @@ server.all('/', function get(req, res) {
|
|||
mainPage.comments.push({timestamp: posts[i].timestamp, author: posts[i].author, title: posts[i].title, content: posts[i].content, comments: []})
|
||||
}
|
||||
if(req.body.name && req.body.title && req.body.content) {
|
||||
let post = {timestamp: new Date().getTime(), author: req.body.name, title: req.body.title, content: req.body.content.replaceAll('\r\n', '\n') + (req.body.secret && req.body.secret !== '' ? ('\n\n[* Signed: [" ' + req.body.secret.sha512().sha512().sha256() + ' "] *]') : ''), comments: []}
|
||||
let post = {timestamp: new Date().getTime(), author: req.body.name, title: req.body.title, content: req.body.content.replaceAll('\r\n', '\n') + (req.body.secret && req.body.secret !== '' ? ('\n\n[* Signed: [" ' + req.body.secret.sha512().sha512().sha256() + ' "] *]') : '\n\n[* Not signed *]'), comments: []}
|
||||
if(fake) {
|
||||
mainPage.comments.push(post)
|
||||
res.render('post.ejs', {post: mainPage, postid: '-1', webname: webname, email: email, comment: '', fake: true})
|
||||
|
@ -78,7 +78,7 @@ server.all('/comment', function get(req, res) {
|
|||
console.log(String(cid) + ' ' + comment)
|
||||
if(String(cid) === comment) {
|
||||
if(req.body.name && req.body.title && req.body.content) {
|
||||
post.comments.push({timestamp: new Date().getTime(), author: req.body.name, title: req.body.title, content: req.body.content.replaceAll('\r\n', '\n') + (req.body.secret && req.body.secret !== '' ? ('\n\n[* Signed: [" ' + req.body.secret.sha512().sha512().sha256() + ' "] *]') : ''), comments: []})
|
||||
post.comments.push({timestamp: new Date().getTime(), author: req.body.name, title: req.body.title, content: req.body.content.replaceAll('\r\n', '\n') + (req.body.secret && req.body.secret !== '' ? ('\n\n[* Signed: [" ' + req.body.secret.sha512().sha512().sha256() + ' "] *]') : '\n\n[* Not signed *]'), comments: []})
|
||||
if(fake) {
|
||||
res.render('post.ejs', {post: posts[id], postid: id, webname: webname, email: email, comment: cid, fake: fake})
|
||||
toRemove = post
|
||||
|
@ -105,7 +105,7 @@ server.all('/comment', function get(req, res) {
|
|||
}
|
||||
else {
|
||||
if(req.body.name && req.body.title && req.body.content) {
|
||||
posts[id].comments.push({timestamp: new Date().getTime(), author: req.body.name, title: req.body.title, content: req.body.content.replaceAll('\r\n', '\n') + (req.body.secret && req.body.secret !== '' ? ('\n\n[* Signed: [" ' + req.body.secret.sha512().sha512().sha256() + ' "] *]') : ''), comments: []})
|
||||
posts[id].comments.push({timestamp: new Date().getTime(), author: req.body.name, title: req.body.title, content: req.body.content.replaceAll('\r\n', '\n') + (req.body.secret && req.body.secret !== '' ? ('\n\n[* Signed: [" ' + req.body.secret.sha512().sha512().sha256() + ' "] *]') : '\n\n[* Not signed *]'), comments: []})
|
||||
if(fake) {
|
||||
res.render('post.ejs', {post: posts[id], postid: id, webname: webname, email: email, comment: cid, fake: fake})
|
||||
toRemove = posts[id]
|
||||
|
|
Loading…
Add table
Reference in a new issue