Detect whether an WEBP or APNG is animated #161

Merged
floatingghost merged 2 commits from Mergan/pleroma-fe:animated-webp into develop 2022-09-23 10:27:15 +00:00
Member
No description provided.
Mergan added 2 commits 2022-09-09 11:29:59 +00:00
ci/woodpecker/pr/woodpecker Pipeline was successful Details
9d3a32a636
Detect Animation only for mediaProxy
Works without, but this should suppress CORS browser errors
floatingghost reviewed 2022-09-19 17:51:10 +00:00
@ -34,0 +47,4 @@
if (!this.$store.state.instance.mediaProxyAvailable) return
// Animated JPEGs?
if (!(this.src.endsWith('.webp') || this.src.endsWith('.png'))) return
// Browser Cache should ensure image doesn't get loaded twice if cache exists

we can enforce this by setting cache: 'only-if-cached' in the fetch options

see: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#supplying_request_options

probably worth setting

otherwise this looks good

we can enforce this by setting `cache: 'only-if-cached'` in the fetch options see: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#supplying_request_options probably worth setting otherwise this looks good
Author
Member

There seemed to be no difference when I tested that, but I think I found out why

Should I still add it anyway?

There seemed to be no difference when I tested that, but I think I found out [why](https://caniuse.com/mdn-api_request_cache_only_if_cached) Should I still add it anyway?

nah you're good, i didn't realise there was no support

is good as-is

thanks!

nah you're good, i didn't realise there was no support is good as-is thanks!
floatingghost marked this conversation as resolved
floatingghost merged commit 468eb12573 into develop 2022-09-23 10:27:15 +00:00
floatingghost deleted branch animated-webp 2022-09-23 10:27:15 +00:00
Sign in to join this conversation.
No description provided.