Merge pull request 'Display profile icons' (#169) from StevenNMeza/teddit:profile_picture into main

Reviewed-on: https://codeberg.org/teddit/teddit/pulls/169
This commit is contained in:
teddit 2021-03-22 19:24:51 +01:00
commit 489a8dd864
5 changed files with 6 additions and 2 deletions

View File

@ -55,7 +55,7 @@ const config = {
new_page: 60
},
},
valid_media_domains: ['preview.redd.it', 'external-preview.redd.it', 'i.redd.it', 'v.redd.it', 'a.thumbs.redditmedia.com', 'b.thumbs.redditmedia.com', 'emoji.redditmedia.com', 'thumbs.gfycat.com', 'i.ytimg.com'],
valid_media_domains: ['preview.redd.it', 'external-preview.redd.it', 'i.redd.it', 'v.redd.it', 'a.thumbs.redditmedia.com', 'b.thumbs.redditmedia.com', 'emoji.redditmedia.com', 'styles.redditmedia.com', 'www.redditstatic.com', 'thumbs.gfycat.com', 'i.ytimg.com'],
valid_embed_video_domains: ['gfycat.com', 'youtube.com'],
reddit_api_error_text: `Seems like your instance is either blocked (e.g. due to API rate limiting), reddit is currently down, or your API key is expired and not renewd properly. This can also happen for other reasons.`
};

View File

@ -51,6 +51,8 @@ module.exports = function(tools) {
dir = 'thumbs/'
if(file_prefix === 'flair_')
dir = 'flairs/'
if(file_prefix === 'icon_')
dir = 'icons/'
if(valid_video_extensions.includes(file_ext) || gifmp4) {
/* Is video. */

View File

@ -99,7 +99,7 @@ module.exports = function() {
let obj = {
username: about.name,
icon_img: about.icon_img,
icon_img: await downloadAndSave(about.icon_img, "icon_"),
created: about.created_utc,
verified: about.verified,
link_karma: about.link_karma,

View File

@ -4,4 +4,5 @@
!.gitignore
!flairs/
!thumbs/
!icons/

View File

@ -70,6 +70,7 @@ html
li(class=past === 'all' ? 'active' : '')
a(href="?sort=" + sortby + "&t=all") all time
.info
img(src=data.icon_img)
h1 #{data.username}
p(class="user-stat") <span>#{kFormatter(data.link_karma)}</span> post karma
p(class="user-stat") <span>#{kFormatter(data.comment_karma)}</span> comment karma