mirror of
https://codeberg.org/teddit/teddit
synced 2025-02-21 14:31:02 +01:00
make the wikipagelisting logic a bit cleanier
This commit is contained in:
parent
b5fe2e1c1f
commit
933a70cc83
20
routes.js
20
routes.js
@ -965,19 +965,11 @@ module.exports = (app, redis, fetch, RedditAPI) => {
|
|||||||
if(json) {
|
if(json) {
|
||||||
console.log(`Got /r/${subreddit} wiki key from redis.`)
|
console.log(`Got /r/${subreddit} wiki key from redis.`)
|
||||||
json = JSON.parse(json)
|
json = JSON.parse(json)
|
||||||
if(page !== 'pages') {
|
|
||||||
return res.render('subreddit_wiki', {
|
return res.render('subreddit_wiki', {
|
||||||
content_html: unescape(json.data.content_html),
|
content_html: (page !== 'pages' ? unescape(json.data.content_html) : formatWikipagelisting(json, subreddit)),
|
||||||
subreddit: subreddit,
|
subreddit: subreddit,
|
||||||
user_preferences: req.cookies
|
user_preferences: req.cookies
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
return res.render('subreddit_wiki', {
|
|
||||||
content_html: formatWikipagelisting(json, subreddit),
|
|
||||||
subreddit: subreddit,
|
|
||||||
user_preferences: req.cookies
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
let url = ''
|
let url = ''
|
||||||
if(config.use_reddit_oauth)
|
if(config.use_reddit_oauth)
|
||||||
@ -995,19 +987,11 @@ module.exports = (app, redis, fetch, RedditAPI) => {
|
|||||||
return res.render('subreddit', { json: null, user_preferences: req.cookies })
|
return res.render('subreddit', { json: null, user_preferences: req.cookies })
|
||||||
} else {
|
} else {
|
||||||
console.log(`Fetched the JSON from reddit.com/r/${subreddit}/wiki.`)
|
console.log(`Fetched the JSON from reddit.com/r/${subreddit}/wiki.`)
|
||||||
if(page !== 'pages') {
|
|
||||||
return res.render('subreddit_wiki', {
|
return res.render('subreddit_wiki', {
|
||||||
content_html: unescape(json.data.content_html),
|
content_html: (page !== 'pages' ? unescape(json.data.content_html) : formatWikipagelisting(json, subreddit)),
|
||||||
subreddit: subreddit,
|
subreddit: subreddit,
|
||||||
user_preferences: req.cookies
|
user_preferences: req.cookies
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
return res.render('subreddit_wiki', {
|
|
||||||
content_html: formatWikipagelisting(json, subreddit),
|
|
||||||
subreddit: subreddit,
|
|
||||||
user_preferences: req.cookies
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user