lemmy/crates/utils
Nick Webster a57658d99c
Adding a new config flag to disable pictrs caching for thumbnails (#3897)
* add logic to prevent downloading remote pictrs images

* apply formatting

* Do not attempt a pictrs fetch if the remote image is also on a pictrs instance

* Do not attempt a pictrs fetch if the remote image is also on a pictrs instance and cache_federated_images is false

* Generalising the no caching option to handle all remote images

* rustfmt

* Return None if the URL is not an image

* Updating defaults.hjson

* fixing typo

* Fixing typo

* Skip cloning the Url unless we need to

* using a HEAD request for checking the content type, saving bandwidth/improving perf

* Removing early returns

* Switching back to GET requests for Content-Type because pictrs does not handle HEAD requests

* Simplifying logic and using metadata_image instead of url if we do not get a pictrs thumbnail

* Removing unused import

* Return None as a thumbnail if caching is disabled

* formatting

---------

Co-authored-by: Djones4822 <david.jones4822@gmail.com>
2023-08-31 10:36:39 -04:00
..
src Adding a new config flag to disable pictrs caching for thumbnails (#3897) 2023-08-31 10:36:39 -04:00
translations@713ceed9c7 Implement remote follow (#3738) 2023-08-31 09:00:41 -04:00
build.rs Add email translations (#2175) 2022-03-29 18:23:03 +00:00
Cargo.toml disable rustfmt feature on rosetta-build (#3679) 2023-07-21 11:50:47 +02:00