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

Switch to JSONP instead of JSON for Giveaway Summary #226

Open
jagrosh opened this issue Jan 19, 2023 · 1 comment
Open

Switch to JSONP instead of JSON for Giveaway Summary #226

jagrosh opened this issue Jan 19, 2023 · 1 comment

Comments

@jagrosh
Copy link
Owner

jagrosh commented Jan 19, 2023

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:

  • The system needs to be backwards-compatible. If someone tries to load an older json-style summary, the site will still need to use a third-party url.
  • This will require either a new query parameter in the summary url (such as &v=2) to signify the new system, or a new summary page entirely (/giveaway-summary, for example). I'm leaning towards a query parameter to be more future-proof if more summary loading methods are used in the future.
@jagrosh
Copy link
Owner Author

jagrosh commented Nov 21, 2023

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

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

1 participant