added site header in forms routes

This commit is contained in:
2026-06-01 14:07:19 +01:00
parent 5a14b125d2
commit 9aff454ec2
10 changed files with 99 additions and 163 deletions
+10 -3
View File
@@ -5,12 +5,15 @@ const func = require('../functions')
const router = express.Router();
///////////////////// Form pages ////////////////////////////
// new post
router.get(`${config.site_path}/${config.new_post_url}`, (req,res) => {
res.render("forms/new_post", {
config,
locale,
});
}); // /post
// signup
router.get(`${config.site_path}/${config.signup_url}`, (req,res) => {
// if the server does allow signup
if (config.allow_signup == true) {
@@ -33,20 +36,24 @@ router.get(`${config.site_path}/${config.signup_url}`, (req,res) => {
console.log("Error, invalid value for allow_signup (bool)")
}
}); // /signup
// edit account
router.get(`${config.site_path}/${config.edit_account_base_url}/:user_id`, (req,res) => {
const userID = parseInt(req.params.user_id);
res.render("forms/edit_account",
{
config,
locale,
user: data.getdata('users', 'id', userID),
user: data.getdata('users', 'id', userID)[0],
userID
});
}); // /delete_account
// edit post
router.get(`${config.site_path}/${config.edit_post_base_url}/:post_id`, (req,res) => {
const postID = req.params.post_id
const post = data.getdata('posts','id', postID)
const user = data.getdata('users', 'id', post.userID)
const post = data.getdata('posts','id', postID)[0]
const user = data.getdata('users', 'id', post.userID)[0]
res.render("forms/edit_post",
{
config,
+1 -1
View File
@@ -118,7 +118,7 @@ router.get(`${config.site_path}/comment/:postID-:commentID`, (req,res) => {
const commentID = parseInt(req.params.commentID);
const postID = parseInt(req.params.postID);
let posts_comments = data.getdata('comments', 'id', postID)["comments"]
let posts_comments = data.getdata('comments', 'id', postID)[0]["comments"]
let comment = 1
// For loop to find the comment with matching ID
posts_comments.forEach((current_comment, index) => {