Merge pull request 'Support redd.it short url redirections' (#290) from austinhuang.me/teddit:austinhuang.me-patch-3 into main

Reviewed-on: https://codeberg.org/teddit/teddit/pulls/290
This commit is contained in:
teddit 2022-01-29 14:40:08 +01:00
commit e87b811883
1 changed files with 10 additions and 0 deletions

View File

@ -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}`;