mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 15:45:55 +08:00
parent
69d92ee184
commit
aca3490331
|
@ -45,11 +45,9 @@
|
|||
bimiSelector = bimiSelector ? bimiSelector.match(/;.*s=([^\s;]+)/)[1] : '';
|
||||
return bimiSelector || '';
|
||||
},
|
||||
getAvatarUid = msg => {
|
||||
let from = msg.from[0],
|
||||
bimi = ('pass' == from.dkimStatus ? 1 : 0) + '-' + getBimiSelector(msg);
|
||||
return `${bimi}/${from.email.toLowerCase()}`;
|
||||
},
|
||||
getBimiId = msg => ('pass' == msg.from[0].dkimStatus ? 1 : 0) + '-' + getBimiSelector(msg),
|
||||
getAvatarUrl = msg => `?Avatar/${getBimiId(msg)}/${msg.avatar}`,
|
||||
getAvatarUid = msg => `${getBimiId(msg)}/${msg.from[0].email.toLowerCase()}`,
|
||||
getAvatar = msg => ncAvatars.get(msg.from[0].email.toLowerCase()) || avatars.get(getAvatarUid(msg)),
|
||||
hash = async txt => {
|
||||
if (/^[0-9a-f]{15,}$/i.test(txt)) {
|
||||
|
@ -181,7 +179,7 @@
|
|||
fn(msg.avatar);
|
||||
} else {
|
||||
element.onerror = () => setIdenticon(from, fn);
|
||||
fn(`?Avatar/${'pass' == from.dkimStatus ? 1 : 0}/${msg.avatar}`);
|
||||
fn(getAvatarUrl(msg));
|
||||
}
|
||||
} else {
|
||||
addQueue(msg, fn);
|
||||
|
@ -221,8 +219,7 @@
|
|||
if (url) {
|
||||
fn(url);
|
||||
} else if (msg.avatar) {
|
||||
fn(msg.avatar.startsWith('data:') ? msg.avatar
|
||||
: `?Avatar/${'pass' == msg.from[0].dkimStatus ? 1 : 0}/${msg.avatar}`);
|
||||
fn(msg.avatar.startsWith('data:') ? msg.avatar : getAvatarUrl(msg));
|
||||
} else {
|
||||
// let from = msg.from[0];
|
||||
// view.viewUserPic(`?Avatar/${'pass' == from.dkimStatus ? 1 : 0}/${encodeURIComponent(from.email)}`);
|
||||
|
|
|
@ -10,8 +10,8 @@ class AvatarsPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
NAME = 'Avatars',
|
||||
AUTHOR = 'SnappyMail',
|
||||
URL = 'https://snappymail.eu/',
|
||||
VERSION = '1.15',
|
||||
RELEASE = '2024-01-22',
|
||||
VERSION = '1.14',
|
||||
RELEASE = '2024-01-17',
|
||||
REQUIRED = '2.25.0',
|
||||
CATEGORY = 'Contacts',
|
||||
LICENSE = 'MIT',
|
||||
|
@ -69,10 +69,6 @@ class AvatarsPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
$mFrom = $mFrom->jsonSerialize();
|
||||
}
|
||||
if (\is_array($mFrom)) {
|
||||
if ('pass' == $mFrom['dkimStatus'] && $this->Config()->Get('plugin', 'service', true)) {
|
||||
// 'data:image/png;base64,[a-zA-Z0-9+/=]'
|
||||
return static::getServiceIcon($mFrom['email']);
|
||||
}
|
||||
if (!$this->Config()->Get('plugin', 'delay', true)
|
||||
&& ($this->Config()->Get('plugin', 'gravatar', false)
|
||||
|| ($this->Config()->Get('plugin', 'bimi', false) && 'pass' == $mFrom['dkimStatus'])
|
||||
|
@ -84,6 +80,10 @@ class AvatarsPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
} catch (\Throwable $e) {
|
||||
\SnappyMail\Log::error('Crypt', $e->getMessage());
|
||||
}
|
||||
if ('pass' == $mFrom['dkimStatus'] && $this->Config()->Get('plugin', 'service', true)) {
|
||||
// 'data:image/png;base64,[a-zA-Z0-9+/=]'
|
||||
return static::getServiceIcon($mFrom['email']);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue