[RFC PATCH v4 08/11] fff-web: Include new options into settings.html

mail at adrianschmutzler.de mail at adrianschmutzler.de
So Aug 20 22:41:55 CEST 2017


Hallo  Christian,

zentral ist folgender Patch:

[RFC,v5,04/11] Rearrange fff config values into their own config file
https://pw.freifunk-franken.de/patch/420/

Hier führe ich quasi eine neue FFF config-Datei ein, die die Einträge in der
config/system beinhaltet. Dadurch entsteht der große Vorteil, dass man eben
in dieser "Freifunk-Config" nun auch Parameter für alles mögliche setzen
kann und nicht mehr in der von LEDE benutzten config/system rumeditieren
muss.

4/11 (v5) führt also die neue config/fff-Datei ein und übernimmt die alten
config/system Parameter.
5/11 (v4) Ergänzt die PoE-Sachen und macht diese über config/fff
updatesicher.
6/11 (v4) Fügt Parameter für die Update-Benachrichtigung hinzu
7/11 (v4) Ist schon erledigt
8/11 (v4) (also dieser hier) fügt nun für die neuen Parameter die
Einstellbarkeit im WebUI ein (vorher nur Editieren der Datei)

Der erste Schritt wäre also das Auseinandersetzen mit dem 4/11-er Patch, da
die anderen auf dem Konzept aufbauen. (Da die fff-config-Datei eben diverse
Einstellungen möglich/konfortabel macht).

Jetzt wo ein Teil der Patches schon applied ist, kann ich das Ganze aber
auch nochmal neu sortieren und hochschicken (sind dann halt nochmal 8-10
Mails). Leider zeigt das Patchwork auch meinen Cover-Letter nicht an, der
liegt nur in der Mail-Liste.

Grüße

Adrian

-----Original Message-----
From: franken-dev [mailto:franken-dev-bounces at freifunk.net] On Behalf Of
Christian Dresel
Sent: Sonntag, 20. August 2017 13:49
To: Adrian Schmutzler <freifunk at adrianschmutzler.de>;
franken-dev at freifunk.net
Subject: Re: [RFC PATCH v4 08/11] fff-web: Include new options into
settings.html

hi

du nutzt hier auf einmal uci -q set fff.... die File fff gibt es in
/etc/config aber noch gar nicht (oder ich hab was übersehen/verpasst?).

Es scheint auch so, als könnte man nicht einfach:

uci -q set "fff.notifyupdate.value=1"

reinschreiben sondern muss das strukturiert aufbauen (ich hab von uci auch
recht wenig Ahnung). Hier mal was ich eben getestet habe:

root at PicoWest:~# uci set "fff.notifyupdate.value=0"
uci: Entry not found
root at PicoWest:~# touch /etc/config/fff
root at PicoWest:~# uci show fff
root at PicoWest:~# uci set "fff.notifyupdate.value=0"
uci: Invalid argument
root at PicoWest:~# uci set "fff.notifyupdate=0"
root at PicoWest:~# uci show fff
fff.notifyupdate=0
root at PicoWest:~#

Hab ich irgendein Vorgängerpatch verpasst oder irgendwas übersehen?

mfg

Christian

On 21.07.2017 15:08, Adrian Schmutzler wrote:
> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> 
> Tested-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ---
>  .../fff-web/files/www/ssl/cgi-bin/settings.html    | 72
++++++++++++++++++++--
>  1 file changed, 67 insertions(+), 5 deletions(-)
> 
> diff --git 
> a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html 
> b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
> index 2ccc756..779e7eb 100755
> --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
> +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/settings.html
> @@ -37,7 +37,33 @@ if [ "$REQUEST_METHOD" == "POST" ] ; then
>  		uci -q set "simple-tc.example.ifname=$(uci -q get
network.wan.ifname)"
>  		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 [ "$POST_upgrade_reset" == "on" ] ; then
> +			uci -q set "fff.notifyupdate.resetonupgrade=1"
> +		else
> +			uci -q set "fff.notifyupdate.resetonupgrade=0"
> +		fi
> +		
> +		if uci -q get system.poe_passthrough > /dev/null ; then
> +			uci -q set "fff.poe_passthrough=gpio"
> +			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 commit
>  		
>  		/usr/sbin/applysimpletc
> @@ -50,11 +76,22 @@ fi
>  <%in /www/ssl/cgi-bin/helpers %>
>  <%
>  # read
> -if [ "$(uci -q get 'fff. at trafficcontrol[0].enabled')" == "1" ] ; then
> -	traffic_checked='checked="checked" '
> +chkd='checked="checked" '
> +if [ "$(uci -q get 'fff. at trafficcontrol[0].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
> +if [ "$(uci -q get 'fff.notifyupdate.resetonupgrade')" == "0" ] ; then #
not set=1
> +	upgrade_reset_checked=""
> +else
> +	upgrade_reset_checked="$chkd"
> +fi
>  %>
>  <% show_msg %>
>  <form method="post">
> @@ -76,8 +113,9 @@ fi
>  		<tr><th>E-Mail Adresse:</th><td><input type="email"
name="contact" value="<%= $(uci -q get 'fff. at system[0].contact') %>"
/></td></tr>
>  	</table>
>  </fieldset>
> +<p><input type="submit" style="margin-top: 5px; margin-left: 3px;" 
> +/></p>
>  </td><td>
> -<fieldset style="min-height: 13em;" class="smallinput">
> +<fieldset style="min-height: 7em;" class="smallinput">
>  	<legend>Bitratenbegrenzung</legend>
>  	<table>
>  		<tr><th>Aktiviert:</th><td colspan="2"> @@ -87,8 +125,32 @@
fi
>  		<tr><th>Freifunk Upload:</th><td><input type="text"
name="limit_egress" value="<%= $(uci -q get
'fff. at trafficcontrol[0].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>
> +		<tr><th>Reset notification setting after upgrade:</th><td
colspan="2">
> +			<input type="checkbox" name="upgrade_reset" <%=
${upgrade_reset_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>
>  </table>
> -<p><input type="submit" style="margin-top: 5px; margin-left: 3px;" 
> /></p>  </form>  <%in /www/ssl/cgi-bin/footer %>
> 




Mehr Informationen über die Mailingliste franken-dev