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

Discord fonts are blocked by CORS policy #322

Closed
Tyrrrz opened this issue Jul 18, 2020 · 5 comments
Closed

Discord fonts are blocked by CORS policy #322

Tyrrrz opened this issue Jul 18, 2020 · 5 comments

Comments

@Tyrrrz
Copy link
Owner

Tyrrrz commented Jul 18, 2020

Recently Discord decided to finally enable CORS policy on their CDN which prevents Whitney fonts from loading in HTML exports:

image

There are a couple of ways to deal with this but each comes with certain drawbacks:

  1. Embed fonts directly in the export file. This would mean that the fonts are going to be part of the page, which pushes the minimum size of the export file up to ~500kb since the fonts are quite large.

  2. Embed only one font directly in the export file. Instead of using all fonts, we can only use the most common one (Whitney Regular, which is used for text content) and extrapolate the others with font weight. This pushes the minimum size to ~100kb.

  3. Host the fonts on another CDN that allows any CORS origin. This would fix the problem, but someone will have to care of the hosting and it won't be me.

  4. Leave things as they are. That means the fonts will likely not work on modern browsers, unless you launch them with special settings that ignore CORS for locally stored files or use extensions that help with that on per-page basis. In worst case scenario, Whitney fonts are automatically replaced with Helvetica variants which are similar-ish but will still look different than original Discord fonts.

This thread is open for discussions, votes, and suggestions.

@Tyrrrz Tyrrrz added the bug label Jul 18, 2020
@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Jul 18, 2020

For comparison, here's the difference between fonts.

Whitney fonts (which currently cannot be loaded normally):
image

Helvetica fallback:
image

@Jefferderp
Copy link

Jefferderp commented Jul 18, 2020

I'm personally completely OK with the Helvetica fallback - it's quite close, and in my opinion doesn't detract from the "integrity" of an export. I wouldn't wish to see the minimum size of a backup become so inflated.

That said, I think the best solution would be to exclude all fonts by default, with an optional flag to embed the full font set.

Thanks again for this software, and for maintaining it!

@Tyrrrz Tyrrrz added the wontfix label Jul 30, 2020
@Tyrrrz Tyrrrz closed this as completed Jul 30, 2020
@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Jul 30, 2020

Helvetica it is then!

@shirt-dev
Copy link

Host the fonts on another CDN that allows any CORS origin. This would fix the problem, but someone will have to care of the hosting and it won't be me.

JSDelivr could be used as a cdn for the fonts, just put them in a github repo.
https://cdn.jsdelivr.net/gh/user/repo@version/file

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Aug 21, 2020

@shirtjs hm, I didn't know it was as simple as that. I'll check that out, thanks!

Tyrrrz added a commit that referenced this issue Aug 21, 2020
@Tyrrrz Tyrrrz changed the title [HTML] Discord fonts are blocked by CORS policy Discord fonts are blocked by CORS policy Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants