selfhostable, read-only reddit client

minor fixes

- avoid extra sort & view options on /comments
- avoid extra sort & view options on /r/sub in post card

Changed files
+4 -4
src
+2 -2
src/mixins/post.pug
··· 25 25 |  ·  26 26 | #{timeDifference(Date.now(), p.created * 1000)} 27 27 |  ·  28 - a(href=`/r/${p.subreddit}?sort=${sortQuery}&view=${viewQuery}`) r/#{p.subreddit} 28 + a(href=`/r/${p.subreddit}`) r/#{p.subreddit} 29 29 |  ·  30 - a(href=`/comments/${p.id}?from=${from}&sort=${sortQuery}&view=${viewQuery}`) #{fmtnum (p.num_comments)} ↩ 30 + a(href=`/comments/${p.id}?from=${from}`) #{fmtnum (p.num_comments)} ↩ 31 31 if (query.view == "card" && !isPostMedia(p) && p.selftext_html) 32 32 div.self-text-overflow.card 33 33 if p.spoiler || p.over_18
+2 -2
src/mixins/postUtils.pug
··· 60 60 // Find all anchors that href to preview.redd.it, i.redd.it, i.imgur.com 61 61 // and contain just a link to the same href 62 62 const expression = /<a href="(http[s]?:\/\/(?:preview\.redd\.it|i\.redd\.it|i\.imgur\.com).*?)">\1?<\/a>/g; 63 - const matches = html.matchAll(expression); 63 + const matches = Array.from(html.matchAll(expression)); 64 64 var result = html; 65 65 matches.forEach((match) => { 66 66 // Replace each occurrence with an actual img tag ··· 85 85 var poster_url = p.preview && p.preview.images ? p.preview.images[0].source.url.replace(expression, '&') : ''; 86 86 87 87 return [hls_url, dash_url, fallback_url, scrubber_url, poster_url]; 88 - } 88 + }