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

Support favicon work on Safari (#22398) #24033

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

SP12893678
Copy link
Contributor

Scope

Support favicon work on Safari

What's changed:

  • add /favicon.ico endpoint to handle dynamic generate favicon content file

Tips

  1. Close Safari
  2. Clear Safari browser cache (/Users//Library/Safari/Favicon Cache)
2024-11-12.11.45.36.1.mp4

Potential Risks / Drawbacks

Review Notes / Questions


Fixes #22398

@SP12893678 SP12893678 force-pushed the fix/#22398-favicon-Safari branch from 7c1f1fc to 35ef24f Compare November 12, 2024 13:40
Comment on lines +21 to +23
const resvg = new Resvg(svg(color, addDirectusLogo));
const buffer = resvg.render().asPng();
return buffer;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Little worried we're rendering out a png from the SVG everytime the favicon is requested. I haven't done the perf testing yet, but isn't that a fairly heavy thing to do every time? Wondering if we should have some caching for this, or if there's a world where we return the SVG favicon for browsers that support svg favicons and have a default png that doesn't have to be generated each time as a fallback for browsers that don't 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, using caching can definitely reduce the performance overhead.

In additional, I will try detecting browser support via user agent to conditional handle it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SVG favicon does not work on Safari
2 participants