#!/usr/bin/haserl <% echo -en "Content-Type: text/html\r\n\r\n" HOSTNAME="$(uci -q get "fff.system.hostname")" hood="$(uci -q get "system.@system[0].hood")" MAC="$(uci -q get network.client.macaddr)" lat="$(uci -q get "fff.system.latitude")" lon="$(uci -q get "fff.system.longitude")" contact="$(uci -q get "fff.system.contact")" . /etc/firmware_release %> <%= ${HOSTNAME} %>
www.freifunk-franken.de
Login
System
Name:<%= $HOSTNAME %>
MAC-Adresse:<%= $MAC %>
Modell:<% cat /tmp/sysinfo/model 2>/dev/null %>
Firmware:<%= ${FIRMWARE_VERSION} %>
Beschreibung:<% uci -q get 'fff.system.description' %>
Position:<% if [ -n "$lat" -a -n "$lon" ]; then echo "${lat:0:8}N, ${lon:0:8}E" fi %>
Standort:<% uci -q get 'fff.system.position_comment' %>
E-Mail Adresse:<%= $contact %>
<% if [ -f "$(command -v batctl)" ] ; then %>
Status
Hood:<% echo "$hood" %>
Bekannte Knoten:<% echo -n $(($(batctl tg -H | cut -b 40-56 | sort | uniq | wc -l 2> /dev/null)+1)) %>
Nachbarknoten:<% echo -n $(batctl o -H | cut -b 40-56 | sort | uniq | wc -l 2> /dev/null) %>
Lokale Clients:<% echo -n $(batctl tl -H 2> /dev/null | grep -c 'W') %>
<% fi if birdc show status >/dev/null 2>&1 || pgrep babeld >/dev/null; then %>
Status <% #Count Clients client_count=$(bridge fdb show br br_client brport $(ls "/sys/class/net/br-client/brif" | grep -v '^bat') | grep -v self | grep -v permanent -c) %>
Lokale Clients:<% echo $client_count %>
Babel Status <% if birdc show status >/dev/null 2>&1; then neighbours="$(birdc -r show babel neighbors | tail -n +5 | awk '{ printf "", $1, $2, $3 }')" fi if pgrep babeld >/dev/null; then lockfile="/tmp/fff-web-ui.babel.lock" if [ -e $lockfile ] && [ 30 -gt $(( $(date +%s) - $(date -r $lockfile +%s) )) ] ; then neighbours=$(cat /tmp/fff-web-ui.babel) else neighbours="$(echo dump | nc ::1 33123 | grep '^add neighbour' | awk '{ for (i=2; i < NF; i += 2) { vars[$i] = $(i+1) } } { printf "", vars["address"], vars["if"], vars["cost"] }')" echo "$neighbours" > /tmp/fff-web-ui.babel touch $lockfile fi fi echo -n "$neighbours" %>
IPInterfaceKosten
%s%s%s
%s%s%s
<% fi %>