dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
648 stars 153 forks source link

""Not for production environments"". Possible Internet traffic reduction alternative to "fixes #616" #627

Closed NaeCqde closed 6 months ago

NaeCqde commented 6 months ago

Summary

Fixes https://github.com/dolfies/discord.py-self/issues/616

After waiting a few months from now, if a request matching "/sentry. [a-z0-9]+Sentry.js", we recommend merging this pull request if a matching request is running in Discord's /login.

There is no guarantee that Discord will continue to use Sentry.io forever, though, I suggested this in the expectation that it has been used so far and will be used in the future, although the file name is different.

I hope you will keep it in a corner of your memory.

I rewrote "utils.py" to get the Build Number from a JavaScript file that contains a client that reports errors to Sentry.io.

The link to the JavaScript file is /assets/sentry.708ca00456ca1abdfa75.js The response body size is 7.82 kB. The response body size for a GET request to /login in Discord is 11.41 kB.

Therefore, if we remove the headers from the calculation in one run of _get_build_number, we have 19.3 kB of Internet communication.

General Info

dolfies commented 6 months ago

This looks like a much more future-proof solution, thanks! I'll incorporate it into the next commit along with some other changes to startup information retrieval.