[RFC] Add Hoodselection in WebUI

Christian Dresel fff at chrisi01.de
Mo Okt 3 18:21:26 CEST 2016


Dieses Patch bietet die Möglichkeit im WebUI eine Hood auszuählen.
Vorgesehen ist dies nur für lokale Hoods mit Gateway vor Ort.
AKtuell sind die Hooddaten noch fest im Patch integriert, später
sollten sie aus den Hoodfiles des dez. Keyxchange kommen.
Bitte dieses Patch daher noch nicht applien, es dient nur als
Information das es sowas mittlerweile gibt.

Signed-off-by: Christian Dresel <fff at chrisi01.de>
---
 .../fff/fff-web/files/www/ssl/cgi-bin/header       |   1 +
 .../fff/fff-web/files/www/ssl/cgi-bin/hood.html    | 103 +++++++++++++++++++++
 2 files changed, 104 insertions(+)
 create mode 100644 src/packages/fff/fff-web/files/www/ssl/cgi-bin/hood.html

diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
index 4cecfcd..7a7d905 100755
--- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
+++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/header
@@ -36,6 +36,7 @@ HOSTNAME=$(uci get -q 'system. at system[0].hostname')
 			nav_entry settings.html		"Einstellungen"
 			nav_entry ports.html		"Anschlüsse"
 			nav_entry wifiscan.html		"Wifi Scan"
+			nav_entry hood.html         "Hoodauswahl"
 			nav_entry upgrade.html		"Upgrade"
 			nav_entry password.html		"Password"
 			nav_entry reboot.html		"Neustart"
diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/hood.html b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/hood.html
new file mode 100644
index 0000000..aa3f211
--- /dev/null
+++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/hood.html
@@ -0,0 +1,103 @@
+#!/usr/bin/haserl
+
+<%
+if [ "$REQUEST_METHOD" == "POST" ] ; then
+
+        hood=${POST_hood}
+        uci set -q "system. at system[0].hood=${POST_hood}"
+        uci commit
+
+        if [ $hood == "legacy" ] ; then
+                (
+                        echo "BATMAN_CHANNEL=1"
+                        echo "BATMAN_CHANNEL_5GHZ=36"
+                        echo "ESSID_AP=franken.freifunk.net"
+                        echo "ESSID_MESH=batman.franken.freifunk.net"
+                        echo "BSSID_MESH=00:ca:ff:ee:ba:be"
+                        echo "VPN_PROJECT=fff"
+                        echo "NTPD_IP=fe80::ff:feee:1%br-mesh"
+                        echo "UPGRADE_PATH=http://[fe80::ff:feee:1%br-mesh]/dev/firmware/current"
+                ) > /etc/community.cfg
+        fi
+
+        if [ $hood == "fablabnbg" ] ; then
+                (
+                        echo "BATMAN_CHANNEL=1"
+                        echo "BATMAN_CHANNEL_5GHZ=36"
+                        echo "ESSID_AP=fablabnbg.freifunk.net"
+                        echo "ESSID_MESH=batman.fablabnbg.freifunk.net"
+                        echo "BSSID_MESH=ca:ff:ee:ba:be:04"
+                        echo "VPN_PROJECT=fff"
+                        echo "NTPD_IP=fe80::ff:feee:1%br-mesh"
+                        echo "UPGRADE_PATH=http://[fe80::ff:feee:1%br-mesh]/dev/firmware/current"
+                ) > /etc/community.cfg
+        fi
+
+        if [ $hood == "db0fue" ] ; then
+                (
+                        echo "BATMAN_CHANNEL=1"
+                        echo "BATMAN_CHANNEL_5GHZ=36"
+                        echo "ESSID_AP=db0fue.freifunk.net"
+                        echo "ESSID_MESH=batman.db0fue.freifunk.net"
+                        echo "BSSID_MESH=ca:ff:ee:ba:be:05"
+                        echo "VPN_PROJECT=fff"
+                        echo "NTPD_IP=fe80::ff:feee:1%br-mesh"
+                        echo "UPGRADE_PATH=http://[fe80::ff:feee:1%br-mesh]/dev/firmware/current"
+                ) > /etc/community.cfg
+        fi
+
+        if [ $hood == "ufb" ] ; then
+                (
+                        echo "BATMAN_CHANNEL=1"
+                        echo "BATMAN_CHANNEL_5GHZ=36"
+                        echo "ESSID_AP=ufb.freifunk.net"
+                        echo "ESSID_MESH=batman.ufb.freifunk.net"
+                        echo "BSSID_MESH=ca:ff:ee:ba:be:06"
+                        echo "VPN_PROJECT=fff"
+                        echo "NTPD_IP=fe80::ff:feee:1%br-mesh"
+                        echo "UPGRADE_PATH=http://[fe80::ff:feee:1%br-mesh]/dev/firmware/current"
+                ) > /etc/community.cfg
+        fi                                     
+        cp /rom/etc/uci-defaults/60-fff-wireless /etc/uci-defaults/
+	do_reboot=1
+                                                            
+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 style="min-height: 13em;">      
+        <legend>Hoodauswahl</legend>
+                                               
+                                                     
+        <table>                                               
+                <tr><th>Ausgewählte Hood:</th><td><% uci get -q "system. at system[0].hood"  %></td></tr>
+                <tr><th>Hood:</th><td>                     
+                <select name="hood" size="1"> 
+                        <option>legacy</option>               
+                        <option>ufb</option>                                                     
+                        <option>db0fue</option>
+                        <option>fablabnbg</option>
+                </select>
+                </td></tr>   
+		<tr><td>Wähle hier nur eine Hood aus, die auch per Kabel oder WLAN erreichbar ist. Der Router kann keine VPN Verbindung aufbauen, er ist nur als Meshrouter zu verwenden!          
+        </table> 
+                                               
+                                                     
+</fieldset>                                                
+</td>                                                               
+</tr>                                                      
+</table>                                      
+<input type="submit" style="margin-top: 5px; margin-left: 3px;" />
+</form>                                                                                          
+<%in /www/ssl/cgi-bin/footer %>    
+<%                                                         
+# write                                       
+if [ "$do_reboot" == "1" ] ; then                             
+        reboot                                                                                   
+fi                                    
+%>  
+
-- 
2.1.4



Mehr Informationen über die Mailingliste franken-dev