This commit is contained in:
the-djmaze 2024-08-27 16:47:44 +02:00
parent 5e4520e10c
commit 1ad946d013
12 changed files with 47 additions and 36 deletions

View file

@ -116,12 +116,16 @@ class AvatarsPlugin extends \RainLoop\Plugins\AbstractPlugin
* Nextcloud Mail uses insecure unencrypted 'index.php/apps/mail/api/avatars/url/local%40example.com'
*/
// public function ServiceAvatar(...$aParts)
public function ServiceAvatar(string $sServiceName, string $sBimi, string $sEmail)
public function ServiceAvatar(string $sServiceName, string $sBimi, string $sEncryptedEmail)
{
$sEmail = \SnappyMail\Crypt::DecryptUrlSafe($sEmail);
$maxAge = 86400;
$sEmail = \SnappyMail\Crypt::DecryptUrlSafe($sEncryptedEmail);
$aBimi = \explode('-', $sBimi, 2);
$sBimiSelector = isset($aBimi[1]) ? $aBimi[1] : 'default';
// $sEmail && \MailSo\Base\Http::setETag("{$sBimiSelector}-{$sEncryptedEmail}");
if ($sEmail && ($aResult = $this->getAvatar($sEmail, !empty($aBimi[0]), $sBimiSelector))) {
\header("Cache-Control: max-age={$maxAge}, private");
\header('Expires: '.\gmdate('D, j M Y H:i:s', $maxAge + \time()).' UTC');
\header('Content-Type: '.$aResult[0]);
echo $aResult[1];
} else {