summaryrefslogtreecommitdiff
path: root/files/common/www/service/cgi-bin/cfg_router.json
blob: 3315cc36ba9c719175dcdb0878cbd204496a9cfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh -e

. /www/service/cgi-bin/common.sh
check_node_auth

# parse changes
if [ $REQUEST_METHOD == POST ]; then
    . /www/service/cgi-bin/cfg_router.commit
fi

# compute geo mode value (if not changed during this request)
if [ -z "$router_geo" ]; then
    if [ "$(uci get system.position.public)" == 'false' ]; then
	router_geo=private
    elif [ "$(uci get system.position.automatic)" == 'false' ]; then
	router_geo=manual
    else
	router_geo=automatic
    fi
fi

echo -e "Status: 200 OK\r
Content-Type: application/json\r
\r
{\"router_name\":      \"${router_name-$(      uci get system.@system[0].hostname)}\",
 \"router_password\":  \"${router_password-$(  uci get system.mesh.webif_password)}\",
 \"router_qos\":        [${router_qos-$(       uci get system.mesh.qos)}],
 \"router_vpn\":        [${router_vpn-$(       uci get system.mesh.vpn)}],
 \"router_filter_wan\": [${router_filter_wan-$(uci get system.mesh.filter_wan)}],
 \"router_geo\":        [\"$router_geo\"]
}"

exec_lazy
contact: Jan Huwald // Impressum