JS Interpreter issues
Describe the bug: When I try to run JS scripts "ir_brute.js", "rf_brute.js", "wifi_brute.js" by @eadmaster from sd_files/interpreter/ library, instead of working properly it opens script's menu for a less than a second and then it crashes to the main menu. All three scripts run with the same problem, no error message or anything, it just crashes the script
Steps To Reproduce: JS Interpreter > Load... > Select one of the scripts > Experience the bug.
- Device used: T-Embed CC1101 (Beta Release)
Expected behavior: I expected all three JS scripts to run smoothly (some do)
Actual behavior: After running them I see script's menu for a second and then it crashes me to main menu for some reason
followup https://github.com/pr3y/Bruce/issues/1168#issuecomment-2889470336
It should be something affecting to the loopOptions function
For what I could see, the dialogChoice fuction had changed, and need to update the scripts to match the new parameters
https://github.com/bmorcelli/Bruce/blob/d72209a5cd3a38d3910434953530b934230b996e/src/modules/bjs_interpreter/gui_js.cpp#L76
duk_ret_t native_dialogChoice(duk_context *ctx) {
// usage: dialogChoice(choices : string[] | {[key: string]: string})
// legacy version dialogChoice takes ["choice1", "return_val1", "choice2",
// "return_val2", ...] new version dialog.choice takes ["choice1", "choice2"
// ...] or {"choice1": "return_val1", "choice2": "return_val2", ...} returns:
// string ("return_val1", "return_val2", ...), or empty string if cancelled
...
}
it is bailing out here:
https://github.com/pr3y/Bruce/blob/d72209a5cd3a38d3910434953530b934230b996e/src/core/display.cpp#L537
In the last changes, the main menu, menus and etc are running all inside loopOptions.. need to find a way to handle it
Fixed the dialogChoice functionality by patching the loopOptions function.
Updated the rf_brute.js, ir_brute.js and wifi_brute.js
Available on Beta for testing