diff --git a/plugins/avatars/avatars.js b/plugins/avatars/avatars.js index 7265be123..ba872301e 100644 --- a/plugins/avatars/avatars.js +++ b/plugins/avatars/avatars.js @@ -7,7 +7,7 @@ getAvatarUid = msg => { let from = msg.from[0], bimi = 'pass' == from.dkimStatus ? 1 : 0; - return `${bimi}/${from.email}`; + return `${bimi}/${from.email.toLowerCase()}`; }, getAvatar = msg => avatars.get(getAvatarUid(msg)), runQueue = (() => { diff --git a/plugins/avatars/index.php b/plugins/avatars/index.php index aa1204af5..e41d11596 100644 --- a/plugins/avatars/index.php +++ b/plugins/avatars/index.php @@ -7,11 +7,11 @@ class AvatarsPlugin extends \RainLoop\Plugins\AbstractPlugin AUTHOR = 'SnappyMail', URL = 'https://snappymail.eu/', VERSION = '1.0', - RELEASE = '2022-11-11', + RELEASE = '2022-11-23', REQUIRED = '2.22.0', CATEGORY = 'Contacts', LICENSE = 'MIT', - DESCRIPTION = ''; + DESCRIPTION = 'Show photo of sender in message and messages list (supports BIMI and Gravatar, Contacts is still TODO)'; public function Init() : void { @@ -21,6 +21,9 @@ class AvatarsPlugin extends \RainLoop\Plugins\AbstractPlugin $this->addPartHook('Avatar', 'ServiceAvatar'); } + /** + * POST method handling + */ public function DoAvatar() : array { $bBimi = !empty($this->jsonParam('bimi')); @@ -35,6 +38,11 @@ class AvatarsPlugin extends \RainLoop\Plugins\AbstractPlugin return $this->jsonResponse(__FUNCTION__, $aResult); } + /** + * GET /?Avatar/${bimi}/${from.email} + * Not fond of this idea because email address is exposed + * Maybe use btoa(from.email) or Crypto.subtle.encrypt({name:'AES-GCM',iv:''}, token, from.email) + */ // public function ServiceAvatar(...$aParts) public function ServiceAvatar(string $sServiceName, string $sBimi, string $sEmail) {