From e597fd78f7189193408d058b5a95d864e6068af0 Mon Sep 17 00:00:00 2001 From: deadvey Date: Wed, 24 Sep 2025 17:33:25 +0100 Subject: [PATCH] Comment replies on comment page There is now a reply form on the comment pages to reply to that comment Syntax: >> postID-commentID Signed-off-by: deadvey --- data/data.json | 2 +- locales/en-GB.json | 1 + locales/en-US.json | 1 + locales/template.json | 4 ++++ src/functions.js | 12 +++++++----- src/routes/standard_pages.js | 1 + views/pages/comment.ejs | 12 ++++++++++++ 7 files changed, 27 insertions(+), 6 deletions(-) diff --git a/data/data.json b/data/data.json index b792db2..99f8070 100644 --- a/data/data.json +++ b/data/data.json @@ -1 +1 @@ -{"hitcount":19} \ No newline at end of file +{"hitcount":27} \ No newline at end of file diff --git a/locales/en-GB.json b/locales/en-GB.json index a0cf65f..7c0ee40 100644 --- a/locales/en-GB.json +++ b/locales/en-GB.json @@ -38,5 +38,6 @@ "posts_tagged": "Posts Tagged", "home_page": "Home Page", "site_index": "Site Index", + "reply": "reply", "attribution": "Powered by blogger-nodejs: Source Code, license (WTFPL)" } diff --git a/locales/en-US.json b/locales/en-US.json index a0cf65f..7c0ee40 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -38,5 +38,6 @@ "posts_tagged": "Posts Tagged", "home_page": "Home Page", "site_index": "Site Index", + "reply": "reply", "attribution": "Powered by blogger-nodejs: Source Code, license (WTFPL)" } diff --git a/locales/template.json b/locales/template.json index ab12d12..7c0ee40 100644 --- a/locales/template.json +++ b/locales/template.json @@ -12,6 +12,7 @@ "comment": "Comment", "submit": "Sumbit", + "site_ran_by": "Site is ran by", "signups_unavailable": "Sorry, this server does not allow signups", "user_exists": "Sorry, this user already exists, try a different username", "user_doesnt_exist": "Sorry, this user does not exist", @@ -20,9 +21,11 @@ "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.", "rss_feed": "RSS Feed", "atom_feed": "ATOM Feed", + "no_tags": "No Tags", "new_post": "New Post", "edit_post": "Edit Post", "sign_up": "Sign Up", @@ -35,5 +38,6 @@ "posts_tagged": "Posts Tagged", "home_page": "Home Page", "site_index": "Site Index", + "reply": "reply", "attribution": "Powered by blogger-nodejs: Source Code, license (WTFPL)" } diff --git a/src/functions.js b/src/functions.js index 0f1097a..dc1b1c8 100644 --- a/src/functions.js +++ b/src/functions.js @@ -74,6 +74,7 @@ export function get_userID(username) { // returns a string with some character replaced by their entities export function escape_input(input) { let output = input + .replaceAll("&", "&") // This must be first .replaceAll("<", "<") .replaceAll(">", ">") .replaceAll("\\", "\") @@ -81,18 +82,19 @@ export function escape_input(input) { .replaceAll("'", "'") .replaceAll("/", "/") .replaceAll("%", "%") - .replaceAll("&", "&") return output } // Render comment content by replacing the >> int with a url link to that comment export function render_comment(comment_content) { + console.log(comment_content) return comment_content - .replaceAll(/>> ([0-9]*)/g, ">> $1") - .replaceAll(/>>([0-9]*)/g, ">>$1") - .replaceAll(/>> ([0-9]*)/g, ">> $1") - .replaceAll(/>>([0-9]*)/g, ">>$1") + .replaceAll(/>> ([0-9]*)-([0-9]*)/g, ">> $1-$2") + .replaceAll(/>>([0-9]*)-([0-9]*)/g, ">>$1-$2") + .replaceAll(/>> ([0-9]*)-([0-9]*)/g, ">> $1-$2") + .replaceAll(/>>([0-9]*)-([0-9]*)/g, ">>$1-$2") .replaceAll("\n", "
") + }; export function render_md(content) { const markdownit = require("markdown-it") diff --git a/src/routes/standard_pages.js b/src/routes/standard_pages.js index 05072d0..fb66446 100644 --- a/src/routes/standard_pages.js +++ b/src/routes/standard_pages.js @@ -120,6 +120,7 @@ router.get("/comment/:postID-:commentID", (req,res) => { locale, comment, postID, + commentID, fromUnixTime, format, getUnixTime, diff --git a/views/pages/comment.ejs b/views/pages/comment.ejs index 0120c91..7a19ef2 100644 --- a/views/pages/comment.ejs +++ b/views/pages/comment.ejs @@ -10,5 +10,17 @@
<%- include("../partials/comment"); %>
+ <%- config.seperator %> + <%= locale.reply %>: +
+ +
+ +


+

+ +
+