the-djmaze / snappymail

Simple, modern & fast web-based email client
https://snappymail.eu
GNU Affero General Public License v3.0
984 stars 115 forks source link

Optimize BIMI image in list view #714

Closed chrisdent closed 1 year ago

chrisdent commented 1 year ago

Bimi extension is nice and gives security to users. Every time the list view is loaded the Bimi image starts on top one by one and goes down.

Is there a possibility to optimize the load of bimi image in list view? Maybe a cache? so it doesn´t load mail by mail? And when the list view is loaded all bimi images are loaded together?

the-djmaze commented 1 year ago

Due to the content security policy remote images is not an option. Instead, the server is used as proxy and for every image a PHP request must be made.

This is for images in an email, but also for sender avatar/photo.

To prevent many requests per second to the server, the loading of the images is reduced to 1 per second, uses 24 hour caching of the images on the server and caches them in Javascript (not localstorage yet).

Later this might could be made optional depending on server load so that server admin can decide.

the-djmaze commented 1 year ago

Secondly, the requests are POST method to prevent leaking of the email addresses through the GET url in many ways (as urls are never fully protected and logged on server, browser extensions, network transfers, etc.)

https://github.com/the-djmaze/snappymail/blob/a085bbb51d37ed5ab2377d8a9e67e749a5fbca00/plugins/avatars/index.php#L41-L48

the-djmaze commented 1 year ago

I've added it as option for next release. It will require v2.22.4+ because i had to change some things in the core.

the-djmaze commented 1 year ago

I've noticed that when i enable the fast loading of avatars on one of my PHP-FPM setups. The system response is sometimes 504 Gateway Timeout and the PHP-FPM process must be reloaded/restarted.

Could be issue in PHP 8.2.0RC7 or something else.

the-djmaze commented 1 year ago

Released and added support for identicons. That makes the list a bit happier. afbeelding