What's new

Remove unused WebUI tabs?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

kstamand

Occasional Visitor
Router running in Wireless router mode and there are a number of "tabs" (not sure that is the right term) on the left side of the WebUI that I never use (e.g, Parental Controls, AI Cloud, Game, OpenNAT, ...). Is there a custom config, any settings, and/or script that can hide selected ones? If not, is there a particular asp file in the /www directory that I can look at to possibly accomplish what I'm after?

I did search the forum, but wasn't able to find anything.


1735763689991.png
 
One simple/basic way to hide the menu items is to use a web browser extension like uBlock Origin and pick the specific menu items you want to hide when the page loads. Example attached with a number of the menu items under General hidden.

Example of the filter for uBlock Origin:
Code:
! Jan 1, 2025 http://192.168.50.1
192.168.50.1###APP_Installation_menu
192.168.50.1###GameProfile_menu
192.168.50.1###cloud_main_menu
192.168.50.1###GameBoost_menu
192.168.50.1###TrafficAnalyzer_Statistic_menu
192.168.50.1###AdaptiveQoS_Bandwidth_Monitor_menu
192.168.50.1###AiProtection_WebProtector_menu
 

Attachments

  • Network Map.jpg
    Network Map.jpg
    102.1 KB · Views: 20
@bennor Interesting, hadn't thought of approaching it that way, but unfortunately UBO is not an option on MacOS.

I'll check to see if there as an alternative, but ultimately I'm hoping to find a solution on the router itself - hoping others may offer up some options along those lines.

Happy New Year
 
You can hack the /www/require/module/menuTree.js file to exclude certain tabs.
Code:
cp /www/require/modules/menuTree.js /jffs/
mount -o bind /jffs/menuTree.js /www/require/modules/menuTree.js
Edit /jffs/menuTree.js to add entries in the exclude: section.
JavaScript:
exclude: {
menus: function(){
var retArray = [];
// start of my exclusions
retArray.push("menu_GameBoost");
retArray.push("menu_OpenNAT");
retArray.push("menu_AiCloud");
retArray.push("menu_Alexa_IFTTT");
// end of my exclusions
if(!nfsd_support){
retArray.push("Advanced_AiDisk_NFS.asp");
}
Add the earlier mount command to the /jffs/scripts/services-start script to persist between reboots.

Although if you use other addons that have a webui, this manipulation of menuTree.js would conflict with their use of menuTree.js.
 
Last edited:
@dave14305 once again you show me the way - exactly what I was looking for and works as I was hoping for. And no disruption to Diversion or Skynet add-on menus.

Thank you

Edit: Below are my final modifications. Note the "//" which are valid JS comments - without them, no menu tree will be visible.
JavaScript:
exclude: {
menus: function(){
var retArray = [];
// ### start of my exclusions
retArray.push("menu_AiMesh");
retArray.push("menu_AiProtection");
retArray.push("menu_QoS");
retArray.push("menu_ParentalControl");
retArray.push("menu_GameBoost");
retArray.push("menu_OpenNAT");
retArray.push("menu_AiCloud");
retArray.push("menu_Alexa_IFTTT");
retArray.push("menu_IPv6");
// ### end of my exclusions
if(!nfsd_support){
retArray.push("Advanced_AiDisk_NFS.asp");
}
 
Last edited:
I really, really like the idea of this menu decluttering option and while I could make these changes via SSH and WinSCP, it would be great if someone @Viktor Jaep 😆 ? would make an Addon for it so you could undo one or two or temporarily enable all etc. 🤭.
 
I really, really like the idea of this menu decluttering option and while I could make these changes via SSH and WinSCP, it would be great if someone @Viktor Jaep 😆 ? would make an Addon for it so you could undo one or two or temporarily enable all etc. 🤭.
LOL. I appreciate the suggestion @jksmurf, but I am going to pass on the theming add-on. Hope someone else wants to volunteer to step forward and take this on.
 
If you start messing with webui files, be ready to deal with the consequences if anything breaks next time you upgrade your firmware...

Only too often there's been people coming at me saying "The firmware is broken, my webui doesn't work", only to discover they are using something that hacks their webui, and they never thought to look at that before coming here to report a "bug".
 
This script works better if you have WebUI addons installed. All unwanted tabs can be added to the same push function.
Bash:
#!/bin/sh

{
        /usr/bin/flock -x 386
        if [ ! -f /tmp/menuTree.js ]; then
                cp /www/require/modules/menuTree.js /tmp/
                mount -o bind /tmp/menuTree.js /www/require/modules/menuTree.js
        fi
        umount /www/require/modules/menuTree.js 2>/dev/null
        sed -i "/\/\/hidetabs/d" /tmp/menuTree.js
        sed -i "/^if(!nfsd_support){/i retArray.push(\"menu_GameBoost\", \"menu_OpenNAT\", \"menu_AiCloud\", \"menu_Alexa_IFTTT\", \"menu_ParentalControl\"); //hidetabs" /tmp/menuTree.js
        mount -o bind /tmp/menuTree.js /www/require/modules/menuTree.js
} 386>/tmp/addonwebui.lock
It adds a hidetabs comment to each added line to avoid duplication if run multiple times. It will likely wreck things one day, as Merlin alludes to, but the whole Addon WebUI mechanism is almost as fragile. Use at your own risk. Know how to undo it all.
 
@dave14305, thanks for the follow up script - I'm learning more and more each time (e.g. flock approach).

What I learned from the original approach is that it indeed did mess up addons, at least Diversion (ended up with two Diversion tabs on LAN), whereas I do not with this solution.

The other thing I learned is that menu_QoS persists (as in, not removed / hidden) even when included below, but no big deal - just glad to follow an approach, with the recognized caveats Merlin points out.

Below is the the script I created that is called from services-start which worked for me >> notice I had to change the last sed line to get the desired results

Bash:
#!/bin/sh
# Script to remove select sections from the AsusWRT WebUI
{
    /usr/bin/flock -x 386
    if [ ! -f /tmp/menuTree.js ]; then
        cp /www/require/modules/menuTree.js /tmp/
         mount -o bind /tmp/menuTree.js /www/require/modules/menuTree.js
    fi
    umount /www/require/modules/menuTree.js 2>/dev/null
    sed -i "/\/\/hidetabs/d" /tmp/menuTree.js
    sed -i "/^if(!nfsd_support){/i retArray.push(\"menu_AiMesh\"); retArray.push(\"menu_AiProtection\"); retArray.push("menu_QoS"); retArray.push("menu_GameBoost"); retArray.push("menu_OpenNAT"); retArray.push(\"menu_AiCloud\"); retArray.push(\"menu_Alexa_IFTTT\"); //hidetabs" /tmp/menuTree.js
    mount -o bind /tmp/menuTree.js /www/require/modules/menuTree.js
} 386>/tmp/addonwebui.lock | logger -t $(echo $(basename $0) | grep -Eo '^.{0,23}')[$$]
 
Last edited:

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top