From 08437d86631f790b1138c8219a59d2ccacb24bb9 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Wed, 26 Jan 2022 13:52:36 -0500 Subject: [PATCH] Support redd.it short url redirections Close #273 --- routes/home.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/routes/home.js b/routes/home.js index 1430ffb..916b107 100644 --- a/routes/home.js +++ b/routes/home.js @@ -32,6 +32,16 @@ homeRoute.get('/:sort?', async (req, res, next) => { } } + let is_comment = + sortby.length == 6 && + sortby != "rising" + ? true + : false; + + if (is_comment) { + return res.redirect('/comments/' + sortby); + } + let d = `&after=${after}`; if (before) { d = `&before=${before}`;