Skip to content
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 feed icons #2856

Closed
1 task done
APT37 opened this issue Sep 17, 2024 · 4 comments
Closed
1 task done

Cache feed icons #2856

APT37 opened this issue Sep 17, 2024 · 4 comments
Labels

Comments

@APT37
Copy link

APT37 commented Sep 17, 2024

Since feed icons are fetched only once (when the feed is added) and never refreshed afterwards, I think it'd be a good idea to let the local device cache them instead of loading them from the server every time.

Maybe a feature to update feed icons would be useful too - maybe even support for custom icons.

@APT37 APT37 added the wishlist label Sep 17, 2024
@xfzv
Copy link

xfzv commented Sep 18, 2024

Relevant PR (at least for the refreshing part): #2123

@APT37
Copy link
Author

APT37 commented Sep 18, 2024

I see. Good to know that's already being worked on. After reading the PR comments, it seems like a whole different can of worms on it's own.

Of course this doesn't have anything to do with caching, haha.

@fguillot
Copy link
Member

fguillot commented Oct 5, 2024

Feed icons are already cached in the browser for at least 72 hours.

response.New(w, r).WithCaching(icon.Hash, 72*time.Hour, func(b *response.Builder) {
b.WithHeader("Content-Security-Policy", `default-src 'self'`)
b.WithHeader("Content-Type", icon.MimeType)
b.WithBody(icon.Content)
if icon.MimeType != "image/svg+xml" {
b.WithoutCompression()
}
b.Write()
})

You can see that in the browser console:

image

@APT37
Copy link
Author

APT37 commented Oct 23, 2024

I should've checked what's actually happening. At the time I opened the issue, icons were loading rather slowly and it looked like they had to be fetched from the server each time the page was loaded.

Closing this one, since it's only about caching the icons, which is already happening.

@APT37 APT37 closed this as completed Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants