Duplicate of PR to Martinski's Repo #12
Merged
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.
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.
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.