fix gallery urls #95

This commit is contained in:
teddit 2021-01-04 17:42:22 +01:00
parent a13b7d9ed7
commit d3444d1f4a

View File

@ -41,6 +41,8 @@ module.exports = function(request, fs) {
let u = new URL(url) let u = new URL(url)
if(u.host === 'www.reddit.com' || u.host === 'reddit.com') { if(u.host === 'www.reddit.com' || u.host === 'reddit.com') {
url = url.replace(u.host, config.domain) url = url.replace(u.host, config.domain)
if(u.pathname.startsWith('/gallery/'))
url = url.replace('/gallery/', '/comments/')
} }
if(u.host === 'i.redd.it' || u.host === 'v.redd.it') { if(u.host === 'i.redd.it' || u.host === 'v.redd.it') {
let image_exts = ['png', 'jpg', 'jpeg'] let image_exts = ['png', 'jpg', 'jpeg']