Skip to content
Snippets Groups Projects
Commit 3aa019fc authored by Pau Escrich's avatar Pau Escrich
Browse files

luci-app-bmx6: remove '$' as identifier for special json functions


Signed-off-by: default avatarPau Escrich <p4u@dabax.net>
parent 7b851e5f
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,9 @@ else ...@@ -18,6 +18,9 @@ else
echo "" echo ""
fi fi
# workaround to support old format starting with '$'
QUERY="$(echo "$QUERY" | sed s/'\$'//)"
check_path() { check_path() {
[ -d "$1" ] && path=$(cd $1; pwd) [ -d "$1" ] && path=$(cd $1; pwd)
[ -f "$1" ] && path=$(cd $1/..; pwd) [ -f "$1" ] && path=$(cd $1/..; pwd)
...@@ -65,7 +68,7 @@ if [ "${QUERY##*/}" == "all" ]; then ...@@ -65,7 +68,7 @@ if [ "${QUERY##*/}" == "all" ]; then
QALL=1 QALL=1
fi fi
if [ "$QUERY" == '$myself' ]; then if [ "$QUERY" == 'myself' ]; then
hostname="$(cat /proc/sys/kernel/hostname)" hostname="$(cat /proc/sys/kernel/hostname)"
ip6="$(bmx6 -c show=status | grep ^BMX | awk '{print $5}')" ip6="$(bmx6 -c show=status | grep ^BMX | awk '{print $5}')"
ip4="$(bmx6 -c show=status | grep ^BMX | awk '{print $6}')" ip4="$(bmx6 -c show=status | grep ^BMX | awk '{print $6}')"
...@@ -75,7 +78,7 @@ if [ "$QUERY" == '$myself' ]; then ...@@ -75,7 +78,7 @@ if [ "$QUERY" == '$myself' ]; then
exit 0 exit 0
fi fi
if [ "$QUERY" == '$info' ]; then if [ "$QUERY" == 'info' ]; then
echo -n '{ "info": [ ' echo -n '{ "info": [ '
print_query status print_query status
echo -n "," echo -n ","
...@@ -84,7 +87,7 @@ if [ "$QUERY" == '$info' ]; then ...@@ -84,7 +87,7 @@ if [ "$QUERY" == '$info' ]; then
exit 0 exit 0
fi fi
if [ "$QUERY" == '$neighbours' ]; then if [ "$QUERY" == 'neighbours' ]; then
QALL=1 QALL=1
echo -n '{ "neighbours": [ ' echo -n '{ "neighbours": [ '
echo -n '{ "originators": ' echo -n '{ "originators": '
...@@ -96,17 +99,17 @@ if [ "$QUERY" == '$neighbours' ]; then ...@@ -96,17 +99,17 @@ if [ "$QUERY" == '$neighbours' ]; then
exit 0 exit 0
fi fi
if [ "$QUERY" == '$tunnels' ]; then if [ "$QUERY" == 'tunnels' ]; then
bmx6 -c --jshow tunnels /r=0 bmx6 -c --jshow tunnels /r=0
exit 0 exit 0
fi fi
if [ "$QUERY" == "" ]; then if [ "$QUERY" == "" ]; then
echo -n '{ "queries": [' echo -n '{ "queries": ['
echo -n '{ "name": "$myself", "info": "basic network information of self node" },' echo -n '{ "name": "myself", "info": "basic network information of self node" },'
echo -n '{ "name": "$info", "info": "full network and device information of self node" },' echo -n '{ "name": "info", "info": "full network and device information of self node" },'
echo -n '{ "name": "$tunnels", "info": "accnouncements (tunnels) published by the mesh network" },' echo -n '{ "name": "tunnels", "info": "accnouncements (tunnels) published by the mesh network" },'
echo -n '{ "name": "$neighbours", "info": "list of all my neighbours and their information" },' echo -n '{ "name": "neighbours", "info": "list of all my neighbours and their information" },'
echo -n '{ "name": "/", "info": "raw bmx6 json API" }]}' echo -n '{ "name": "/", "info": "raw bmx6 json API" }]}'
exit 0 exit 0
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment