Added reddit avatar URL detection and avoid option.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const config = require('config');
|
||||
const urlPattern = require('url-pattern');
|
||||
|
||||
const interpolate = require('../interpolate.js');
|
||||
const fetchItem = require('../fetch/item.js');
|
||||
@@ -11,6 +12,12 @@ function saveProfileDetails(user) {
|
||||
if(config.library.profile.image) {
|
||||
const image = user.profile ? user.profile.image : user.image;
|
||||
|
||||
if(config.library.profile.ignoreAvatar && new urlPattern('http(s)\\://(www.)redditstatic.com/avatars/:id(.:ext)(?:query)').match(image)) {
|
||||
console.log('\x1b[33m%s\x1b[0m', `Ignoring standard avatar profile image for '${user.name}'`);
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
const filepath = interpolate(config.library.profile.image, user, null, {
|
||||
// pass profile image as item to interpolate extension variable
|
||||
url: image
|
||||
|
||||
Reference in New Issue
Block a user