Adrian Schmutzler
def42fadde
The former fff-web package is essentially for serving a user interface (UI). Therefore, include the UI in the name to distinguish it from other web packages. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Reviewed-by: Robert Langhammer <rlanghammer@web.de> Acked-by: Christian Dresel <freifunk@dresel.systems>
158 lines
7.4 KiB
HTML
Executable File
158 lines
7.4 KiB
HTML
Executable File
#!/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 -q set "fff.system.hostname=${POST_hostname}"
|
|
echo "$(uci -q get "fff.system.hostname")" > /proc/sys/kernel/hostname
|
|
uci -q set "system.@system[0].hostname=${POST_hostname}"
|
|
uci -q set "fff.system.description=${POST_description}"
|
|
uci -q set "fff.system.latitude=${POST_latitude}"
|
|
uci -q set "fff.system.longitude=${POST_longitude}"
|
|
uci -q set "fff.system.position_comment=${POST_position_comment}"
|
|
uci -q set "fff.system.contact=${POST_contact}"
|
|
|
|
# Bitratenbegrenzung
|
|
uci -q get "fff.trafficcontrol" > /dev/null || uci -q set fff.trafficcontrol=fff
|
|
if [ "$POST_traffic_limit" = "on" ] ; then
|
|
uci -q set "fff.trafficcontrol.enabled=1"
|
|
uci -q set "simple-tc.example.enabled=1"
|
|
else
|
|
uci -q set "fff.trafficcontrol.enabled=0"
|
|
uci -q set "simple-tc.example.enabled=0"
|
|
fi
|
|
uci -q set "fff.trafficcontrol.limit_in=${POST_limit_ingress}"
|
|
uci -q set "fff.trafficcontrol.limit_out=${POST_limit_egress}"
|
|
|
|
uci -q set "simple-tc.example.ifname=wan"
|
|
uci -q set "simple-tc.example.limit_ingress=${POST_limit_ingress}"
|
|
uci -q set "simple-tc.example.limit_egress=${POST_limit_egress}"
|
|
|
|
# Restliche Einstellungen
|
|
uci -q set "fff.notifyupdate=webui"
|
|
if [ "$POST_upgrade_notification" = "on" ] ; then
|
|
uci -q set "fff.notifyupdate.value=1"
|
|
else
|
|
uci -q set "fff.notifyupdate.value=0"
|
|
rm -f /tmp/fwcheck
|
|
rm -f /tmp/isupdate
|
|
fi
|
|
|
|
if uci -q get system.poe_passthrough > /dev/null ; then
|
|
uci -q set "fff.poe_passthrough=fff"
|
|
if [ "$POST_poe_passthrough" = "on" ] ; then
|
|
uci -q set "fff.poe_passthrough.active=1"
|
|
uci -q set "system.poe_passthrough.value=1"
|
|
else
|
|
uci -q set "fff.poe_passthrough.active=0"
|
|
uci -q set "system.poe_passthrough.value=0"
|
|
fi
|
|
fi
|
|
|
|
uci -q commit
|
|
|
|
MSG='<span class="green">Daten gespeichert! - Bitte Router neustarten.</span>'
|
|
fi
|
|
fi
|
|
%>
|
|
<%in /www/include/header %>
|
|
<%in /www/include/helpers %>
|
|
<%
|
|
# read
|
|
chkd='checked="checked" '
|
|
if [ "$(uci -q get 'fff.trafficcontrol.enabled')" = "1" ] ; then # not set=0
|
|
traffic_checked="$chkd"
|
|
else
|
|
traffic_checked=""
|
|
fi
|
|
if [ "$(uci -q get 'fff.notifyupdate.value')" = "0" ] ; then # not set=1
|
|
upgrade_checked=""
|
|
else
|
|
upgrade_checked="$chkd"
|
|
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 -q get 'fff.system.description') %>" /></td></tr>
|
|
<tr><th>GPS Breitengrad:</th>
|
|
<td><input type="text" name="latitude" value="<%= $(uci -q get 'fff.system.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 -q get 'fff.system.longitude') %>" /></td></tr>
|
|
<tr><th>Standortbeschreibung:</th><td><input type="text" name="position_comment" value="<%= $(uci -q get 'fff.system.position_comment') %>" /></td></tr>
|
|
<tr><th>E-Mail Adresse:</th><td><input type="email" name="contact" value="<%= $(uci -q get 'fff.system.contact') %>" /></td></tr>
|
|
</table>
|
|
</fieldset>
|
|
<p><input type="submit" style="margin-top: 5px; margin-left: 3px;" /></p>
|
|
</td><td>
|
|
<fieldset style="min-height: 7em;" 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 -q get 'fff.trafficcontrol.limit_in') %>" /></td><td>kbit/s</td></tr>
|
|
<tr><th>Freifunk Upload:</th><td><input type="text" name="limit_egress" value="<%= $(uci -q get 'fff.trafficcontrol.limit_out') %>" /></td><td>kbit/s</td></tr>
|
|
</table>
|
|
</fieldset>
|
|
<fieldset style="min-height: 8em;" class="smallinput">
|
|
<legend>Weitere Einstellungen</legend>
|
|
<table>
|
|
<tr><th>Show upgrade notification:</th><td colspan="2">
|
|
<input type="checkbox" name="upgrade_notification" <%= ${upgrade_checked} %>/>
|
|
</td></tr>
|
|
|
|
<%
|
|
if uci -q get system.poe_passthrough > /dev/null ; then
|
|
if [ "$(uci -q get 'fff.poe_passthrough.active')" = "1" ] ; then # not set=0
|
|
poe_pt_checked="$chkd"
|
|
else
|
|
poe_pt_checked=""
|
|
fi
|
|
%>
|
|
<tr><th>Enable PoE passthrough:</th><td colspan="2">
|
|
<input type="checkbox" name="poe_passthrough" <%= ${poe_pt_checked} %>/>
|
|
</td></tr>
|
|
<% fi %>
|
|
|
|
</table>
|
|
</fieldset>
|
|
</td></tr>
|
|
<tr><td style="width:50%">
|
|
<h3 style="margin-bottom:12px;margin-top:40px">Datenschutzhinweise:</h3>
|
|
<ol>
|
|
<li style="margin-bottom:6px">Die Angaben zur <span style="font-weight:bold">Position</span> sind für die Funktion des Netzwerkes erforderlich, sodass Router einer bestimmten Netzuntereinheit ("Hood") zugeordnet werden können.</li>
|
|
<li style="margin-bottom:6px">Die <span style="font-weight:bold">Kontakt-Daten</span> sind erforderlich, damit im Falle einer Funktionsstörung eine verantwortliche Person kontaktiert werden kann.</li>
|
|
<li style="margin-bottom:6px"><span style="font-weight:bold">Ohne Angabe von Position und Kontaktadresse kann der Router nicht betrieben werden.</span> Alle weiteren Angaben sind freiwillig.</li>
|
|
<li style="margin-bottom:6px">Alle eingegebenen (verpflichtenden und freiwilligen) Daten sind sowohl im Netzwerk als auch öffentlich zugänglich.<br />Zu Zwecken der Diagnose und zur Kontaktaufnahme im Störfall können diese von verschiedenen Instanzen im Netz sowie von Dritten gespeichert und verarbeitet werden.</li>
|
|
</ol>
|
|
</td><td>
|
|
<h3 style="margin-bottom:12px;margin-top:40px">Data processing notes:</h3>
|
|
<ol><li style="margin-bottom:6px">The <span style="font-weight:bold">coordinates</span> are required for the network operation, so routers can be assigned to a particular network sub unit ("hood").</li>
|
|
<li style="margin-bottom:6px"><span style="font-weight:bold">Contact information</span> is necessary to be able to contact a responsible person in case of malfunction.</li>
|
|
<li style="margin-bottom:6px"><span style="font-weight:bold">Without providing coordinates and contact information the router must not operate.</span> Any additional data is optional.</li>
|
|
<li style="margin-bottom:6px">Every piece of information entered (mandatory and optional) will be accessible both inside the network and publicly.<br />For diagnosis and for establishing contact in case of an incident data may be saved and processed from various instances inside the network as well from third parties.</li>
|
|
</ol>
|
|
</td></tr>
|
|
</table>
|
|
</form>
|
|
<%in /www/include/footer %>
|