mirror of
https://codeberg.org/tacerus/teddit.git
synced 2024-11-25 16:49:26 +01:00
encode url for fetching suggested subreddits
This commit is contained in:
parent
9b14f25d31
commit
543f01641c
@ -925,7 +925,7 @@ module.exports = (app, redis, fetch, RedditAPI) => {
|
|||||||
json.suggested_subreddits = {}
|
json.suggested_subreddits = {}
|
||||||
if(restrict_sr === 'off' && before == '' && after == '') {
|
if(restrict_sr === 'off' && before == '' && after == '') {
|
||||||
let url = `https://reddit.com/subreddits/search.json?q=${q}&include_over_18=${nsfw}&limit=3`
|
let url = `https://reddit.com/subreddits/search.json?q=${q}&include_over_18=${nsfw}&limit=3`
|
||||||
const response = await fetch(url)
|
const response = await fetch(encodeURI(url))
|
||||||
const data = await response.json()
|
const data = await response.json()
|
||||||
json.suggested_subreddits = data
|
json.suggested_subreddits = data
|
||||||
}
|
}
|
||||||
|
@ -121,9 +121,9 @@ html
|
|||||||
h2 #{suggested_subreddit.data.display_name_prefixed}: #{cleanTitle(suggested_subreddit.data.title)}
|
h2 #{suggested_subreddit.data.display_name_prefixed}: #{cleanTitle(suggested_subreddit.data.title)}
|
||||||
.sub-button
|
.sub-button
|
||||||
if subbed_to_this_subreddit
|
if subbed_to_this_subreddit
|
||||||
a(href="/unsubscribe/" + suggested_subreddit.data.display_name + "?b=/r/" + subreddit + "?q=" + q + "§nsfw=" + nsfw + "", class="sub-to-subreddit gray", title="subscriptions are saved in your browser's cookies") unsubscribe
|
a(href="/unsubscribe/" + suggested_subreddit.data.display_name + "?b=/r/" + subreddit + "/search?q=" + q + "§nsfw=" + nsfw + "", class="sub-to-subreddit gray", title="subscriptions are saved in your browser's cookies") unsubscribe
|
||||||
else
|
else
|
||||||
a(href="/subscribe/" + suggested_subreddit.data.display_name + "?b=/r/" + subreddit + "?q=" + q + "§nsfw=" + nsfw + "", class="sub-to-subreddit", title="subscriptions are saved in your browser's cookies") subscribe
|
a(href="/subscribe/" + suggested_subreddit.data.display_name + "?b=/r/" + subreddit + "/search?q=" + q + "§nsfw=" + nsfw + "", class="sub-to-subreddit", title="subscriptions are saved in your browser's cookies") subscribe
|
||||||
.description
|
.description
|
||||||
p #{cleanTitle(suggested_subreddit.data.public_description)}
|
p #{cleanTitle(suggested_subreddit.data.public_description)}
|
||||||
.meta
|
.meta
|
||||||
|
Loading…
Reference in New Issue
Block a user