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 <deadvey@deadvey.com>
This commit is contained in:
@@ -1 +1 @@
|
||||
{"hitcount":19}
|
||||
{"hitcount":27}
|
@@ -38,5 +38,6 @@
|
||||
"posts_tagged": "Posts Tagged",
|
||||
"home_page": "Home Page",
|
||||
"site_index": "Site Index",
|
||||
"reply": "reply",
|
||||
"attribution": "Powered by blogger-nodejs: <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs'>Source Code</a>, <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs/raw/branch/master/LICENSE'>license (WTFPL)</a>"
|
||||
}
|
||||
|
@@ -38,5 +38,6 @@
|
||||
"posts_tagged": "Posts Tagged",
|
||||
"home_page": "Home Page",
|
||||
"site_index": "Site Index",
|
||||
"reply": "reply",
|
||||
"attribution": "Powered by blogger-nodejs: <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs'>Source Code</a>, <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs/raw/branch/master/LICENSE'>license (WTFPL)</a>"
|
||||
}
|
||||
|
@@ -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: <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs'>Source Code</a>, <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs/raw/branch/master/LICENSE'>license (WTFPL)</a>"
|
||||
}
|
||||
|
@@ -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, "<a href='/comment/$1'>>> $1</a>")
|
||||
.replaceAll(/>>([0-9]*)/g, "<a href='/comment/$1'>>>$1</a>")
|
||||
.replaceAll(/>> ([0-9]*)/g, "<a href='/comment/$1'>>> $1</a>")
|
||||
.replaceAll(/>>([0-9]*)/g, "<a href='/comment/$1'>>>$1</a>")
|
||||
.replaceAll(/>> ([0-9]*)-([0-9]*)/g, "<a href='/comment/$1-$2'>>> $1-$2</a>")
|
||||
.replaceAll(/>>([0-9]*)-([0-9]*)/g, "<a href='/comment/$1-$2'>>>$1-$2</a>")
|
||||
.replaceAll(/>> ([0-9]*)-([0-9]*)/g, "<a href='/comment/$1-$2'>>> $1-$2</a>")
|
||||
.replaceAll(/>>([0-9]*)-([0-9]*)/g, "<a href='/comment/$1-$2'>>>$1-$2</a>")
|
||||
.replaceAll("\n", "<br/>")
|
||||
|
||||
};
|
||||
export function render_md(content) {
|
||||
const markdownit = require("markdown-it")
|
||||
|
@@ -120,6 +120,7 @@ router.get("/comment/:postID-:commentID", (req,res) => {
|
||||
locale,
|
||||
comment,
|
||||
postID,
|
||||
commentID,
|
||||
fromUnixTime,
|
||||
format,
|
||||
getUnixTime,
|
||||
|
@@ -10,5 +10,17 @@
|
||||
<div id="comment">
|
||||
<%- include("../partials/comment"); %>
|
||||
</div>
|
||||
<%- config.seperator %>
|
||||
<b><%= locale.reply %>:</b>
|
||||
<div id="post-commentform">
|
||||
<!-- Comment form -->
|
||||
<form method="POST" action="/submit_comment">
|
||||
<input type="hidden" name="post_index" value="<%= postID %>">
|
||||
<label><%= locale.username %>:</label><br/><input name="name"><br/><br/>
|
||||
<label><%= locale.comment %>:</label><br/><textarea name="content">>> <%- postID %>-<%- commentID %>
|
||||
</textarea><br/>
|
||||
<button type="submit"><%= locale.submit %></button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user