From: Michael Date: Mon, 13 Jun 2022 05:18:54 +0000 (+0000) Subject: Use platform specific default avatar pictures X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e0a0c57c44b0e083f614d90d0e7a0638553e73f1;p=friendica.git Use platform specific default avatar pictures --- diff --git a/images/default/diaspora.png b/images/default/diaspora.png new file mode 100644 index 0000000000..53d10ffc03 Binary files /dev/null and b/images/default/diaspora.png differ diff --git a/images/default/mastodon.png b/images/default/mastodon.png new file mode 100644 index 0000000000..34c8e45e61 Binary files /dev/null and b/images/default/mastodon.png differ diff --git a/images/default/peertube.png b/images/default/peertube.png new file mode 100644 index 0000000000..e24741815e Binary files /dev/null and b/images/default/peertube.png differ diff --git a/images/default/pleroma.png b/images/default/pleroma.png new file mode 100644 index 0000000000..886eaee54d --- /dev/null +++ b/images/default/pleroma.png @@ -0,0 +1,738 @@ + + + + +priv/static/images/avi.png · develop · Pleroma / pleroma · GitLab + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + +
+ +
+ + +
+
+ +
+ + +
+
+
+
+
+
+ + + +
+ + + +
+
+ + +
+
+
+
+
+
+
+ + + + + + + + + diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 59b14ad0fe..172540dd1f 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -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; } diff --git a/src/Module/Photo.php b/src/Module/Photo.php index 134cade650..86c737aa4e 100644 --- a/src/Module/Photo.php +++ b/src/Module/Photo.php @@ -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;