diff --git a/src/routes/form_actions.js b/src/routes/form_actions.js index f68120a..be7a011 100644 --- a/src/routes/form_actions.js +++ b/src/routes/form_actions.js @@ -71,7 +71,7 @@ router.post(`${config.site_path}/submit_post`, (req,res) => { fs.writeFileSync(`../data/posts.json`, `${JSON.stringify(posts)}`, 'utf-8'); comments.push({'id': id, 'comments': []}) fs.writeFileSync(`../data/comments.json`, `${JSON.stringify(comments)}`) - res.redirect(302, `/post/${id}`); + res.redirect(302, `${config.sitr_path}/post/${id}`); } else { res.render("partials/message", { diff --git a/src/routes/forms.js b/src/routes/forms.js index dc3da4a..9d65804 100644 --- a/src/routes/forms.js +++ b/src/routes/forms.js @@ -32,7 +32,7 @@ router.get(`${config.site_path}/${config.signup_url}`, (req,res) => { } // If allow_signup is undefined or not a boolean, error else { - res.redirect(301,"/") + res.redirect(301,config.site_path) console.log("Error, invalid value for allow_signup (bool)") } }); // /signup diff --git a/src/routes/standard_pages.js b/src/routes/standard_pages.js index e5f8ad0..8dde9d4 100644 --- a/src/routes/standard_pages.js +++ b/src/routes/standard_pages.js @@ -89,7 +89,7 @@ router.get(`${config.site_path}/post/:post_index`, (req, res) => { } else { console.log("Error loading page") - res.redirect(301,"/") + res.redirect(301,config.site_path) } }); // /post/:post_index diff --git a/src/server.js b/src/server.js index 7bf6280..44544b6 100644 --- a/src/server.js +++ b/src/server.js @@ -50,6 +50,9 @@ function perform_checks() 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'] // 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 switch (config.data_storage)