fixed some incorrect routes

This commit is contained in:
2026-06-02 00:17:04 +01:00
parent 63ca617895
commit 736edee1b0
4 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ router.post(`${config.site_path}/submit_post`, (req,res) => {
fs.writeFileSync(`../data/posts.json`, `${JSON.stringify(posts)}`, 'utf-8'); fs.writeFileSync(`../data/posts.json`, `${JSON.stringify(posts)}`, 'utf-8');
comments.push({'id': id, 'comments': []}) comments.push({'id': id, 'comments': []})
fs.writeFileSync(`../data/comments.json`, `${JSON.stringify(comments)}`) fs.writeFileSync(`../data/comments.json`, `${JSON.stringify(comments)}`)
res.redirect(302, `/post/${id}`); res.redirect(302, `${config.sitr_path}/post/${id}`);
} }
else { else {
res.render("partials/message", { res.render("partials/message", {
+1 -1
View File
@@ -32,7 +32,7 @@ router.get(`${config.site_path}/${config.signup_url}`, (req,res) => {
} }
// If allow_signup is undefined or not a boolean, error // If allow_signup is undefined or not a boolean, error
else { else {
res.redirect(301,"/") res.redirect(301,config.site_path)
console.log("Error, invalid value for allow_signup (bool)") console.log("Error, invalid value for allow_signup (bool)")
} }
}); // /signup }); // /signup
+1 -1
View File
@@ -89,7 +89,7 @@ router.get(`${config.site_path}/post/:post_index`, (req, res) => {
} }
else { else {
console.log("Error loading page") console.log("Error loading page")
res.redirect(301,"/") res.redirect(301,config.site_path)
} }
}); // /post/:post_index }); // /post/:post_index
+3
View File
@@ -50,6 +50,9 @@ function perform_checks()
exit_flag = false exit_flag = false
required_values = ['site_admin','seperator','site_name','site_url','locale','port','cache_data','allow_signup','site_description','request_data_limit','enable_hitcount','charset','root_path','edit_account_base_url','new_post_url','signup_url','default_commenter_username','rss','atom','date_format','time_zone','css'] required_values = ['site_admin','seperator','site_name','site_url','locale','port','cache_data','allow_signup','site_description','request_data_limit','enable_hitcount','charset','root_path','edit_account_base_url','new_post_url','signup_url','default_commenter_username','rss','atom','date_format','time_zone','css']
// Perform some standard checks: // Perform some standard checks:
if config.site_path.slice(-1) == "/" { // cut off a trailing /
config.site_path = config.site_path.substring(0,config.site_path.length-1);
}
// data_storage // data_storage
switch (config.data_storage) switch (config.data_storage)