-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
refactor(Webpack): more reliable patching #2237
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Rework how webpackRequire is grabbed - Add beforeWebpackInit and factory listener apis - Future proof extractAndLoadChunks & reporter
…hough they always fail
9a7340c
to
c996860
Compare
…discord_app toString
This would need a more advanced collaboration between mods to work
Vendicated
reviewed
May 2, 2024
Vendicated
reviewed
May 2, 2024
mantikafasi
pushed a commit
to StupidityDB/VencordPlus
that referenced
this pull request
May 5, 2024
* ResurrectHome: Fix patch * RoleColorEverywhere: Actually fix patch * NoTrack: Option to keep analytics, improve patches * improve contributor modal & badge * fix FriendsSince * refactor(Webpack): more reliable patching (Vendicated#2237) * messageLogger: fix niche bug ignoring edits when content is same (Vendicated#2403) * feat(plugin): PauseInvitesForever (Vendicated#2372) Co-authored-by: V <vendicated@riseup.net> * MoreUserTags: Remove old workaround; MessageClickActions: Move finds outside of start * fix sort conflict of ImplicitRelationships & SortFriendRequests (Vendicated#2408) * ReviewDB: add more context menu shortcuts to view reviews (Vendicated#2382) Co-authored-by: V <vendicated@riseup.net> * feat(USRBG): update to new API (Vendicated#2388) * MsgClickActions: control ping via shift & NoReplyMention plugin (Vendicated#2390) Co-authored-by: V <vendicated@riseup.net> * fix badges with custom component * feat(plugin): ImageLink (Vendicated#2297) * Test Patches: Faster chromium setup; Update action versions (Vendicated#2412) * Test Patches: Remove pnpm add puppeteer as it's already in deps * SecretRingToneEnabler: Fix patch * feat(ValidUser): also display badges & banner (Vendicated#2235) Co-authored-by: V <vendicated@riseup.net> * NewGuildSettings: add push notifs, highlights & events (Vendicated#2413) Co-authored-by: V <vendicated@riseup.net> * fix overflow when having two rows of badges * Future proof FakeNitro and Experiments to not brick Discord startup * bump to v1.8.1 --------- Co-authored-by: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Co-authored-by: Vendicated <vendicated@riseup.net> Co-authored-by: HAHALOSAH <67280050+HAHALOSAH@users.noreply.github.com> Co-authored-by: dolfies <jeyalfie47@gmail.com> Co-authored-by: Sqaaakoi <sqaaakoi-git@sqaaakoi.xyz> Co-authored-by: katlyn <17418611+katlyn@users.noreply.github.com> Co-authored-by: sunnie <78964224+sunnniee@users.noreply.github.com> Co-authored-by: Kyuuhachi <1547062+Kyuuhachi@users.noreply.github.com> Co-authored-by: Gabriel Ruiz Pérez <57387907+GabiRP@users.noreply.github.com>
LunaisLazier
pushed a commit
to LunaisLazier/Mooncord
that referenced
this pull request
May 7, 2024
ImLvna
pushed a commit
to ImLvna/Vencord
that referenced
this pull request
May 27, 2024
Autumnlight02
pushed a commit
to Autumnlight02/Vencord
that referenced
this pull request
Jun 4, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I honestly recommend reviewing this by just looking at files changed and looking at the new file, lots of small changes and stuff like just indentation
Instead of trying to push a fake module to webpackChunkdiscord_app everytime its value is defined again, it now monkey patches the init callback Discord runs to initialize the app after all needed chunks are loaded
This lets us more reliably get the webpack require as soon as we can, but of course not too soon in a point where needed properties would not be yet defined. It also makes it impossible for us to grab the sentry webpack require instead of the main, in case sentry somehow loaded faster than the main webpack script.
Makes extractAndLoadChunks and the reporter not rely on the chunk group id being the also the entry point id.
extractAndLoadChunks now grabs the chunk group id and entry point as two separate capturing groups. I also fixed logic issues with it, which I didn't notice before.
Reporter no longer depends on the chunk group id being the entry point when looking at the chunks object to load chunks. Now it manually scrapes chunks loaded from every module factory using regex, to grab the chunk group id and the entry point, until every chunk loaded by Discord is manually loaded by us. After that it manually loads the rest of the chunks which Discord is not using, so we can be aware of duplicate modules too.