Use platform specific default avatar pictures

This commit is contained in:
Michael 2022-06-13 05:18:54 +00:00
parent 05a76a3dc2
commit e0a0c57c44
6 changed files with 772 additions and 1 deletions

BIN
images/default/diaspora.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
images/default/mastodon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
images/default/peertube.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

738
images/default/pleroma.png Normal file

File diff suppressed because one or more lines are too long

View File

@ -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;
}

View File

@ -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;