diff --git a/package/gluon-config-mode-autoupdater/Makefile b/package/gluon-config-mode-autoupdater/Makefile new file mode 100644 index 00000000..00336c28 --- /dev/null +++ b/package/gluon-config-mode-autoupdater/Makefile @@ -0,0 +1,35 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-config-mode-autoupdater +PKG_VERSION:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(GLUONDIR)/include/package.mk + +define Package/gluon-config-mode-autoupdater + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Let the user know whether the autoupdater is enabled or not. + DEPENDS:=+gluon-config-mode-core +gluon-autoupdater +endef + +define Package/gluon-config-mode-autoupdater/description + Luci based config mode +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-config-mode-autoupdater/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-config-mode-autoupdater)) diff --git a/package/gluon-config-mode-autoupdater/files/lib/gluon/config-mode/wizard/0050-autoupdater-info.lua b/package/gluon-config-mode-autoupdater/files/lib/gluon/config-mode/wizard/0050-autoupdater-info.lua new file mode 100644 index 00000000..55cb3407 --- /dev/null +++ b/package/gluon-config-mode-autoupdater/files/lib/gluon/config-mode/wizard/0050-autoupdater-info.lua @@ -0,0 +1,19 @@ +local cbi = require "luci.cbi" +local uci = luci.model.uci.cursor() + +local M = {} + +function M.section(form) + local enabled = uci:get_bool("autoupdater", "settings", "enabled") + if enabled then + local s = form:section(cbi.SimpleSection, nil, + [[Dieser Knoten aktualisiert seine Firmware automatisch, sobald + eine neue Version vorliegt.]]) + end +end + +function M.handle(data) + return +end + +return M diff --git a/package/gluon-config-mode-contact-info/Makefile b/package/gluon-config-mode-contact-info/Makefile new file mode 100644 index 00000000..8d4b74fd --- /dev/null +++ b/package/gluon-config-mode-contact-info/Makefile @@ -0,0 +1,31 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-config-mode-contact-info +PKG_VERSION:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(GLUONDIR)/include/package.mk + +define Package/gluon-config-mode-contact-info + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Set a custom string that will be distributed in the mesh. + DEPENDS:=+gluon-config-mode-core +gluon-node-info +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-config-mode-contact-info/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-config-mode-contact-info)) diff --git a/package/gluon-config-mode-contact-info/files/lib/gluon/config-mode/wizard/0500-contact-info.lua b/package/gluon-config-mode-contact-info/files/lib/gluon/config-mode/wizard/0500-contact-info.lua new file mode 100644 index 00000000..6c070bd9 --- /dev/null +++ b/package/gluon-config-mode-contact-info/files/lib/gluon/config-mode/wizard/0500-contact-info.lua @@ -0,0 +1,31 @@ +local cbi = require "luci.cbi" +local uci = luci.model.uci.cursor() + +local M = {} + +function M.section(form) + local s = form:section(cbi.SimpleSection, nil, + [[Hier kannst du einen öffentlichen Hinweis hinterlegen um + anderen Freifunkern zu ermöglichen Kontakt mit dir aufzunehmen. Bitte + beachte, dass dieser Hinweis auch öffentlich im Internet, zusammen mit + den Koordinaten deines Knotens, einsehbar sein wird.]]) + + local o = s:option(cbi.Value, "_contact", "Kontakt") + o.default = uci:get_first("gluon-node-info", "owner", "contact", "") + o.rmempty = true + o.datatype = "string" + o.description = "z.B. E-Mail oder Telefonnummer" + o.maxlen = 140 +end + +function M.handle(data) + if data._contact ~= nil then + uci:set("gluon-node-info", uci:get_first("gluon-node-info", "owner"), "contact", data._contact) + else + uci:delete("gluon-node-info", uci:get_first("gluon-node-info", "owner"), "contact") + end + uci:save("gluon-node-info") + uci:commit("gluon-node-info") +end + +return M diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode-core/Makefile similarity index 65% rename from package/gluon-config-mode/Makefile rename to package/gluon-config-mode-core/Makefile index 5a11faad..b5b82559 100644 --- a/package/gluon-config-mode/Makefile +++ b/package/gluon-config-mode-core/Makefile @@ -3,22 +3,18 @@ include $(TOPDIR)/rules.mk -PKG_NAME:=gluon-config-mode -PKG_VERSION:=4 +PKG_NAME:=gluon-config-mode-core +PKG_VERSION:=2 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) include $(GLUONDIR)/include/package.mk -define Package/gluon-config-mode +define Package/gluon-config-mode-core SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based config mode for user friendly setup of new mesh nodes - DEPENDS:=+gluon-luci-core +gluon-setup-mode +gluon-lock-password +gluon-node-info +gluon-simple-tc -endef - -define Package/gluon-config-mode/description - Luci based config mode + DEPENDS:=+gluon-luci-core +gluon-setup-mode +gluon-lock-password endef define Build/Prepare @@ -31,13 +27,13 @@ endef define Build/Compile endef -define Package/gluon-config-mode/install +define Package/gluon-config-mode-core/install $(CP) ./files/* $(1)/ endef -define Package/gluon-config-mode/postinst +define Package/gluon-config-mode-core/postinst #!/bin/sh $(call GluonCheckSite,check_site.lua) endef -$(eval $(call BuildPackage,gluon-config-mode)) +$(eval $(call BuildPackage,gluon-config-mode-core)) diff --git a/package/gluon-config-mode/check_site.lua b/package/gluon-config-mode-core/check_site.lua similarity index 66% rename from package/gluon-config-mode/check_site.lua rename to package/gluon-config-mode-core/check_site.lua index 4892ceb3..2ee08b0e 100644 --- a/package/gluon-config-mode/check_site.lua +++ b/package/gluon-config-mode-core/check_site.lua @@ -1,3 +1,2 @@ need_string 'config_mode.msg_welcome' -need_string 'config_mode.msg_pubkey' need_string 'config_mode.msg_reboot' diff --git a/package/gluon-config-mode-core/files/lib/gluon/config-mode/reboot/0900-msg-reboot.lua b/package/gluon-config-mode-core/files/lib/gluon/config-mode/reboot/0900-msg-reboot.lua new file mode 100644 index 00000000..e35bf308 --- /dev/null +++ b/package/gluon-config-mode-core/files/lib/gluon/config-mode/reboot/0900-msg-reboot.lua @@ -0,0 +1,3 @@ +local site = require 'gluon.site_config' + +return function () luci.template.render_string(site.config_mode.msg_reboot) end diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua b/package/gluon-config-mode-core/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua similarity index 74% rename from package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua rename to package/gluon-config-mode-core/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua index 521d8658..8f55f540 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua +++ b/package/gluon-config-mode-core/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua @@ -12,12 +12,6 @@ $Id$ module("luci.controller.gluon-config-mode.index", package.seeall) -local site = require 'gluon.site_config' - - -local meshvpn_name = "mesh_vpn" - - function index() local uci_state = luci.model.uci.cursor_state() @@ -48,24 +42,36 @@ function index() end function action_reboot() - local util = require "luci.util" - local pubkey local uci = luci.model.uci.cursor() - local meshvpn_enabled = uci:get("fastd", meshvpn_name, "enabled", "0") - local sysconfig = require 'gluon.sysconfig' - if meshvpn_enabled == "1" then - pubkey = util.exec("/etc/init.d/fastd show_key " .. meshvpn_name) - end uci:set("gluon-setup-mode", uci:get_first("gluon-setup-mode", "setup_mode"), "configured", "1") uci:save("gluon-setup-mode") uci:commit("gluon-setup-mode") - local hostname = uci:get_first("system", "system", "hostname") - if nixio.fork() ~= 0 then - luci.template.render("gluon-config-mode/reboot", - {luci=luci, pubkey=pubkey, hostname=hostname, site=site, sysconfig=sysconfig}) + local fs = require "luci.fs" + + local parts_dir = "/lib/gluon/config-mode/reboot/" + local files = fs.dir(parts_dir) + + table.sort(files) + + local parts = {} + + for _, entry in ipairs(files) do + if entry:sub(1, 1) ~= '.' then + local f = dofile(parts_dir .. '/' .. entry) + if f ~= nil then + table.insert(parts, f) + end + end + end + + local hostname = uci:get_first("system", "system", "hostname") + + luci.template.render("gluon-config-mode/reboot", { parts=parts + , hostname=hostname + }) else debug.setfenv(io.stdout, debug.getfenv(io.open '/dev/null')) io.stdout:close() diff --git a/package/gluon-config-mode-core/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode-core/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua new file mode 100644 index 00000000..dd6029b4 --- /dev/null +++ b/package/gluon-config-mode-core/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -0,0 +1,38 @@ +local wizard_dir = "/lib/gluon/config-mode/wizard/" +local uci = luci.model.uci.cursor() +local fs = require "luci.fs" +local f, s + +local wizard = {} +local files = fs.dir(wizard_dir) + +table.sort(files) + +for _, entry in ipairs(files) do + if entry:sub(1, 1) ~= '.' then + table.insert(wizard, dofile(wizard_dir .. '/' .. entry)) + end +end + +f = SimpleForm("wizard") +f.reset = false +f.template = "gluon-config-mode/cbi/wizard" +f.submit = "Speichern & Neustarten" + +for _, s in ipairs(wizard) do + s.section(f) +end + +function f.handle(self, state, data) + if state == FORM_VALID then + for _, s in ipairs(wizard) do + s.handle(data) + end + + luci.http.redirect(luci.dispatcher.build_url("gluon-config-mode", "reboot")) + end + + return true +end + +return f diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm b/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm similarity index 100% rename from package/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm rename to package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon-config-mode/cbi/wizard.htm diff --git a/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm b/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm new file mode 100644 index 00000000..dd547f35 --- /dev/null +++ b/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm @@ -0,0 +1,17 @@ + + + + + + <%=hostname%> is rebooting + + + +
+
+

Dein Freifunkknoten ist nun fertig eingerichtet.

+ <% for k, v in ipairs(parts) do v() end %> +
+
+ + diff --git a/package/gluon-config-mode-geo-location/Makefile b/package/gluon-config-mode-geo-location/Makefile new file mode 100644 index 00000000..ba30542a --- /dev/null +++ b/package/gluon-config-mode-geo-location/Makefile @@ -0,0 +1,31 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-config-mode-geo-location +PKG_VERSION:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(GLUONDIR)/include/package.mk + +define Package/gluon-config-mode-geo-location + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Set geographic location of a node + DEPENDS:=+gluon-config-mode-core +gluon-node-info +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-config-mode-geo-location/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-config-mode-geo-location)) diff --git a/package/gluon-config-mode-geo-location/files/lib/gluon/config-mode/wizard/0400-geo-location.lua b/package/gluon-config-mode-geo-location/files/lib/gluon/config-mode/wizard/0400-geo-location.lua new file mode 100644 index 00000000..6afd317c --- /dev/null +++ b/package/gluon-config-mode-geo-location/files/lib/gluon/config-mode/wizard/0400-geo-location.lua @@ -0,0 +1,45 @@ +local cbi = require "luci.cbi" +local uci = luci.model.uci.cursor() + +local M = {} + +function M.section(form) + local s = form:section(cbi.SimpleSection, nil, + [[Um deinen Knoten auf der Karte anzeigen zu können, benötigen + wir seine Koordinaten. Hier hast du die Möglichkeit, diese zu + hinterlegen.]]) + + local o + + o = s:option(cbi.Flag, "_location", "Knoten auf der Karte anzeigen") + o.default = uci:get_first("gluon-node-info", "location", "share_location", o.disabled) + o.rmempty = false + + o = s:option(cbi.Value, "_latitude", "Breitengrad") + o.default = uci:get_first("gluon-node-info", "location", "latitude") + o:depends("_location", "1") + o.rmempty = false + o.datatype = "float" + o.description = "z.B. 53.873621" + + o = s:option(cbi.Value, "_longitude", "Längengrad") + o.default = uci:get_first("gluon-node-info", "location", "longitude") + o:depends("_location", "1") + o.rmempty = false + o.datatype = "float" + o.description = "z.B. 10.689901" +end + +function M.handle(data) + local sname = uci:get_first("gluon-node-info", "location") + + uci:set("gluon-node-info", sname, "share_location", data._location) + if data._location and data._latitude ~= nil and data._longitude ~= nil then + uci:set("gluon-node-info", sname, "latitude", data._latitude) + uci:set("gluon-node-info", sname, "longitude", data._longitude) + end + uci:save("gluon-node-info") + uci:commit("gluon-node-info") +end + +return M diff --git a/package/gluon-config-mode-hostname/Makefile b/package/gluon-config-mode-hostname/Makefile new file mode 100644 index 00000000..f08c1e68 --- /dev/null +++ b/package/gluon-config-mode-hostname/Makefile @@ -0,0 +1,31 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-config-mode-hostname +PKG_VERSION:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(GLUONDIR)/include/package.mk + +define Package/gluon-config-mode-hostname + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Set the hostname + DEPENDS:=+gluon-config-mode-core +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-config-mode-hostname/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-config-mode-hostname)) diff --git a/package/gluon-config-mode-hostname/files/lib/gluon/config-mode/wizard/0100-hostname.lua b/package/gluon-config-mode-hostname/files/lib/gluon/config-mode/wizard/0100-hostname.lua new file mode 100644 index 00000000..a8c041a2 --- /dev/null +++ b/package/gluon-config-mode-hostname/files/lib/gluon/config-mode/wizard/0100-hostname.lua @@ -0,0 +1,20 @@ +local cbi = require "luci.cbi" +local uci = luci.model.uci.cursor() + +local M = {} + +function M.section(form) + local s = form:section(cbi.SimpleSection, nil, nil) + local o = s:option(cbi.Value, "_hostname", "Name dieses Knotens") + o.value = uci:get_first("system", "system", "hostname") + o.rmempty = false + o.datatype = "hostname" +end + +function M.handle(data) + uci:set("system", uci:get_first("system", "system"), "hostname", data._hostname) + uci:save("system") + uci:commit("system") +end + +return M diff --git a/package/gluon-config-mode-mesh-vpn/Makefile b/package/gluon-config-mode-mesh-vpn/Makefile new file mode 100644 index 00000000..a56c9a26 --- /dev/null +++ b/package/gluon-config-mode-mesh-vpn/Makefile @@ -0,0 +1,36 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-config-mode-mesh-vpn +PKG_VERSION:=2 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(GLUONDIR)/include/package.mk + +define Package/gluon-config-mode-mesh-vpn + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Toggle mesh-vpn and bandwidth limit + DEPENDS:=+gluon-config-mode-core +gluon-mesh-vpn-fastd +gluon-simple-tc +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-config-mode-mesh-vpn/install + $(CP) ./files/* $(1)/ +endef + +define Package/gluon-config-mode-mesh-vpn/postinst +#!/bin/sh +$(call GluonCheckSite,check_site.lua) +endef + +$(eval $(call BuildPackage,gluon-config-mode-mesh-vpn)) diff --git a/package/gluon-config-mode-mesh-vpn/check_site.lua b/package/gluon-config-mode-mesh-vpn/check_site.lua new file mode 100644 index 00000000..906f9f22 --- /dev/null +++ b/package/gluon-config-mode-mesh-vpn/check_site.lua @@ -0,0 +1 @@ +need_string 'config_mode.msg_pubkey' diff --git a/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua b/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua new file mode 100644 index 00000000..772d8701 --- /dev/null +++ b/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua @@ -0,0 +1,30 @@ +local msg = [[

+ <%= luci.template.render_string(site.config_mode.msg_pubkey) %> +

+
+ # <%= hostname %> +
+ <%= pubkey %> +
]] + +local uci = luci.model.uci.cursor() +local meshvpn_enabled = uci:get("fastd", "mesh_vpn", "enabled", "0") + +if meshvpn_enabled ~= "1" then + return nil +else + local util = require "luci.util" + local site = require 'gluon.site_config' + local sysconfig = require 'gluon.sysconfig' + + local pubkey = util.exec("/etc/init.d/fastd show_key " .. "mesh_vpn") + local hostname = uci:get_first("system", "system", "hostname") + + return function () + luci.template.render_string(msg, { pubkey=pubkey + , hostname=hostname + , site=site + , sysconfig=sysconfig + }) + end +end diff --git a/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua b/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua new file mode 100644 index 00000000..353cdc77 --- /dev/null +++ b/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua @@ -0,0 +1,63 @@ +local cbi = require "luci.cbi" +local uci = luci.model.uci.cursor() + +local M = {} + +function M.section(form) + local s = form:section(cbi.SimpleSection, nil, + [[Falls du deinen Knoten über das Internet mit Freifunk verbinden + möchtest, kannst du hier das Mesh-VPN aktivieren. Solltest du dich + dafür entscheiden, hast du die Möglichkeit die dafür genutzte + Bandbreite zu beschränken. Lässt du das Mesh-VPN deaktiviert, + verbindet sich dein Knoten nur per WLAN mit anderen Knoten in der + Nähe.]]) + + local o + + o = s:option(cbi.Flag, "_meshvpn", "Mesh-VPN aktivieren") + o.default = uci:get_bool("fastd", "mesh_vpn", "enabled") and o.enabled or o.disabled + o.rmempty = false + + o = s:option(cbi.Flag, "_limit_enabled", "Mesh-VPN Bandbreite begrenzen") + o:depends("_meshvpn", "1") + o.default = uci:get_bool("gluon-simple-tc", "mesh_vpn", "enabled") and o.enabled or o.disabled + o.rmempty = false + + o = s:option(cbi.Value, "_limit_ingress", "Downstream (kbit/s)") + o:depends("_limit_enabled", "1") + o.value = uci:get("gluon-simple-tc", "mesh_vpn", "limit_ingress") + o.rmempty = false + o.datatype = "integer" + + o = s:option(cbi.Value, "_limit_egress", "Upstream (kbit/s)") + o:depends("_limit_enabled", "1") + o.value = uci:get("gluon-simple-tc", "mesh_vpn", "limit_egress") + o.rmempty = false + o.datatype = "integer" +end + +function M.handle(data) + uci:set("fastd", "mesh_vpn", "enabled", data._meshvpn) + uci:save("fastd") + uci:commit("fastd") + + -- checks for nil needed due to o:depends(...) + if data._limit_enabled ~= nil then + uci:set("gluon-simple-tc", "mesh_vpn", "interface") + uci:set("gluon-simple-tc", "mesh_vpn", "enabled", data._limit_enabled) + uci:set("gluon-simple-tc", "mesh_vpn", "ifname", "mesh-vpn") + + if data._limit_ingress ~= nil then + uci:set("gluon-simple-tc", "mesh_vpn", "limit_ingress", data._limit_ingress) + end + + if data._limit_egress ~= nil then + uci:set("gluon-simple-tc", "mesh_vpn", "limit_egress", data._limit_egress) + end + + uci:commit("gluon-simple-tc") + uci:commit("gluon-simple-tc") + end +end + +return M diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua deleted file mode 100644 index 55a00f25..00000000 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ /dev/null @@ -1,136 +0,0 @@ -local meshvpn_name = "mesh_vpn" -local uci = luci.model.uci.cursor() -local f, s, o - -f = SimpleForm("wizard") -f.reset = false -f.template = "gluon-config-mode/cbi/wizard" -f.submit = "Speichern & Neustarten" - -s = f:section(SimpleSection, nil, nil) - -o = s:option(Value, "_hostname", "Name dieses Knotens") -o.value = uci:get_first("system", "system", "hostname") -o.rmempty = false -o.datatype = "hostname" - -o = s:option(Flag, "_autoupdate", "Firmware automatisch aktualisieren") -o.default = uci:get_bool("autoupdater", "settings", "enabled") and o.enabled or o.disabled -o.rmempty = false - -s = f:section(SimpleSection, nil, [[Falls du deinen Knoten über das Internet -mit Freifunk verbinden möchtest, kannst du hier das Mesh-VPN aktivieren. -Solltest du dich dafür entscheiden, hast du die Möglichkeit die dafür -genutzte Bandbreite zu beschränken. Lässt du das Mesh-VPN deaktiviert, -verbindet sich dein Knoten nur per WLAN mit anderen Knoten in der Nähe.]]) - -o = s:option(Flag, "_meshvpn", "Mesh-VPN aktivieren") -o.default = uci:get_bool("fastd", meshvpn_name, "enabled") and o.enabled or o.disabled -o.rmempty = false - -o = s:option(Flag, "_limit_enabled", "Mesh-VPN Bandbreite begrenzen") -o:depends("_meshvpn", "1") -o.default = uci:get_bool("gluon-simple-tc", meshvpn_name, "enabled") and o.enabled or o.disabled -o.rmempty = false - -o = s:option(Value, "_limit_ingress", "Downstream (kbit/s)") -o:depends("_limit_enabled", "1") -o.value = uci:get("gluon-simple-tc", meshvpn_name, "limit_ingress") -o.rmempty = false -o.datatype = "integer" - -o = s:option(Value, "_limit_egress", "Upstream (kbit/s)") -o:depends("_limit_enabled", "1") -o.value = uci:get("gluon-simple-tc", meshvpn_name, "limit_egress") -o.rmempty = false -o.datatype = "integer" - -s = f:section(SimpleSection, nil, [[Um deinen Knoten auf der Karte anzeigen -zu können, benötigen wir seine Koordinaten. Hier hast du die Möglichkeit, -diese zu hinterlegen.]]) - -o = s:option(Flag, "_location", "Knoten auf der Karte anzeigen") -o.default = uci:get_first("gluon-node-info", "location", "share_location", o.disabled) -o.rmempty = false - -o = s:option(Value, "_latitude", "Breitengrad") -o.default = uci:get_first("gluon-node-info", "location", "latitude") -o:depends("_location", "1") -o.rmempty = false -o.datatype = "float" -o.description = "z.B. 53.873621" - -o = s:option(Value, "_longitude", "Längengrad") -o.default = uci:get_first("gluon-node-info", "location", "longitude") -o:depends("_location", "1") -o.rmempty = false -o.datatype = "float" -o.description = "z.B. 10.689901" - -s = f:section(SimpleSection, nil, [[Hier kannst du einen -öffentlichen Hinweis hinterlegen um anderen Freifunkern zu -ermöglichen Kontakt mit dir aufzunehmen. Bitte beachte, dass dieser Hinweis -auch öffentlich im Internet, zusammen mit den Koordinaten deines Knotens, -einsehbar sein wird.]]) - -o = s:option(Value, "_contact", "Kontakt") -o.default = uci:get_first("gluon-node-info", "owner", "contact", "") -o.rmempty = true -o.datatype = "string" -o.description = "z.B. E-Mail oder Telefonnummer" -o.maxlen = 140 - -function f.handle(self, state, data) - if state == FORM_VALID then - local stat = false - - uci:set("autoupdater", "settings", "enabled", data._autoupdate) - uci:save("autoupdater") - uci:commit("autoupdater") - - -- checks for nil needed due to o:depends(...) - if data._limit_enabled ~= nil then - uci:set("gluon-simple-tc", meshvpn_name, "interface") - uci:set("gluon-simple-tc", meshvpn_name, "enabled", data._limit_enabled) - uci:set("gluon-simple-tc", meshvpn_name, "ifname", "mesh-vpn") - - if data._limit_ingress ~= nil then - uci:set("gluon-simple-tc", meshvpn_name, "limit_ingress", data._limit_ingress) - end - - if data._limit_egress ~= nil then - uci:set("gluon-simple-tc", meshvpn_name, "limit_egress", data._limit_egress) - end - - uci:commit("gluon-simple-tc") - end - - uci:set("fastd", meshvpn_name, "enabled", data._meshvpn) - uci:save("fastd") - uci:commit("fastd") - - uci:set("system", uci:get_first("system", "system"), "hostname", data._hostname) - uci:save("system") - uci:commit("system") - - local sname = uci:get_first("gluon-node-info", "location") - uci:set("gluon-node-info", sname, "share_location", data._location) - if data._location and data._latitude ~= nil and data._longitude ~= nil then - uci:set("gluon-node-info", sname, "latitude", data._latitude) - uci:set("gluon-node-info", sname, "longitude", data._longitude) - end - if data._contact ~= nil then - uci:set("gluon-node-info", uci:get_first("gluon-node-info", "owner"), "contact", data._contact) - else - uci:delete("gluon-node-info", uci:get_first("gluon-node-info", "owner"), "contact") - end - uci:save("gluon-node-info") - uci:commit("gluon-node-info") - - luci.http.redirect(luci.dispatcher.build_url("gluon-config-mode", "reboot")) - end - - return true -end - -return f diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm deleted file mode 100644 index db9cbc23..00000000 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/view/gluon-config-mode/reboot.htm +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - <%=hostname%> - <% if title then %><%=title%><% else %><%:Rebooting...%><% end %> - - - -
-
-

Geschafft! Dein Freifunkknoten ist nun fertig eingerichtet.

- <% if pubkey then %> -
-

- <%= luci.template.render_string(site.config_mode.msg_pubkey) %> -

-
- # <%= hostname %> -
- <%= pubkey %> -
-
- <% end %> -
- <%= luci.template.render_string(site.config_mode.msg_reboot) %> -
-
-
- - diff --git a/package/gluon-luci-admin/Makefile b/package/gluon-luci-admin/Makefile index 16dc0cbf..f9ca015a 100644 --- a/package/gluon-luci-admin/Makefile +++ b/package/gluon-luci-admin/Makefile @@ -15,7 +15,7 @@ define Package/gluon-luci-admin SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based simple administration interface for mesh nodes - DEPENDS:=+gluon-luci-core +gluon-config-mode + DEPENDS:=+gluon-luci-core +gluon-config-mode-core endef define Package/gluon-luci-admin/description