From 9aff454ec29c6a6a98957f2b6f25252c4454c243 Mon Sep 17 00:00:00 2001 From: deadvey Date: Mon, 1 Jun 2026 14:07:19 +0100 Subject: [PATCH] added site header in forms routes --- src/routes/forms.js | 13 +++++++--- src/routes/standard_pages.js | 2 +- views/forms/edit_account.ejs | 39 ++++++++++++++++------------ views/forms/edit_post.ejs | 43 +++++++++++++++++-------------- views/forms/new_post.ejs | 34 ++++++++++++++---------- views/forms/signup.ejs | 39 ++++++++++++++++------------ views/syndication/global_atom.ejs | 22 ---------------- views/syndication/global_rss.ejs | 22 ---------------- views/syndication/user_atom.ejs | 24 ----------------- views/syndication/user_rss.ejs | 24 ----------------- 10 files changed, 99 insertions(+), 163 deletions(-) delete mode 100644 views/syndication/global_atom.ejs delete mode 100644 views/syndication/global_rss.ejs delete mode 100644 views/syndication/user_atom.ejs delete mode 100644 views/syndication/user_rss.ejs diff --git a/src/routes/forms.js b/src/routes/forms.js index abc654c..dc3da4a 100644 --- a/src/routes/forms.js +++ b/src/routes/forms.js @@ -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, diff --git a/src/routes/standard_pages.js b/src/routes/standard_pages.js index c5c599b..e5f8ad0 100644 --- a/src/routes/standard_pages.js +++ b/src/routes/standard_pages.js @@ -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) => { diff --git a/views/forms/edit_account.ejs b/views/forms/edit_account.ejs index e966c93..dec20d6 100644 --- a/views/forms/edit_account.ejs +++ b/views/forms/edit_account.ejs @@ -1,22 +1,27 @@ - - - <%- include("../partials/head") %> - - -
- -
-

+ + + <%- include("../partials/head") %> + + +
+ + + +
+

-
-

+
+

-
-

+
+

-
-
- - +
+
+ +
+ diff --git a/views/forms/edit_post.ejs b/views/forms/edit_post.ejs index 9ec81ae..0ab0c9f 100644 --- a/views/forms/edit_post.ejs +++ b/views/forms/edit_post.ejs @@ -1,27 +1,32 @@ - - <%- include("../partials/head") %> - - -
- - + + <%- include("../partials/head") %> + + +
+ + + + -
-

+
+

-
-

+
+

-
-

+
+

-
-

+
+

-
-
- - +
+
+ +
+ diff --git a/views/forms/new_post.ejs b/views/forms/new_post.ejs index bec5a82..d06e428 100644 --- a/views/forms/new_post.ejs +++ b/views/forms/new_post.ejs @@ -4,22 +4,28 @@ <%- include('../partials/head.ejs') %> -
-
-

+
+ + +
+

-
-

+
+

-
-

+
+

-
-

+
+

-
-

+
+

-
- - +
+ +
+ + diff --git a/views/forms/signup.ejs b/views/forms/signup.ejs index 40b48f3..3f62fe9 100644 --- a/views/forms/signup.ejs +++ b/views/forms/signup.ejs @@ -1,24 +1,29 @@ - - <%- include("../partials/head") %> - - -
-
-

+ + <%- include("../partials/head") %> + + +
+ + +
+

-
-

+
+

-
-

+
+

-
-

+
+

-
-
- - +
+
+ +
+ diff --git a/views/syndication/global_atom.ejs b/views/syndication/global_atom.ejs deleted file mode 100644 index c68b04e..0000000 --- a/views/syndication/global_atom.ejs +++ /dev/null @@ -1,22 +0,0 @@ -" ?> - - <%= config.site_name %> - <%= config.site_url %> - <%= config.site_description %> - <%= func.unix_time_to_atom_date(getUnixTime(new Date())) %> - <%= config.site_url %> - <% for (let postID = posts.length-1; postID >= 0; postID--) { %> - <% if (posts[postID]["deleted"] != true) { %> - - <%= posts[postID]["title"] %> - <%= config.site_url %>/post/<%= postID %> - ]]> - <%= config.site_url %>/post/<%= postID %> - <%# func.unix_time_to_atom_date(posts[postID]['pubdate']) %> - <% for (let tag_index = 0; tag_index < posts[postID]['tags'].length; tag_index++) { %> - ]]> - <% } %> - - <% } %> - <% } %> - diff --git a/views/syndication/global_rss.ejs b/views/syndication/global_rss.ejs deleted file mode 100644 index bdb0ea0..0000000 --- a/views/syndication/global_rss.ejs +++ /dev/null @@ -1,22 +0,0 @@ -" ?> - - - <%= config.site_name %> - <%= config.site_url %> - <%= config.site_description %> - <% for (let postID = posts.length-1; postID >= 0; postID--) { %> - <% if (posts[postID]["deleted"] != true) { %> - - <%= posts[postID]["title"] %> - <%= config.site_url %>/post/<%= postID %> - ]]> - <%= config.site_url %>/post/<%= postID %> - <%= func.unix_time_to_rss_date(posts[postID]['pubdate']) %> - <% for (let tag_index = 0; tag_index < posts[postID]['tags'].length; tag_index++) { %> - ]]> - <% } %> - - <% } %> - <% } %> - - diff --git a/views/syndication/user_atom.ejs b/views/syndication/user_atom.ejs deleted file mode 100644 index 747d059..0000000 --- a/views/syndication/user_atom.ejs +++ /dev/null @@ -1,24 +0,0 @@ -" ?> - - <%= config.site_name %> - <%= config.site_url %> - <%= config.site_description %> - <%= func.unix_time_to_atom_date(getUnixTime(new Date())) %> - <%= config.site_url %> - <% for (let postID = posts.length-1; postID >= 0; postID--) { %> - <% if (posts[postID]["userID"] == userID) { %> - <% if (posts[postID]["deleted"] != true) { %> - - <%= posts[postID]["title"] %> - <%= config.site_url %>/post/<%= postID %> - ]]> - <%= config.site_url %>/post/<%= postID %> - <%# func.unix_time_to_atom_date(posts[postID]['pubdate']) %> - <% for (let tag_index = 0; tag_index < posts[postID]['tags'].length; tag_index++) { %> - ]]> - <% } %> - - <% } %> - <% } %> - <% } %> - diff --git a/views/syndication/user_rss.ejs b/views/syndication/user_rss.ejs deleted file mode 100644 index 383ccb7..0000000 --- a/views/syndication/user_rss.ejs +++ /dev/null @@ -1,24 +0,0 @@ -" ?> - - - <%= config.site_name %> - <%= config.site_url %> - <%= config.site_description %> - <% for (let postID = posts.length-1; postID >= 0; postID--) { %> - <% if (posts[postID]["userID"] == userID) { %> - <% if (posts[postID]["deleted"] != true) { %> - - <%= posts[postID]["title"] %> - <%= config.site_url %>/post/<%= postID %> - ]]> - <%= config.site_url %>/post/<%= postID %> - <%= func.unix_time_to_rss_date(posts[postID]['pubdate']) %> - <% for (let tag_index = 0; tag_index < posts[postID]['tags'].length; tag_index++) { %> - ]]> - <% } %> - - <% } %> - <% } %> - <% } %> - -