2016-03-13 13:32:12 +01:00
#!/usr/bin/haserl
< %
# write
2018-07-26 19:22:22 +02:00
if [ "$REQUEST_METHOD" = "POST" ] ; then
2016-03-13 13:32:12 +01:00
#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 > '
2017-11-03 15:00:03 +01:00
elif ! echo -n "$POST_hostname" | egrep -q "$regex"; then
2016-03-13 13:32:12 +01:00
MSG='< span class = "red" > Knotenname enthä lt ungü ltige Zeichen!< / span > '
else
# Allgemeine Einstellungen
2017-11-03 15:00:00 +01:00
uci -q set "fff.system.hostname=${POST_hostname}"
echo "$(uci -q get "fff.system.hostname")" > /proc/sys/kernel/hostname
2017-02-17 08:06:51 +01:00
uci -q set "system.@system[0].hostname=${POST_hostname}"
2017-11-03 15:00:00 +01:00
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}"
2016-03-13 13:32:12 +01:00
# Bitratenbegrenzung
2017-11-03 15:00:00 +01:00
uci -q get "fff.trafficcontrol" > /dev/null || uci -q set fff.trafficcontrol=fff
2018-07-26 19:22:22 +02:00
if [ "$POST_traffic_limit" = "on" ] ; then
2017-11-03 15:00:00 +01:00
uci -q set "fff.trafficcontrol.enabled=1"
2017-02-17 08:06:51 +01:00
uci -q set "simple-tc.example.enabled=1"
2016-03-13 13:32:12 +01:00
else
2017-11-03 15:00:00 +01:00
uci -q set "fff.trafficcontrol.enabled=0"
2017-02-17 08:06:51 +01:00
uci -q set "simple-tc.example.enabled=0"
2016-03-13 13:32:12 +01:00
fi
2017-11-03 15:00:00 +01:00
uci -q set "fff.trafficcontrol.limit_in=${POST_limit_ingress}"
uci -q set "fff.trafficcontrol.limit_out=${POST_limit_egress}"
2017-11-03 15:00:03 +01:00
2017-11-03 15:00:00 +01:00
uci -q set "simple-tc.example.ifname=wan"
2017-02-17 08:06:51 +01:00
uci -q set "simple-tc.example.limit_ingress=${POST_limit_ingress}"
uci -q set "simple-tc.example.limit_egress=${POST_limit_egress}"
2016-03-13 13:32:12 +01:00
2017-11-03 15:00:03 +01:00
# Restliche Einstellungen
uci -q set "fff.notifyupdate=webui"
2018-07-26 19:22:22 +02:00
if [ "$POST_upgrade_notification" = "on" ] ; then
2017-11-03 15:00:03 +01:00
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"
2018-07-26 19:22:22 +02:00
if [ "$POST_poe_passthrough" = "on" ] ; then
2017-11-03 15:00:03 +01:00
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
2017-11-03 15:00:00 +01:00
uci -q commit
2017-09-17 22:05:12 +02:00
2016-03-13 13:32:12 +01:00
MSG='< span class = "green" > Daten gespeichert! - Bitte Router neustarten.< / span > '
fi
fi
%>
2020-12-12 17:12:30 +01:00
< %in /www/include/header %>
< %in /www/include/helpers %>
2016-03-13 13:32:12 +01:00
< %
# read
2017-11-03 15:00:03 +01:00
chkd='checked="checked" '
2018-07-26 19:22:22 +02:00
if [ "$(uci -q get 'fff.trafficcontrol.enabled')" = "1" ] ; then # not set=0
2017-11-03 15:00:03 +01:00
traffic_checked="$chkd"
2016-03-13 13:32:12 +01:00
else
traffic_checked=""
fi
2018-07-26 19:22:22 +02:00
if [ "$(uci -q get 'fff.notifyupdate.value')" = "0" ] ; then # not set=1
2017-11-03 15:00:03 +01:00
upgrade_checked=""
else
upgrade_checked="$chkd"
fi
2016-03-13 13:32:12 +01:00
%>
< % show_msg %>
2017-07-21 15:08:45 +02:00
< form method = "post" >
2016-03-13 13:32:12 +01:00
< 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 >
2017-11-03 15:00:00 +01:00
< tr > < th > Knotenbeschreibung:< / th > < td > < input type = "text" name = "description" value = "<%= $(uci -q get 'fff.system.description') %>" / > < / td > < / tr >
2016-03-13 13:32:12 +01:00
< tr > < th > GPS Breitengrad:< / th >
2017-11-03 15:00:00 +01:00
< td > < input type = "text" name = "latitude" value = "<%= $(uci -q get 'fff.system.latitude') %>" / > < / td >
2016-03-13 13:32:12 +01:00
< 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 >
2017-11-03 15:00:00 +01:00
< 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 >
2016-03-13 13:32:12 +01:00
< / table >
< / fieldset >
2017-11-03 15:00:03 +01:00
< p > < input type = "submit" style = "margin-top: 5px; margin-left: 3px;" / > < / p >
2016-03-13 13:32:12 +01:00
< / td > < td >
2017-11-03 15:00:03 +01:00
< fieldset style = "min-height: 7em;" class = "smallinput" >
2016-03-13 13:32:12 +01:00
< legend > Bitratenbegrenzung< / legend >
< table >
< tr > < th > Aktiviert:< / th > < td colspan = "2" >
2017-07-21 15:08:45 +02:00
< input type = "checkbox" name = "traffic_limit" < % = $ { traffic_checked } % > />
2016-03-13 13:32:12 +01:00
< / td > < / tr >
2017-11-03 15:00:00 +01:00
< 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 >
2016-03-13 13:32:12 +01:00
< / table >
< / fieldset >
2017-11-03 15:00:03 +01:00
< 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
2018-07-26 19:22:22 +02:00
if [ "$(uci -q get 'fff.poe_passthrough.active')" = "1" ] ; then # not set=0
2017-11-03 15:00:03 +01:00
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 >
2016-03-13 13:32:12 +01:00
< / td > < / tr >
2018-07-11 11:06:38 +02:00
< 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 >
2016-03-13 13:32:12 +01:00
< / table >
< / form >
2020-12-12 17:12:30 +01:00
< %in /www/include/footer %>