FlamedDogo99 / EaglerMobile

A userscript that allows EaglerCraft to run on mobile browsers. As of June 15, 2023, the Eagler Mobile script is directly integrated with the main EaglerCraft website!
Apache License 2.0
16 stars 20 forks source link

[Suggestion] Add userscript details to crash report #23

Open FlamedDogo99 opened 3 months ago

FlamedDogo99 commented 3 months ago

Suggestion Currently, when eaglercraft crashes, the user is given no information to use for creating an issue on this repository. This leads some users to simply say "it doesn’t work" or "please fix".

This makes troubleshooting very difficult, and many times it turns out to be "Here is another basic web standard Android doesn’t support".

Hooking into the crash report and appending relevant information such as Eagler Mobile’s logs and internal states could help with this issue.

Additional Information Unfortunately, neither the crash log or logo have any identifying attributes outside of their style that would easily allow the detection of a crash.

The client uses setAttribute to set the styling for the crash report div, so we could possibly hook into that? I hesitate to use createElement, because I think we’d have to read the innertext (which I’m not sure if it differs for different languages), and the whole thing just seems unreliable.

We could possibly hook into the console.error and throw functions, although that requires some research.

lax1dude commented 3 months ago

The crash report is always displayed in a <div> created as a child of the game's current "container" element on the page, which is always the element that has the ID of window.eaglercraftXOpts.container on 1.8 or window.eaglercraftOpts.container on 1.5 or window.minecraftOpts[0] on b1.3 and old 1.5. I don't know the best way to hook it but if you're just trying to find the element this is the most consistent way.

FlamedDogo99 commented 3 months ago

I somehow missed the id when I was looking at this. Thanks for weighing in!

I also really need to start looking at fixes for older Minecraft versions, or it will be a pain to backport later

Edit: Did you mean that the report div has an id, or the game container?

lax1dude commented 3 months ago

The game container has the ID and the report div is created inside of it when the game crashes