Use platform specific default avatar pictures
This commit is contained in:
parent
05a76a3dc2
commit
e0a0c57c44
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
File diff suppressed because one or more lines are too long
|
@ -1817,6 +1817,39 @@ class Contact
|
|||
}
|
||||
|
||||
if (!DI::config()->get('system', 'remote_avatar_lookup')) {
|
||||
$platform = '';
|
||||
|
||||
if (!empty($contact['id'])) {
|
||||
$account = DBA::selectFirst('account-user-view', ['platform'], ['id' => $contact['id']]);
|
||||
$platform = $account['platform'] ?? '';
|
||||
}
|
||||
|
||||
if (empty($platform) && !empty($contact['uri-id'])) {
|
||||
$account = DBA::selectFirst('account-user-view', ['platform'], ['uri-id' => $contact['uri-id']]);
|
||||
$platform = $account['platform'] ?? '';
|
||||
}
|
||||
|
||||
switch ($platform) {
|
||||
case 'mastodon':
|
||||
// @see https://github.com/mastodon/mastodon/tree/main/public/avatars/original/missing.png
|
||||
$default = '/images/default/mastodon.png';
|
||||
break;
|
||||
|
||||
case 'pleroma':
|
||||
// @see https://git.pleroma.social/pleroma/pleroma/-/blob/develop/priv/static/images/avi.png
|
||||
$default = '/images/default/pleroma.png';
|
||||
break;
|
||||
|
||||
case 'diaspora':
|
||||
// @see https://github.com/diaspora/diaspora/
|
||||
$default = '/images/default/diaspora.png';
|
||||
break;
|
||||
|
||||
case 'peertube':
|
||||
// @see https://github.com/Chocobozzz/PeerTube/blob/develop/client/src/assets/images/default-avatar-video-channel.png
|
||||
$default = '/images/default/peertube.png';
|
||||
break;
|
||||
}
|
||||
return DI::baseUrl() . $default;
|
||||
}
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ class Photo extends BaseModule
|
|||
|
||||
return MPhoto::createPhotoForExternalResource($link['url'], (int)local_user(), $link['mimetype']);
|
||||
case "contact":
|
||||
$fields = ['uid', 'url', 'nurl', 'avatar', 'photo', 'xmpp', 'addr', 'network', 'failed', 'updated'];
|
||||
$fields = ['uid', 'uri-id', 'url', 'nurl', 'avatar', 'photo', 'xmpp', 'addr', 'network', 'failed', 'updated'];
|
||||
$contact = Contact::getById($id, $fields);
|
||||
if (empty($contact)) {
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue
Block a user