forked from freifunk-franken/firmware
Add new WebUI
Signed-off-by: Dominik Heidler <dominik@heidler.eu> Reviewed-by: Tim Niemeyer <tim@tn-x.org>
This commit is contained in:
parent
cd848616ff
commit
6c564588ec
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/haserl
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="clearit"></div>
|
||||||
|
</div>
|
||||||
|
<div id="footer">
|
||||||
|
<%# Creative Commons Attribution %>
|
||||||
|
Design by <a href="http://templated.co" rel="nofollow">TEMPLATED</a>.
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,46 @@
|
||||||
|
#!/usr/bin/haserl
|
||||||
|
|
||||||
|
<%
|
||||||
|
echo -en "Content-Type: text/html\r\n\r\n"
|
||||||
|
nav_entry() {
|
||||||
|
script_file="/cgi-bin/$1"
|
||||||
|
if [ "$script_file" == "$REQUEST_URI" ] ; then
|
||||||
|
local class_active=' class="active"'
|
||||||
|
fi
|
||||||
|
echo -ne "\t<li${class_active}><a href=\"${script_file}\">$2</a></li>\n\t\t"
|
||||||
|
}
|
||||||
|
|
||||||
|
HOSTNAME=$(uci get -q 'system.@system[0].hostname')
|
||||||
|
|
||||||
|
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
<title><%= ${HOSTNAME} %></title>
|
||||||
|
<link href="/style.css" rel="stylesheet" type="text/css" media="screen" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="header" style="position: relative;">
|
||||||
|
<h1><%= ${HOSTNAME} %></h1>
|
||||||
|
<h2>Freifunk Franken Router</h2>
|
||||||
|
<img src="/freifunk.svg" style="position: absolute; top: 1px; right: 42px;" />
|
||||||
|
</div>
|
||||||
|
<div style="height: 30px; background-color: #ffb400;"></div>
|
||||||
|
<div id="menu">
|
||||||
|
<ul>
|
||||||
|
<%
|
||||||
|
nav_entry home.html "Home"
|
||||||
|
nav_entry settings.html "Einstellungen"
|
||||||
|
nav_entry ports.html "Anschlüsse"
|
||||||
|
nav_entry wifiscan.html "Wifi Scan"
|
||||||
|
nav_entry upgrade.html "Upgrade"
|
||||||
|
nav_entry password.html "Password"
|
||||||
|
nav_entry reboot.html "Neustart"
|
||||||
|
nav_entry logout.html "Logout"
|
||||||
|
%>
|
||||||
|
</ul>
|
||||||
|
<div></div>
|
||||||
|
</div>
|
||||||
|
<div id="container">
|
||||||
|
<div id="primarycontainer">
|
||||||
|
<div id="primarycontent">
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/usr/bin/haserl
|
||||||
|
|
||||||
|
<%
|
||||||
|
human_bytes() {
|
||||||
|
while read B ; do
|
||||||
|
[ $B -lt 1024 ] && echo ${B} B && break
|
||||||
|
KB=$(((B+512)/1024))
|
||||||
|
[ $KB -lt 1024 ] && echo ${KB} KB && break
|
||||||
|
MB=$(((KB+512)/1024))
|
||||||
|
[ $MB -lt 1024 ] && echo ${MB} MB && break
|
||||||
|
GB=$(((MB+512)/1024))
|
||||||
|
[ $GB -lt 1024 ] && echo ${GB} GB && break
|
||||||
|
echo $(((GB+512)/1024)) TB
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
show_msg() {
|
||||||
|
if [ "$MSG" != "" ] ; then
|
||||||
|
echo "<div class=\"msg\">${MSG}</div>"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
%>
|
|
@ -0,0 +1,88 @@
|
||||||
|
#!/usr/bin/haserl
|
||||||
|
|
||||||
|
<%in /www/ssl/cgi-bin/header %>
|
||||||
|
<%in /www/ssl/cgi-bin/helpers %>
|
||||||
|
<%
|
||||||
|
if pidof fastd >/dev/null ; then
|
||||||
|
vpn_active="Ja"
|
||||||
|
else
|
||||||
|
vpn_active="Nein"
|
||||||
|
fi
|
||||||
|
up="$(uptime)"
|
||||||
|
load="${up##*:}"
|
||||||
|
uptime="${up%%,*}"
|
||||||
|
uptime="${uptime##*up}"
|
||||||
|
|
||||||
|
#include OpenWrt version
|
||||||
|
. /etc/openwrt_release
|
||||||
|
. /etc/firmware_release
|
||||||
|
|
||||||
|
addr() {
|
||||||
|
local addr="$(ip -$1 address show dev $2 2>/dev/null | tr '/' ' '| awk '/inet/{ printf("%s<br />", $2); }')"
|
||||||
|
echo "${addr:--}"
|
||||||
|
}
|
||||||
|
default_gw() {
|
||||||
|
ip -$1 route list 0/0 dev $2 2> /dev/null | awk '{print($3); exit(0)}'
|
||||||
|
}
|
||||||
|
wanif=$(uci -q get network.wan.ifname)
|
||||||
|
if [ -n "$(default_gw 4 $wanif)" -o -n "$(default_gw 6 $wanif)" ]; then
|
||||||
|
internet_active="Ja"
|
||||||
|
else
|
||||||
|
internet_active="Nein"
|
||||||
|
fi
|
||||||
|
|
||||||
|
%>
|
||||||
|
<table style="width: 100%;">
|
||||||
|
<tr><td>
|
||||||
|
<fieldset style="min-height: 15.05em;">
|
||||||
|
<legend>System</legend>
|
||||||
|
<table>
|
||||||
|
<tr><th>Name:</th><td><%= ${HOSTNAME} %></td></tr>
|
||||||
|
<tr><th>Modell:</th><td><% cat /tmp/sysinfo/model 2>/dev/null %></td></tr>
|
||||||
|
<tr><th>MAC-Adresse:</th><td><% uci -q get network.mesh.macaddr %></td></tr>
|
||||||
|
<tr><th>Bekannte Knoten:</th><td><%= $((`cat /sys/kernel/debug/batman_adv/bat0/transtable_global | grep '^ [^ ]' | cut -b 39-55 | sort | uniq | wc -l 2>/dev/null`+1)) %></td></tr>
|
||||||
|
<tr><th>Nachbarknoten:</th><td><%= $(cat /sys/kernel/debug/batman_adv/bat0/originators | grep '^[0-9a-f]' | cut -b 37-53 | sort | uniq | wc -l 2>/dev/null) %></td></tr>
|
||||||
|
<tr><th>VPN Aktiv:</th><td><%= ${vpn_active} %></td></tr>
|
||||||
|
<tr><th>Laufzeit:</th><td><%= ${uptime} %></td></tr>
|
||||||
|
<tr><th>Auslastung:</th><td><%= ${load} %></td></tr>
|
||||||
|
<tr><th>Uhrzeit:</th><td><% date %></td></tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</td><td>
|
||||||
|
<fieldset style="min-height: 15.05em;">
|
||||||
|
<legend>Software</legend>
|
||||||
|
<table>
|
||||||
|
<tr><th>Firmware Version:</th><td><%= ${FIRMWARE_VERSION} %></td></tr>
|
||||||
|
<tr><th>OpenWRT Version:</th><td><%= ${DISTRIB_DESCRIPTION} %></td></tr>
|
||||||
|
<tr><th>Kernel Version:</th><td><% uname -s -m -r %></td></tr>
|
||||||
|
<tr><th>Batman-Adv Version:</th><td><% cat /sys/module/batman_adv/version 2>/dev/null %></td></tr>
|
||||||
|
<tr><th>Fastd Version:</th><td><% fastd --version 2> /dev/null | cut -d' ' -f 2 %></td></tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</td></tr>
|
||||||
|
<tr><td>
|
||||||
|
<fieldset style="min-height: 12.65em;">
|
||||||
|
<legend>Netz: Freifunk</legend>
|
||||||
|
<table>
|
||||||
|
<tr><th>Nutzer:</th><td><% cat /sys/kernel/debug/batman_adv/bat0/transtable_local 2> /dev/null | grep -c 'W' %></td></tr>
|
||||||
|
<tr><th>Empfangen:</th><td><% cat /sys/class/net/br-mesh/statistics/rx_bytes | human_bytes %></td></tr>
|
||||||
|
<tr><th>Gesendet:</th><td><% cat /sys/class/net/br-mesh/statistics/tx_bytes | human_bytes %></td></tr>
|
||||||
|
<tr><th>IPv4 Adressen:</th><td><% addr 4 br-mesh %></td></tr>
|
||||||
|
<tr><th>IPv6 Adressen:</th><td><% addr 6 br-mesh %></td></tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</td><td>
|
||||||
|
<fieldset style="min-height: 12.65em;">
|
||||||
|
<legend>Netz: WAN</legend>
|
||||||
|
<table>
|
||||||
|
<tr><th>Internet vorhanden:</th><td><%= ${internet_active} %></td></tr>
|
||||||
|
<tr><th>Empfangen:</th><td><% cat /sys/class/net/${wanif}/statistics/rx_bytes | human_bytes %></td></tr>
|
||||||
|
<tr><th>Gesendet:</th><td><% cat /sys/class/net/${wanif}/statistics/tx_bytes | human_bytes %></td></tr>
|
||||||
|
<tr><th>IPv4 Adressen:</th><td><% addr 4 $wanif %></td></tr>
|
||||||
|
<tr><th>IPv6 Adressen:</th><td><% addr 6 $wanif %></td></tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<%in /www/ssl/cgi-bin/footer %>
|
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/haserl
|
||||||
|
|
||||||
|
<%
|
||||||
|
echo -en "Content-Type: text/html\r\n\r\n"
|
||||||
|
url="//logout:logout@${HTTP_HOST}/"
|
||||||
|
%>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<meta http-equiv="refresh" content="0; URL=<%= ${url} %>">
|
||||||
|
<meta http-equiv="cache-control" content="no-cache">
|
||||||
|
<meta http-equiv="expires" content="0">
|
||||||
|
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT">
|
||||||
|
<meta http-equiv="pragma" content="no-cache">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="<%= ${url} %>">Logging out...</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,48 @@
|
||||||
|
#!/usr/bin/haserl
|
||||||
|
|
||||||
|
<%
|
||||||
|
# write
|
||||||
|
if [ "$REQUEST_METHOD" == "POST" ] ; then
|
||||||
|
if [ "$POST_pass1" == "" ] ; then
|
||||||
|
MSG='<span class="red">Das Passwort darf nicht leer sein!</span>'
|
||||||
|
else
|
||||||
|
(echo "$POST_pass1"; sleep 1; echo "$POST_pass2") | passwd &>/dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
restart_uhttpd=1
|
||||||
|
MSG='<span class="green">Passwort geändert!</span>'
|
||||||
|
else
|
||||||
|
MSG='<span class="red">Die Passwörter stimmen nicht überein!</span>'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
%>
|
||||||
|
<%in /www/ssl/cgi-bin/header %>
|
||||||
|
<%in /www/ssl/cgi-bin/helpers %>
|
||||||
|
<% show_msg %>
|
||||||
|
<form method="POST">
|
||||||
|
<input type="text" name="username" value="root" style="display: none;" />
|
||||||
|
<table style="width: 100%;">
|
||||||
|
<tr><td>
|
||||||
|
<fieldset>
|
||||||
|
<legend>Passwort</legend>
|
||||||
|
<table>
|
||||||
|
<tr><th>Neues Passwort:</th><td><input type="password" name="pass1" value="" /></td></tr>
|
||||||
|
<tr><th>Bestätigung:</th><td><input type="password" name="pass2" value="" /></td></tr>
|
||||||
|
<tr><td colspan="2"></td></tr>
|
||||||
|
<tr><td colspan="2">
|
||||||
|
Das Passwort ist für den Zugriff auf die Weboberfläche des Routers<br /> und auch den Zugriff per SSH.
|
||||||
|
Der Benutzername ist 'root'.
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
<input type="submit" style="margin-top: 5px; margin-left: 3px;" />
|
||||||
|
</form>
|
||||||
|
<%in /www/ssl/cgi-bin/footer %>
|
||||||
|
<%
|
||||||
|
#force instant password change
|
||||||
|
if [ "$restart_uhttpd" == "1" ] ; then
|
||||||
|
/etc/init.d/uhttpd restart 2>/dev/null
|
||||||
|
fi
|
||||||
|
%>
|
|
@ -0,0 +1,104 @@
|
||||||
|
#!/usr/bin/haserl
|
||||||
|
|
||||||
|
<%
|
||||||
|
# write
|
||||||
|
if [ "$REQUEST_METHOD" == "POST" ] ; then
|
||||||
|
sed -i '/^.*# set via WebUI/d' /etc/network.mode
|
||||||
|
echo "ETHMODE=\"${POST_mode}\" # set via WebUI" >> /etc/network.mode
|
||||||
|
cp /rom/etc/sysctl.conf /etc/sysctl.conf
|
||||||
|
cp /rom/etc/config/network /etc/config/network
|
||||||
|
do_reboot=1
|
||||||
|
MSG='<span class="green">Port Modus geändert! Router startet neu...</span>'
|
||||||
|
fi
|
||||||
|
%>
|
||||||
|
<%in /www/ssl/cgi-bin/header %>
|
||||||
|
<%in /www/ssl/cgi-bin/helpers %>
|
||||||
|
<% show_msg %>
|
||||||
|
<form method="POST">
|
||||||
|
<table style="width: 100%;">
|
||||||
|
<% if swconfig list | grep -q switch0 ; then %>
|
||||||
|
<%# Device has a switch %>
|
||||||
|
<tr><td>
|
||||||
|
<fieldset>
|
||||||
|
<legend>Switch</legend>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<%
|
||||||
|
swconfig dev switch0 show | grep "\t*link:" | while read line ; do
|
||||||
|
line=$(echo "$line" | tr -d '\n' | tr -d '\t')
|
||||||
|
port=$(echo "$line" | sed 's/.* port:\([^ ]*\) .*/\1/')
|
||||||
|
link=$(echo "$line" | sed 's/.* link:\([^ ]*\).*/\1/')
|
||||||
|
if [ "$link" == "up" ] ; then
|
||||||
|
speed=$(echo "$line" | sed 's/.* speed:\([^ ]*\).*/\1/')
|
||||||
|
duplex=$(echo "$line" | sed 's/.* \([^ ]*-duplex\).*/\1/')
|
||||||
|
else
|
||||||
|
speed="no link"
|
||||||
|
duplex=""
|
||||||
|
fi
|
||||||
|
port="Port ${port}"
|
||||||
|
echo "<td class=\"swport\">"
|
||||||
|
echo "<span class=\"port\">${port}</span><br />"
|
||||||
|
echo "<img src=\"/port_${link}.png\" alt=\"${link}\" /><br />"
|
||||||
|
echo "<span class=\"stat\">$speed<br />$duplex</span>"
|
||||||
|
echo "</td>"
|
||||||
|
done
|
||||||
|
%>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table>
|
||||||
|
<tr><td></td></tr>
|
||||||
|
<tr><td>
|
||||||
|
Die Nummerierung und Reihenfolge der Ports entspricht nicht notwendigerweise der der Netzwerkanschlüsse am Router!<br />
|
||||||
|
Einer (oder mehrere) der Ports sind keine Netzwerkanschlüsse am Router sondern binden die Router CPU an den internen Switch an.
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</td></tr>
|
||||||
|
<% fi %>
|
||||||
|
<% if grep -q network.mode /etc/network.$(uci -q get board.model.name) ; then %>
|
||||||
|
<%
|
||||||
|
# Device has only one or two ports and makes use of /etc/network.mode
|
||||||
|
. /etc/network.mode
|
||||||
|
%>
|
||||||
|
<tr><td>
|
||||||
|
<fieldset>
|
||||||
|
<legend>Ethernet Anschluss</legend>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 1em;">Anschluss Modus:</th>
|
||||||
|
<td>
|
||||||
|
<select name="mode">
|
||||||
|
<% if grep ETHMODE /etc/network.$(uci -q get board.model.name) | grep -q WAN ; then %>
|
||||||
|
<option value="WAN" <% [ "$ETHMODE" == "WAN" ] && echo -n selected %>>WAN</option>
|
||||||
|
<% fi %>
|
||||||
|
<% if grep ETHMODE /etc/network.$(uci -q get board.model.name) | grep -q CLIENT ; then %>
|
||||||
|
<option value="CLIENT" <% [ "$ETHMODE" == "CLIENT" ] && echo -n selected %>>Client</option>
|
||||||
|
<% fi %>
|
||||||
|
<option value="BATMAN" <% [ "$ETHMODE" == "BATMAN" ] && echo -n selected %>>BATMAN</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td colspan="2"><input type="submit" name="change_mode" /></td></tr>
|
||||||
|
<tr><td colspan="2"></td></tr>
|
||||||
|
<tr><td colspan="2">
|
||||||
|
WAN: Knoten stellt über Ethernet Anschluss Verbindung zum Internet her.<br />
|
||||||
|
Client: Normale Clients stellen über Ethernet Anschluss des Knotens Verbindung zum Freifunk Netz her.<br />
|
||||||
|
BATMAN: Knoten stellt über Ethernet Anschluss Verbindung zu anderen MESH Knoten her.<br /><br />
|
||||||
|
|
||||||
|
Wenn diese Einstellung verändert wird, wird eine evtl. vorhandene manuelle Netzwerkkonfiguration in der
|
||||||
|
<tt>/etc/config/network</tt> überschrieben.<br />
|
||||||
|
Anschließend wird der Router neugestartet.
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</td></tr>
|
||||||
|
<% fi %>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<%in /www/ssl/cgi-bin/footer %>
|
||||||
|
<%
|
||||||
|
# write
|
||||||
|
if [ "$do_reboot" == "1" ] ; then
|
||||||
|
reboot
|
||||||
|
fi
|
||||||
|
%>
|
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/haserl
|
||||||
|
|
||||||
|
<%
|
||||||
|
# prepare
|
||||||
|
if [ "$REQUEST_METHOD" == "POST" ] ; then
|
||||||
|
if [ "$POST_reboot" != "" ] ; then
|
||||||
|
do_reboot=1
|
||||||
|
MSG='<span class="green">Router wird neugestartet...</span>'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
%>
|
||||||
|
<%in /www/ssl/cgi-bin/header %>
|
||||||
|
<%in /www/ssl/cgi-bin/helpers %>
|
||||||
|
<% show_msg %>
|
||||||
|
<form method="POST">
|
||||||
|
<table style="width: 100%;">
|
||||||
|
<tr><td>
|
||||||
|
<fieldset>
|
||||||
|
<legend>Router neustarten</legend>
|
||||||
|
<table>
|
||||||
|
<tr><td colspan="2"><input type="submit" name="reboot" value="Router neustarten" /></td></tr>
|
||||||
|
<tr><td colspan="2"></td></tr>
|
||||||
|
<tr><td colspan="2">Der Neustart dauert etwa 2 Minuten.</td></tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<%in /www/ssl/cgi-bin/footer %>
|
||||||
|
<%
|
||||||
|
# write
|
||||||
|
if [ "$do_reboot" == "1" ] ; then
|
||||||
|
reboot
|
||||||
|
fi
|
||||||
|
%>
|
|
@ -0,0 +1,84 @@
|
||||||
|
#!/usr/bin/haserl
|
||||||
|
|
||||||
|
<%
|
||||||
|
# write
|
||||||
|
if [ "$REQUEST_METHOD" == "POST" ] ; then
|
||||||
|
#check for valid hostname as specified in rfc 1123
|
||||||
|
#see http://stackoverflow.com/a/3824105
|
||||||
|
regex='^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])'
|
||||||
|
regex=$regex'(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$'
|
||||||
|
if [ "${#POST_hostname}" -ge "255" ] ; then
|
||||||
|
MSG='<span class="red">Knotenname ist länger als 255 Zeichen!</span>'
|
||||||
|
elif ! echo -n "$POST_hostname" | egrep -q "$regex"; then
|
||||||
|
MSG='<span class="red">Knotenname enthält ungültige Zeichen!</span>'
|
||||||
|
else
|
||||||
|
# Allgemeine Einstellungen
|
||||||
|
uci set -q "system.@system[0].hostname=${POST_hostname}"
|
||||||
|
uci get -q 'system.@system[0].hostname' > /proc/sys/kernel/hostname
|
||||||
|
uci set -q "system.@system[0].description=${POST_description}"
|
||||||
|
uci set -q "system.@system[0].latitude=${POST_latitude}"
|
||||||
|
uci set -q "system.@system[0].longitude=${POST_longitude}"
|
||||||
|
uci set -q "system.@system[0].position_comment=${POST_position_comment}"
|
||||||
|
uci set -q "system.@system[0].contact=${POST_contact}"
|
||||||
|
|
||||||
|
# Bitratenbegrenzung
|
||||||
|
if [ "$POST_traffic_limit" == "on" ] ; then
|
||||||
|
uci set -q "simple-tc.example.ifname=$(uci -q get network.wan.ifname)"
|
||||||
|
uci set -q "simple-tc.example.enabled=1"
|
||||||
|
else
|
||||||
|
uci set -q "simple-tc.example.enabled=0"
|
||||||
|
fi
|
||||||
|
uci set -q "simple-tc.example.limit_ingress=${POST_limit_ingress}"
|
||||||
|
uci set -q "simple-tc.example.limit_egress=${POST_limit_egress}"
|
||||||
|
|
||||||
|
uci commit
|
||||||
|
MSG='<span class="green">Daten gespeichert! - Bitte Router neustarten.</span>'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
%>
|
||||||
|
<%in /www/ssl/cgi-bin/header %>
|
||||||
|
<%in /www/ssl/cgi-bin/helpers %>
|
||||||
|
<%
|
||||||
|
# read
|
||||||
|
if [ "$(uci get -q 'simple-tc.example.enabled')" == "1" ] ; then
|
||||||
|
traffic_checked="checked"
|
||||||
|
else
|
||||||
|
traffic_checked=""
|
||||||
|
fi
|
||||||
|
%>
|
||||||
|
<% show_msg %>
|
||||||
|
<form method="POST">
|
||||||
|
<table style="width: 100%;">
|
||||||
|
<tr><td>
|
||||||
|
<fieldset style="min-height: 13em;">
|
||||||
|
<legend>Allgemeine Einstellungen</legend>
|
||||||
|
<table>
|
||||||
|
<tr><th>Knotenname:</th><td><input type="text" name="hostname" value="<%= ${HOSTNAME} %>" /></td></tr>
|
||||||
|
<tr><th>Knotenbeschreibung:</th><td><input type="text" name="description" value="<%= $(uci get -q 'system.@system[0].description') %>" /></td></tr>
|
||||||
|
<tr><th>GPS Breitengrad:</th>
|
||||||
|
<td><input type="text" name="latitude" value="<%= $(uci get -q 'system.@system[0].latitude') %>" /></td>
|
||||||
|
<td rowspan="2" style="vertical-align: middle;">
|
||||||
|
<button type="button" style="height: 100%; width: 126px; margin-left: 5px;" onclick="window.open('/map.html', '_blank', 'location=0,status=0,scrollbars=1,width=400,height=300');">Position auf Karte anzeigen / setzen</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr><th>GPS Längengrad:</th><td><input type="text" name="longitude" value="<%= $(uci get -q 'system.@system[0].longitude') %>" /></td></tr>
|
||||||
|
<tr><th>Standortbeschreibung:</th><td><input type="text" name="position_comment" value="<%= $(uci get -q 'system.@system[0].position_comment') %>" /></td></tr>
|
||||||
|
<tr><th>E-Mail Adresse:</th><td><input type="email" name="contact" value="<%= $(uci get -q 'system.@system[0].contact') %>" /></td></tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</td><td>
|
||||||
|
<fieldset style="min-height: 13em;" class="smallinput">
|
||||||
|
<legend>Bitratenbegrenzung</legend>
|
||||||
|
<table>
|
||||||
|
<tr><th>Aktiviert:</th><td colspan="2">
|
||||||
|
<input type="checkbox" name="traffic_limit" <%= ${traffic_checked} %>>
|
||||||
|
</td></tr>
|
||||||
|
<tr><th>Freifunk Download:</th><td><input type="text" name="limit_ingress" value="<%= $(uci get -q 'simple-tc.example.limit_ingress') %>" /></td><td>kbit/s</td></tr>
|
||||||
|
<tr><th>Freifunk Upload:</th><td><input type="text" name="limit_egress" value="<%= $(uci get -q 'simple-tc.example.limit_egress') %>" /></td><td>kbit/s</td></tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
<input type="submit" style="margin-top: 5px; margin-left: 3px;" />
|
||||||
|
</form>
|
||||||
|
<%in /www/ssl/cgi-bin/footer %>
|
|
@ -0,0 +1,77 @@
|
||||||
|
#!/usr/bin/haserl --upload-dir=/tmp --upload-limit=12000
|
||||||
|
|
||||||
|
<%
|
||||||
|
# prepare
|
||||||
|
if [ "$REQUEST_METHOD" == "POST" ] ; then
|
||||||
|
if [ "$POST_reset" != "" ] ; then
|
||||||
|
# reset
|
||||||
|
if [ "$FORM_really_reset" == "on" ] ; then
|
||||||
|
do_reset=1
|
||||||
|
MSG='<span class="green">Router wird zurückgesetzt und anschließend neugestartet...</span>'
|
||||||
|
fi
|
||||||
|
elif [ "$POST_upgrade" != "" ] ; then
|
||||||
|
# upgrade
|
||||||
|
if [ ! -f "$HASERL_firmware_path" ] ; then
|
||||||
|
MSG='<span class="red">Firmware Datei nicht gefunden!</span>'
|
||||||
|
elif [ "$(du -k "$HASERL_firmware_path" | cut -f1)" == "0" ] ; then
|
||||||
|
MSG='<span class="red">Firmware Datei ist leer!</span>'
|
||||||
|
elif ! error=$(sysupgrade -T "$HASERL_firmware_path") ; then
|
||||||
|
MSG="<span class=\"red\">Firmware Datei ungültig: <tt>${error}</tt></span>"
|
||||||
|
else
|
||||||
|
if [ "$POST_keep_config" == "on" ] ; then
|
||||||
|
args=""
|
||||||
|
else
|
||||||
|
args="-n"
|
||||||
|
fi
|
||||||
|
do_sysupgrade=1
|
||||||
|
MSG='<span class="green">Firmware Upgrade wird gestartet...</span>'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
%>
|
||||||
|
<%in /www/ssl/cgi-bin/header %>
|
||||||
|
<%in /www/ssl/cgi-bin/helpers %>
|
||||||
|
<% show_msg %>
|
||||||
|
<form method="POST" enctype="multipart/form-data">
|
||||||
|
<table style="width: 100%;">
|
||||||
|
<tr><td>
|
||||||
|
<fieldset style="min-height: 9em;">
|
||||||
|
<legend>Manuelles Upgrade</legend>
|
||||||
|
<table>
|
||||||
|
<tr><th style="width: 1em;">Firmware Image:</th><td><input type="file" name="firmware" /></td></tr>
|
||||||
|
<tr><th>Konfiguration erhalten:</th><td><input type="checkbox" name="keep_config" checked /></td></tr>
|
||||||
|
<tr><td colspan="2"><input type="submit" name="upgrade" value="Upgrade" /></td></tr>
|
||||||
|
<tr><td colspan="2"></td></tr>
|
||||||
|
<tr><td colspan="2">Hier kann ein Freifunk-Image verwendet werden (*-sysupgrade.bin) oder die Firmware des Routerherstellers.</td></tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</td><td>
|
||||||
|
<fieldset style="min-height: 9em;">
|
||||||
|
<legend>Router zurücksetzen</legend>
|
||||||
|
<table>
|
||||||
|
<tr><th style="width: 1em;">Wirklich zurücksetzen:</th><td>
|
||||||
|
<input type="checkbox" name="really_reset">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td colspan="2"><input type="submit" name="reset" value="Zurücksetzen" /></td></tr>
|
||||||
|
<tr><td colspan="2"></td></tr>
|
||||||
|
<tr><td colspan="2">Alle Einstellungen werden zurückgesetzt und der Router startet neu.</td></tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<%in /www/ssl/cgi-bin/footer %>
|
||||||
|
<%
|
||||||
|
# write
|
||||||
|
if [ "$do_reset" == "1" ] ; then
|
||||||
|
echo "<pre>"
|
||||||
|
echo y | firstboot
|
||||||
|
reboot
|
||||||
|
echo "</pre>"
|
||||||
|
elif [ "$do_sysupgrade" == "1" ] ; then
|
||||||
|
echo "<pre>"
|
||||||
|
echo "# sysupgrade $args $HASERL_firmware_path"
|
||||||
|
sysupgrade $args $HASERL_firmware_path
|
||||||
|
echo "</pre>"
|
||||||
|
fi
|
||||||
|
%>
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/usr/bin/haserl
|
||||||
|
|
||||||
|
<%in /www/ssl/cgi-bin/header %>
|
||||||
|
<table style="width: 100%">
|
||||||
|
<tr><td>
|
||||||
|
<fieldset>
|
||||||
|
<legend>Wifi Scan</legend>
|
||||||
|
<table class="wifitable">
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Kanal</th>
|
||||||
|
<th>Signal</th>
|
||||||
|
<th>Typ</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<%
|
||||||
|
iwinfo w2mesh scan |\
|
||||||
|
awk -v RS='' \
|
||||||
|
'{r = gensub(/.*ESSID: "?(unknown|[^"]*)"?.*Mode: ([^ ]*).*Channel: ([0-9]*).*Signal: (-[0-9]*) dBm.*/, \
|
||||||
|
"<!-- \\4 --><tr><td>\\1</td><td>\\3</td><td>\\4 dBm</td><td>\\2</td></tr>", "g"); print r;}' | sort -n
|
||||||
|
# The HTML comment contains the signal quality to allow sorting
|
||||||
|
%>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<%in /www/ssl/cgi-bin/footer %>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.2" width="81" height="60" viewBox="0 0 170 165" preserveAspectRatio="true">
|
||||||
|
<g transform="matrix(1.57375 0 0 1.57375 -52.396 -15.488)">
|
||||||
|
<circle cx="36" cy="54" r="22" transform="matrix(1.47762 0 0 1.5065 -3.122 -2.435)" fill="none" stroke="#de2c68" stroke-width="1.14544892"/>
|
||||||
|
<circle cx="74" cy="44" r="22" transform="matrix(1.59505 0 0 1.62233 -10.072 -9.178)" fill="none" stroke="#de2c68" stroke-width="1.06239557"/>
|
||||||
|
<circle cx="74" cy="44" r="29" transform="matrix(1.58313 0 0 1.59864 -9.34 -8.136)" fill="none" stroke="#de2c68" stroke-width="5.81192684"/>
|
||||||
|
<path fill="#fc3" d="M42.23 62.95h-7.247l5.798 5.497H29.187v5.495H40.78l-5.797 5.495h7.247l8.696-8.243M117.514 85.333l-9.095-9.414h19.706v-9.414H108.42l9.094-9.414h-12.127l-13.644 14.12 13.644 14.12"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 846 B |
|
@ -0,0 +1,13 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<meta http-equiv="refresh" content="0; URL=/cgi-bin/home.html">
|
||||||
|
<meta http-equiv="cache-control" content="no-cache">
|
||||||
|
<meta http-equiv="expires" content="0">
|
||||||
|
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT">
|
||||||
|
<meta http-equiv="pragma" content="no-cache">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="/cgi-bin/home.html">Redirecting...</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
Binary file not shown.
After Width: | Height: | Size: 982 B |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -0,0 +1,220 @@
|
||||||
|
* {
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: verdana, helvetica, sans-serif;
|
||||||
|
font-size: 13px;
|
||||||
|
padding: 0px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
color: #222222;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
background-color: inherit;
|
||||||
|
color: #007ee0;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
text-align: justify;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
line-height: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
list-style: disc;
|
||||||
|
padding-left: 15px;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: 20px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
font-size: 13px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header {
|
||||||
|
color: #222;
|
||||||
|
padding: 5px 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header h1 {
|
||||||
|
font-size: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header h2 {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu {
|
||||||
|
padding: 5px 40px 0px 40px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
color: #222222;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
border-bottom: solid 1px #DADADA;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu div {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu ul {
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
top: 1px;
|
||||||
|
list-style: none;
|
||||||
|
padding: 0px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu ul li {
|
||||||
|
position: relative;
|
||||||
|
float: left;
|
||||||
|
border: solid 1px #dadada;
|
||||||
|
border-bottom: 0px;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu ul li a {
|
||||||
|
display: block;
|
||||||
|
padding: 5px 10px 8px 10px;
|
||||||
|
text-decoration: none;
|
||||||
|
background-color: inherit;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu ul li a:hover {
|
||||||
|
background-color: #d22755;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu ul li.active, #menu ul li.active a, #menu ul li.active a:hover {
|
||||||
|
background-color: #ffffff;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
#container {
|
||||||
|
margin: 0px 40px 0px 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#primarycontainer {
|
||||||
|
float: left;
|
||||||
|
margin-right: -200px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#primarycontent p {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#secondarycontent {
|
||||||
|
float: right;
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer {
|
||||||
|
text-align: center;
|
||||||
|
margin: 20px 0px 0px 0px;
|
||||||
|
padding-top: 15px;
|
||||||
|
border-top: solid 1px #DADADA;
|
||||||
|
clear: both;
|
||||||
|
color: #DADADA;
|
||||||
|
font-size: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer a {
|
||||||
|
color: #DADADA;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clearit {
|
||||||
|
clear: both;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* my */
|
||||||
|
fieldset th {
|
||||||
|
text-align: right;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wifitable th {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wifitable td, .wifitable th {
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
form fieldset th, form fieldset td {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset input[type=text], fieldset input[type=email], fieldset input[type=password], fieldset input[type=file] {
|
||||||
|
width: 20em;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset.smallinput input[type=text], fieldset.smallinput input[type=email], fieldset.smallinput input[type=password], fieldset.smallinput input[type=file] {
|
||||||
|
width: 10em;
|
||||||
|
}
|
||||||
|
|
||||||
|
input, button, select {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=text], input[type=email], input[type=password], input[type=number] {
|
||||||
|
border: 1px solid #DADADA;
|
||||||
|
}
|
||||||
|
|
||||||
|
.msg {
|
||||||
|
border: 1px solid #DADADA;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: -10px 3px 10px;
|
||||||
|
padding: 5px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
tt {
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.msg .red {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.msg .green {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
margin: 0 43px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.swport {
|
||||||
|
width: 80px;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.swport .port {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.swport img {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.swport .stat {
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
Loading…
Reference in New Issue