From e0a0c57c44b0e083f614d90d0e7a0638553e73f1 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 13 Jun 2022 05:18:54 +0000 Subject: [PATCH] Use platform specific default avatar pictures --- images/default/diaspora.png | Bin 0 -> 1736 bytes images/default/mastodon.png | Bin 0 -> 3292 bytes images/default/peertube.png | Bin 0 -> 4024 bytes images/default/pleroma.png | 738 ++++++++++++++++++++++++++++++++++++ src/Model/Contact.php | 33 ++ src/Module/Photo.php | 2 +- 6 files changed, 772 insertions(+), 1 deletion(-) create mode 100644 images/default/diaspora.png create mode 100644 images/default/mastodon.png create mode 100644 images/default/peertube.png create mode 100644 images/default/pleroma.png diff --git a/images/default/diaspora.png b/images/default/diaspora.png new file mode 100644 index 0000000000000000000000000000000000000000..53d10ffc0371cdf94146121da55755662219df9f GIT binary patch literal 1736 zcmV;(1~>VMP)~DVD)9LZ8b$(haobM4)sl0H zA;cI{E^X}c%di!v(Mk%Rl^S9FyP`@A_ml=<$w>XL*a+)a^*tf=u0mMvsDeoA7uRxF zJqNK?8$HfJ^{!mURbiFz4aH^2YbC4}!*`WRzZ9&I!;ciR`2t%8tA+_OcKlVaa+ssk z-NPCwOj91dVg10_muCAFuu7P$INZX@VY*^>3QK|2o0>~lI;?DH!3nDnsykSEtSo5R z!YV;i-4(2+$|@vJuzFBdaRe)B!_qE9_%Qd6aOwqC4F)PcV2xlRAF#3wtmXk$vtgwh zAFN97nJma4;>z{-RrmnAFBW*XkA z@N`(2uy$*q4N@t*RpH^V3Sn)TNR>~-3}6Mq5~~}-DksCLgte`|pA9P;!^$VaN`$rJ zkkkPzV^*4@Qgv8^u=b5vnsa4!SdFmu&7?=evd*NMcSF=+Wy0DwlO7E#n!_4|MOcKj z8dg6SRv@gMVKu_q;l#ortU_2j%xE0K(#sAWVO7G~U}@jBFD%oqqolJP%NCYqj<4QeX->9=J6L*!7;pYy^^^BP z^H26^Ev@DeRyo%`l!>Whwg-c+~U0Q~gwFFi< zu`gT&YaAKh7r~l3T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ybuCKP`>Ty**ZT${((y z%c8}-NAemx!CuM6>Yub}ss7}%s_{drQjpt9`vC5mrCwmlubbO%Sqoi(jG3lTcgYcB z9Q`9z&51KuZJXV%wC{53s;B|n*MkF-te14m3n;-1Ih;Xhq0j6m-}z~g5S=*u-)68x z;lz3@MPASQZSmw*-xY*qIb%LtU^QfSdRoY=?vTHt#o6b$#(K%HG{k)Ho%W3Y_V)H5 zUT>7zh`xA!z>1UoqdQaed~TX1zUPg8vL1%EFMV#G#ufkgjqJf4iK0tx84L3laVvN@ zJao6fAX>LRpvdz9)I15t);~RSjzUe;o&K7aGW4%Azs4oL3w{;pHo<1ox7ptuh){7n zip)GYBxr8in41-M22dq#!N&Jb{EsT!n+LrR(!ko%-`;@79@ZOUyT?$D za+Fibkqei&DkGIqGNSIcP0*jmr~>n4Mij-FWWo)k`I16?&fzl1jh*GxsjF_s8=L5eXnCE`?8% zcD1mg#`ScFTnpV!fqYWis6he T1m@pU{u3x2G_pqP0p|YzWF96{ literal 0 HcmV?d00001 diff --git a/images/default/peertube.png b/images/default/peertube.png new file mode 100644 index 0000000000000000000000000000000000000000..e24741815e594a8bbcb9ff63de0ae4f808942cd3 GIT binary patch literal 4024 zcmbuBRag^_8pgNLLj)wGOB6;4juZw1CN;Vn5h;Pm04b5~E@_b*-8n)S5>nEL(n$T4 z?sUggOfzhT+}m8VEmi54c@a{$d?D z+9G%;{Y?|)ma>;+?1)N6mP1Tr>-v8&OY~WO^!@s^ z-(B`2T5jze+3q8IAWBrddX+i9*fk-vZ0S9+dgas(Ij6DO3tDhrIVOABur!vSG`Uyf zd4E6XR~t%K@UpP%md#;-H34!iAv@Y8bT!{0`m#ebEGqb%zxDYT)|@`{_q+po%Y1tv z^O_-fl`DTKWHm8;16Doj?=c>e!tS-Xcs} z5j?7)JZijc-&k1gwEzCrqQXgJb;1MsOL86-p8p`E*VPiql3C;WaZE=l+Qk!a8JhXQ zruCOhsq@c*>}u@pEcUL1u*lU0)M!6~vZN|>r-EG`9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o&oqMCFXAkkSNY|9H;X!!!k?0Z?9uF+^hU5>#y<^5bt4gl}xO)gOe*I=hO%pVvenb>e zy5oJ#$)+szV`9rx)Mub!WzsttM9i@K?Zr_^5#l}H&sg`5%GeHRT8nN*&6ZA&WRSgN zKa8zdC@&4`oJf2-&9H7az6VW%i~E2V?Pya zbL+^R8ph=%K>s1zj=AX@O`oEc))O{zSe z7C7L3N6llAUP{K>cf3_p9vPpSohUZJ%Qt|Ek-8<%rgU5?;fbAJouP>a_gdGw?R-;i ztdPNT;7qJC_iJ*NYp=<5m;P;S4OO_54XNfo3)^RHX$2di8-6H`cggo$sT?6I&kF$m zSFHX!iiujBdGE2i7Ee>pJd}y(Yjf+KZNR}K;y`WNyj@eM4fGp`ymZQ;U7Qwuy}Xxf zFhzWtO4wm1SZFoFAav7`HzeE?Yg+wGdVx`ziXHU1+V((E^USDVFD$kmL0}{uNNtQvnK_i8f@%$6eLR&-0;csML z{q~*>`+KdkrMoji_;a>MJ5Sa<3ta6vOH@O|3@-#*2#nlJnH}l@cP5pa#zC`X>?1Ty s5 + + + +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;