Post doesn't exist page

This commit is contained in:
2025-08-01 23:21:43 +01:00
parent 88b198365d
commit cdfc5f2c30
3 changed files with 36 additions and 22 deletions

View File

@@ -25,6 +25,7 @@
"user_exists": "Sorry, this user already exists, try a different username",
"user_doesnt_exist": "Sorry, this user does not exist",
"comment_doesnt_exist": "This comment doesn't exist, this could be because the post it was attached to was deleted",
"post_doesnt_exist": "This post doesn't exist or was deleted",
"delete_account_confirmation": "Delete my account - (I agree that my account and all of my posts will be permanently deleted instantly)",
"incorrect_password": "Incorrect Password",
"rss_disabled": "Sorry, RSS is disabled",

View File

@@ -9,7 +9,7 @@
"timeline_length": 20,
"enable_hitcount": true,
"charset": "UTF-8",
"root_path": "/path/to/blogger-webroot",
"root_path": "/path/to/webroot",
"edit_account_base_url": "/edit_account",
"new_post_url": "/post",
"signup_url": "/signup",
@@ -25,7 +25,8 @@
"user_exists": "Sorry, this user already exists, try a different username",
"user_doesnt_exist": "Sorry, this user does not exist",
"comment_doesnt_exist": "This comment doesn't exist, this could be because the post it was attached to was deleted",
"delete_account_confirmation": "I agree that my account and all of my posts will be permanently deleted instantly",
"post_doesnt_exist": "This post doesn't exist or was deleted",
"delete_account_confirmation": "Delete my account - (I agree that my account and all of my posts will be permanently deleted instantly)",
"incorrect_password": "Incorrect Password",
"rss_disabled": "Sorry, RSS is disabled",
"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>"

View File

@@ -186,6 +186,13 @@ app.get("/user/:username", (req, res) => {
}); // /user/:username
app.get("/post/:post_index", (req, res) => {
const postID = req.params.post_index
if (posts[postID]["deleted"] == true) {
res.render("partials/message", {
message: config.string.post_doesnt_exist,
config,
})
}
else if (typeof posts[postID]["deleted"] == "undefined" || posts[postID]["deleted"] == false) {
res.render("pages/post",
{
config,
@@ -199,6 +206,11 @@ app.get("/post/:post_index", (req, res) => {
func,
converter,
})
}
else {
console.log("Error loading page")
res.redirect(301,"/")
}
}); // /post/:post_index
app.get("/tag/:tag", (req,res) => {
const tag = req.params.tag