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

Duplicate of PR to Martinski's Repo #12

Merged
merged 2 commits into from
Mar 1, 2025

Conversation

ExtremeFiretop
Copy link

@ExtremeFiretop ExtremeFiretop commented Mar 1, 2025

Duplicate PR to @Martinski4GitHub repo: Martinski4GitHub#1

I didn't realize at the time he had forked it from you and not JackYaz! My apologies.
Seems that he prefers if I submit the PR's directly.

My discussion on this issue can be found here: https://www.snbforums.com/threads/scmerlin-2-5-9-service-and-script-control-menu-for-asuswrt-merlin-feb-12-2025.89224/post-945023

In short; On 3004 firmware, the router’s JavaScript populates a global array myMenu as soon as you call show_menu().
Therefore, the original code just checked if(myMenu.length == 0) ... retry and then called GenerateSiteMap(...) once myMenu was non‐empty.

However, on 3006 firmware, ASUS changed how they store menu data. They use seem to now use:
Session.set("menuList.", menuTree.list);
in state.js rather than assigning to the global myMenu.

As a result, myMenu never gets populated automatically, so the old check (if(myMenu.length == 0) ... retry) would loop forever on 3006.

DEBUG: show_menu() is defined. Calling it now..
DEBUG: Now calling LoadSiteMap()...
DEBUG: Entering LoadSiteMap()...
DEBUG: menuList or menuExclude not ready; retry in 1s...
DEBUG: Added click event listener to #sitemap_showurls
DEBUG: Entering LoadSiteMap()...
DEBUG: menuList or menuExclude not ready; retry in 1s...
DEBUG: Entering LoadSiteMap()...
DEBUG: menuList or menuExclude not ready; retry in 1s..
DEBUG: Entering LoadSiteMap()..
DEBUG: menuList or menuExclude not ready; retry in 1s...
My PR works on both 3004 and 3006 by using a hybrid of both approaches

First checks if myMenu is already populated (the 3004 way).
If not, it tries to pull menuList. from Session (the 3006 way).
Then it sets myMenu (and menuList, if needed) so GenerateSiteMap(...) will see the data regardless of firmware version.

@decoderman decoderman merged commit 47d76d3 into decoderman:master Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants