diff --git a/data/data.json b/data/data.json index 7172056..b792db2 100644 --- a/data/data.json +++ b/data/data.json @@ -1 +1 @@ -{"hitcount":16,"comment_counter":1} \ No newline at end of file +{"hitcount":19} \ No newline at end of file diff --git a/locales/en-US.json b/locales/en-US.json index 3b735f2..a0cf65f 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -21,7 +21,7 @@ "incorrect_password": "Incorrect Password", "rss_disabled": "Sorry, RSS is disabled", "atom_disabled": "Sorry, ATOM is disabled", - "AI_consent": "The·content·on·this·website·may·not·be·copied,·scraped,·or·used·to·train·AI·models·or·large·language·models·(LLMs)·without·prior·written·consent.", + "AI_consent": "The content on this website may not be copied, scraped, or used to train AI models or large language models (LLMs) without prior written consent.", "rss_feed": "RSS Feed", "atom_feed": "ATOM Feed", diff --git a/src/routes/form_actions.js b/src/routes/form_actions.js index ed4ebfc..8eeebfd 100644 --- a/src/routes/form_actions.js +++ b/src/routes/form_actions.js @@ -16,23 +16,24 @@ const router = express.Router(); ////////////////////// Form actions ///////////////////////// router.post("/submit_comment", (req,res) => { const unix_timestamp = getUnixTime(new Date()) + const postID = parseInt(req.body.post_index) + const content = func.escape_input(req.body.content) let name = func.escape_input(req.body.name) if (name == "") { name = config.default_commenter_username } + + let comments = data.getdata('comments') + new_comment = { "name": name, - "content": func.escape_input(req.body.content), - "id": data.getdata('other_data').comment_counter, + "content": content, + "id": comments[postID].length, "pubdate": unix_timestamp, - "postID": req.body.post_index, + "postID": postID, }; - let other_data = data.getdata('other_data') - other_data.comment_counter += 1; - let comments = data.getdata('comments') - comments[req.body.post_index].push(new_comment); + comments[postID].push(new_comment); fs.writeFileSync(`../data/comments.json`, `${JSON.stringify(comments)}`, 'utf-8'); - fs.writeFileSync('../data/data.json', JSON.stringify(other_data), 'utf-8'); res.redirect(301,`/post/${req.body.post_index}`) }); // /submit_comment