jagrosh / GiveawayBot

🎉 Hold giveaways quickly and easily on your Discord server!
https://giveawaybot.party
Apache License 2.0
646 stars 302 forks source link

Switch to JSONP instead of JSON for Giveaway Summary #226

Open jagrosh opened 1 year ago

jagrosh commented 1 year ago

Presently, the giveaway summary file produced at the end of a giveaway is a standard .json file. This is fine, mostly, but since Discord enforces CORS on their cdn, a third-party service is required to load the summary web page (which bypasses the CORS headers and provides the raw json).

Switching GiveawayBot to produce jsonp (json-with-padding) output would allow the summary page to load the summary directly from Discord's cdn, as <script> tags (the underlying tool used for loading jsonp files) ignores CORS.

A few caveats:

jagrosh commented 9 months ago

This needs to be re-evaluated now that Discord is removing persistent download URLs