packages/fff: Add package fff-web-mqtt

With this package the mqtt settings can be configured over the webui.

Each user can use its own mqtt broker or a broker from another user.
This means that the user has a free choice of where to send or get data.

Signed-off-by: Christian Dresel <freifunk@dresel.systems>
Acked-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
Christian Dresel 2020-12-28 19:16:14 +01:00 committed by Fabian Bläse
parent 9090702580
commit a2400a6e67
4 changed files with 60 additions and 0 deletions

View File

@ -18,6 +18,7 @@ define Package/fff-layer3
+fff-mqtt-monitoring \
+fff-network \
+fff-ra \
+fff-web-mqtt \
+fff-wireguard \
+arptables \
+bmon \

View File

@ -0,0 +1,32 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-web-mqtt
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/fff-web-mqtt
SECTION:=base
CATEGORY:=Freifunk
TITLE:=Freifunk-Franken mqtt config webui
URL:=https://www.freifunk-franken.de
DEPENDS:= \
+fff-mqtt \
+fff-web-ui
endef
define Package/fff-web-mqtt/description
Configure mqtt via a web UI
endef
define Build/Compile
# nothing
endef
define Package/fff-web-mqtt/install
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,fff-web-mqtt))

View File

@ -0,0 +1 @@
mqtt,MQTT-Einstellungen

View File

@ -0,0 +1,26 @@
#!/usr/bin/haserl
<%in /www/include/header %>
<%in /www/include/helpers %>
<% show_msg %>
<%
# write
if [ "$REQUEST_METHOD" = "POST" ] ; then
uci -q set "fff.mqtt.server=${POST_server}"
uci commit fff
fi
%>
<form method="post">
<fieldset style="min-height: 7em;" class="smallinput">
<legend>MQTT</legend>
<table>
<tr><th>Server:</th><td><input type="text" name="server" value="<%= $(uci -q get fff.mqtt.server) %>" /></td></tr>
</table>
</fieldset>
<input type="submit" style="margin-top: 5px; margin-left: 3px;" />
</form>
<%in /www/include/footer %>