Skip to content

Commit

Permalink
1.0.1
Browse files Browse the repository at this point in the history
Dynamic WebUI page detection to support routers that don't have the ROG page
  • Loading branch information
jackyaz committed Apr 20, 2019
2 parents 8f14d9e + d2ce751 commit 223fcc8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -2,8 +2,8 @@
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/91af8db9cd354643a8ef6a7117be90fb)](https://www.codacy.com/app/jackyaz/connmon?utm_source=github.com&utm_medium=referral&utm_content=jackyaz/connmon&utm_campaign=Badge_Grade)
[![Build Status](https://travis-ci.com/jackyaz/connmon.svg?branch=master)](https://travis-ci.com/jackyaz/connmon)

## v1.0.0
### Updated on 2019-04-17
## v1.0.1
### Updated on 2019-04-20
## About
Track your Internet uptime, on your router. Graphs available for on the Tools page of the WebUI.

Expand Down
24 changes: 17 additions & 7 deletions connmon.sh
Expand Up @@ -13,7 +13,7 @@

### Start of script variables ###
readonly CONNMON_NAME="connmon"
readonly CONNMON_VERSION="v1.0.0"
readonly CONNMON_VERSION="v1.0.1"
readonly CONNMON_BRANCH="master"
readonly CONNMON_REPO="https://raw.githubusercontent.com/jackyaz/""$CONNMON_NAME""/""$CONNMON_BRANCH"
readonly CONNMON_CONF="/jffs/configs/$CONNMON_NAME.config"
Expand Down Expand Up @@ -337,13 +337,22 @@ RRD_Initialise(){
fi
}

Get_CONNMON_UI(){
if [ -f /www/AdaptiveQoS_ROG.asp ]; then
echo "AdaptiveQoS_ROG.asp"
else
echo "AiMesh_Node_FirmwareUpgrade.asp"
fi
}

Mount_CONNMON_WebUI(){
umount /www/AiMesh_Node_FirmwareUpgrade.asp 2>/dev/null
umount /www/AdaptiveQoS_ROG.asp 2>/dev/null
if [ ! -f /jffs/scripts/connmonstats_www.asp ]; then
Download_File "$CONNMON_REPO/connmonstats_www.asp" "/jffs/scripts/connmonstats_www.asp"
fi

mount -o bind /jffs/scripts/connmonstats_www.asp /www/AdaptiveQoS_ROG.asp
mount -o bind /jffs/scripts/connmonstats_www.asp "/www/$(Get_CONNMON_UI)"
}

Modify_WebUI_File(){
Expand All @@ -352,9 +361,9 @@ Modify_WebUI_File(){
tmpfile=/tmp/menuTree.js
cp "/www/require/modules/menuTree.js" "$tmpfile"

sed -i '/{url: "AdaptiveQoS_ROG.asp", tabName: /d' "$tmpfile"
sed -i '/"Tools_OtherSettings.asp", tabName: "Other Settings"/a {url: "AdaptiveQoS_ROG.asp", tabName: "Uptime Monitoring"},' "$tmpfile"
sed -i '/retArray.push("AdaptiveQoS_ROG.asp");/d' "$tmpfile"
sed -i '/{url: "'"$(Get_CONNMON_UI)"'", tabName: /d' "$tmpfile"
sed -i '/"Tools_OtherSettings.asp", tabName: "Other Settings"/a {url: "'"$(Get_CONNMON_UI)"'", tabName: "Uptime Monitoring"},' "$tmpfile"
sed -i '/retArray.push("'"$(Get_CONNMON_UI)"'");/d' "$tmpfile"

if [ -f "/jffs/scripts/spdmerlin" ]; then
sed -i '/{url: "Advanced_Feedback.asp", tabName: /d' "$tmpfile"
Expand Down Expand Up @@ -383,7 +392,7 @@ Modify_WebUI_File(){
sed -i -e 's/setTimeout("parent.redirect();", action_wait\*1000);/parent.showLoading(restart_time, "waiting");'"\\r\\n"'setTimeout(function(){ getXMLAndRedirect(); alert("Please force-reload this page (e.g. Ctrl+F5)");}, restart_time\*1000);/' "$tmpfile"
fi

sed -i -e '/else if(current_page.indexOf("Feedback") != -1){/i else if(current_page.indexOf("ROG") != -1){'"\\r\\n"'parent.showLoading(restart_time, "waiting");'"\\r\\n"'setTimeout(function(){ getXMLAndRedirect(); alert("Please force-reload this page (e.g. Ctrl+F5)");}, restart_time*1000);'"\\r\\n"'}' "$tmpfile"
sed -i -e '/else if(current_page.indexOf("Feedback") != -1){/i else if(current_page.indexOf("'"$(Get_CONNMON_UI)"'") != -1){'"\\r\\n"'parent.showLoading(restart_time, "waiting");'"\\r\\n"'setTimeout(function(){ getXMLAndRedirect(); alert("Please force-reload this page (e.g. Ctrl+F5)");}, restart_time*1000);'"\\r\\n"'}' "$tmpfile"

if [ ! -f /jffs/scripts/custom_start_apply.htm ]; then
cp "/www/start_apply.htm" "/jffs/scripts/custom_start_apply.htm"
Expand Down Expand Up @@ -757,8 +766,9 @@ Menu_Uninstall(){
esac
done
Shortcut_connmon delete
umount /www/AiMesh_Node_FirmwareUpgrade.asp 2>/dev/null
umount /www/AdaptiveQoS_ROG.asp 2>/dev/null
sed -i '/{url: "AdaptiveQoS_ROG.asp", tabName: "Uptime Monitoring"}/d' "/jffs/scripts/custom_menuTree.js"
sed -i '/{url: "AiMesh_Node_FirmwareUpgrade.asp", tabName: "Uptime Monitoring"}/d' "/jffs/scripts/custom_menuTree.js"
umount /www/require/modules/menuTree.js 2>/dev/null

if [ ! -f "/jffs/scripts/ntpmerlin" ] && [ ! -f "/jffs/scripts/spdmerlin" ]; then
Expand Down

0 comments on commit 223fcc8

Please sign in to comment.