-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache brand images #17840
Cache brand images #17840
Conversation
Brands PR is merged, so this should be good to go for 2023.10. I'll verify in a week when it should be fully propagated to Cloudflare. |
So I made a few fixes, namely:
The remaining issues have to do with Netlify and the brands repo:
|
I think we should just create a webcomponent that handles the 404's and never use the fallback/placeholder url... |
I already realized there is no way not to cache everything twice without some sort of intervention like that, or alternatively having logic in the SW to handle it. In any case, I've got a change almost done for the brands repo to deal with Netlify's shortcomings on CORS, so the double caching can be dealt with as a follow up. The images are small enough that it won't really blow up anything anyway. |
ccd1f4b
to
98c44ab
Compare
Regarding using a custom element and no fallback URLs, it also just occurred to me that:
|
True, but I think we can work with just |
Sure, but do you want that restriction going forward (on use of a server that HA controls nonetheless)? Aside from that, the bother for me is that it's still just an unnecessary extra network request. It would be mitigated a bit by caching the 404s too, but still. Anyway, what we're discussing here only solves the problem when the service worker is working. Adjustments are needed when it isn't: home-assistant/brands#4718. I opened a PR that will unblock this and fix that too: home-assistant/brands#4722 |
d4fb836
to
18da1eb
Compare
83b8968
to
a3e2451
Compare
a3e2451
to
ee8ad96
Compare
Proposed change
Needs home-assistant/brands#4652
Enable the service worker to cache any brand images used for speed and in case of a power/internet outage. Need to enable CORS so JS can read the response, otherwise the allocated cache size is heavily padded due to the opaque response.
Also...
referrerpolicy="no-referrer"
attributesStaleWhileRevalidate
accepts opaque responses by default)Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: