What's new

How to fixing bug in web UI code - Stock firmware

  • 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!

JoSmittyCan

Occasional Visitor
I'd like to modify an .asp file that is stored in the /www folder on the router (this one: /www/AiProtection_HomeProtection.asp) to fix a small UI bug.

This is for stock Asuswrt firmware.

Can I just go with ssh, use vi and edit the file to fix the bug? Would the change be persistent to next reboot if I do so?

What is the recommended way to change these files?

Jo S.
 
The web files are stored in ROM, you can't edit them. You could create a copy and overmount the original but the change would be lost when you reboot unless you use script_usbmount (which you already know about).
 
What is the recommended way to change these files?
One option is to roll your own firmware using the GPL file(s) for your Asus router. You may possibly be able to edit and fix the bug in the .asp page that way and have it persist across rebooting. Go to the Asus support page for your router, select Drivers & Tools, then change the Please Select OS option to Other. GPL versions of your router's firmware should be listed. Note that the GPL files may be a version or two out of date from the latest stock Asus firmware for your router.

Another option is to use the Asus-Merlin firmware if your router is supported and similarly try roll your own from the GitHub files (https://www.asuswrt-merlin.net/source) with your correction made to the .asp page.
 
I'd like to modify an .asp file that is stored in the /www folder on the router (this one: /www/AiProtection_HomeProtection.asp) to fix a small UI bug.

This is for stock Asuswrt firmware.

Can I just go with ssh, use vi and edit the file to fix the bug? Would the change be persistent to next reboot if I do so?

What is the recommended way to change these files?

Jo S.

I have a shell script that I've used before to mount & unmount modified/customized versions of existing WebUI pages to try a few changes or test something new in their HTML/JavaScript code. If you want to try it with your fixed ASP file, I put a copy in PasteBin so you can download it:
Bash:
curl -kLSs --retry 3 --retry-delay 5 --retry-connrefused pastebin.com/raw/B5Ca5ZX0 | tr -d '\r' > $HOME/SetUpModifiedWebUIpageTab.sh
chmod 755 $HOME/SetUpModifiedWebUIpageTab.sh

You should store the script somewhere in the JFFS partition so it survives a reboot. I added some help messages to make it a bit user-friendly and show the available call parameters. I already modified 1 of the 2 customizable variables in the script required for your specific case. Now you'll need to modify only the "MOD_WEBPAGE_DIR" variable with the directory location of your modified ASP file (see the "CUSTOMIZABLE PARAMETERS SECTION" section near the top of the script).

As @ColinTaylor stated, you need to make a copy of the original ASP file, modify it with your fix & store it on a JFFS subdirectory; then, you can use the "SetUpModifiedWebUIpageTab.sh" script to easily mount & unmount the modified ASP file for testing & verifying your fixes/changes. Once you're happy that it's working as you expect, you can call the script from another script which is run on every reboot via the "script_usbmount" NVRAM var.

Run the "SetUpModifiedWebUIpageTab.sh" script from the directory where it's been stored without any parameters to get the help messages:
Bash:
./SetUpModifiedWebUIpageTab.sh

HTH
 

Latest threads

Sign Up For SNBForums Daily Digest

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