Skip to content
Snippets Groups Projects
Unverified Commit 31d3f08f authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

treewide: convert all LuCI-based packages to gluon-web

parent e4b74be5
No related branches found
No related tags found
No related merge requests found
Showing
with 291 additions and 44 deletions
--[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2011 Jo-Philipp Wich <xm@subsignal.org>
Copyright 2013 Nils Schneider <nils@nilsschneider.net>
......@@ -10,69 +8,93 @@ you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
local nixio = require "nixio"
local fs = require "nixio.fs"
local util = require "gluon.util"
local f_keys = SimpleForm('keys', translate("SSH keys"), translate("You can provide your SSH keys here (one per line):"))
f_keys.hidden = { submit_keys = '1' }
local keys
keys = f_keys:field(TextValue, "keys", "")
local f_keys = Form(translate("SSH keys"), translate("You can provide your SSH keys here (one per line):"), 'keys')
local s = f_keys:section(Section)
local keys = s:option(TextValue, "keys")
keys.wrap = "off"
keys.rows = 5
keys.rmempty = true
keys.default = fs.readfile("/etc/dropbear/authorized_keys") or ""
function keys.cfgvalue()
return fs.readfile("/etc/dropbear/authorized_keys") or ""
function keys:write(value)
value = util.trim(value:gsub("\r", ""))
if value ~= "" then
fs.writefile("/etc/dropbear/authorized_keys", value .. "\n")
else
fs.remove("/etc/dropbear/authorized_keys")
end
function keys.write(self, section, value)
if not f_keys:formvalue('submit_keys') then return end
fs.writefile("/etc/dropbear/authorized_keys", value:gsub("\r\n", "\n"):trim() .. "\n")
end
function keys.remove(self, section)
if not f_keys:formvalue('submit_keys') then return end
fs.remove("/etc/dropbear/authorized_keys")
end
local f_password = SimpleForm('password', translate("Password"),
local f_password = Form(translate("Password"),
translate(
"Alternatively, you can set a password to access you node. Please choose a secure password you don't use anywhere else.<br /><br />"
.. "If you set an empty password, login via password will be disabled. This is the default."
), 'password'
)
)
f_password.hidden = { submit_password = '1' }
f_password.reset = false
local pw1 = f_password:field(Value, "pw1", translate("Password"))
local s = f_password:section(Section)
local pw1 = s:option(Value, "pw1", translate("Password"))
pw1.password = true
function pw1.cfgvalue()
return ''
end
local pw2 = f_password:field(Value, "pw2", translate("Confirmation"))
local pw2 = s:option(Value, "pw2", translate("Confirmation"))
pw2.password = true
function pw2.cfgvalue()
return ''
end
function f_password:handle(state, data)
if not f_password:formvalue('submit_password') then return end
local function set_password(password)
local inr, inw = nixio.pipe()
local pid = nixio.fork()
if pid < 0 then
return false
elseif pid == 0 then
inw:close()
local null = nixio.open('/dev/null', 'w')
nixio.dup(null, nixio.stderr)
nixio.dup(null, nixio.stdout)
if null:fileno() > 2 then
null:close()
end
nixio.dup(inr, nixio.stdin)
inr:close()
nixio.execp('passwd')
os.exit(127)
end
inr:close()
inw:write(string.format('%s\n%s\n', password, password))
inw:close()
if data.pw1 ~= data.pw2 then
local wpid, status, code = nixio.waitpid(pid)
return wpid and status == 'exited' and code == 0
end
function f_password:write()
if pw1.data ~= pw2.data then
f_password.errmessage = translate("The password and the confirmation differ.")
return
end
if data.pw1 and #data.pw1 > 0 then
if luci.sys.user.setpasswd('root', data.pw1) == 0 then
local pw = pw1.data
if #pw > 0 then
if set_password(pw) then
f_password.message = translate("Password changed.")
else
f_password.errmessage = translate("Unable to change the password.")
......
......@@ -3,7 +3,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-luci-autoupdater
PKG_NAME:=gluon-web-autoupdater
PKG_VERSION:=1
PKG_RELEASE:=1
......@@ -14,11 +14,11 @@ include ../gluon.mk
PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
define Package/gluon-luci-autoupdater
define Package/gluon-web-autoupdater
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Luci module for gluon-autoupdater
DEPENDS:=+gluon-luci-admin +gluon-autoupdater
TITLE:=gluon-web module for gluon-autoupdater
DEPENDS:=+gluon-web-admin +gluon-autoupdater
endef
define Build/Prepare
......@@ -29,13 +29,13 @@ define Build/Configure
endef
define Build/Compile
$(call GluonBuildI18N,gluon-luci-autoupdater,i18n)
$(call GluonBuildI18N,gluon-web-autoupdater,i18n)
$(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
endef
define Package/gluon-luci-autoupdater/install
define Package/gluon-web-autoupdater/install
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
$(call GluonInstallI18N,gluon-luci-autoupdater,$(1))
$(call GluonInstallI18N,gluon-web-autoupdater,$(1))
endef
$(eval $(call BuildPackage,gluon-luci-autoupdater))
$(eval $(call BuildPackage,gluon-web-autoupdater))
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2015-05-04 01:55+0200\n"
"Last-Translator: <mschiffer@universe-factory.net>\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
......@@ -15,3 +15,6 @@ msgstr "Automatische Updates"
msgid "Branch"
msgstr "Branch"
msgid "Enable"
msgstr "Aktivieren"
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2015-08-19 20:20+0100\n"
"Last-Translator: Bernot Tobias <tqbs@airmail.cc>\n"
"Language-Team: French\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
......@@ -15,3 +15,6 @@ msgstr "Mise a jour automatique"
msgid "Branch"
msgstr "Branche"
msgid "Enable"
msgstr "Activer"
......@@ -6,3 +6,6 @@ msgstr ""
msgid "Branch"
msgstr ""
msgid "Enable"
msgstr ""
entry({"admin", "autoupdater"}, model("admin/autoupdater"), _("Automatic updates"), 80)
--[[
LuCI - Lua Configuration Interface
Copyright 2013 Nils Schneider <nils@nilsschneider.net>
Licensed under the Apache License, Version 2.0 (the "License");
......@@ -8,20 +6,20 @@ you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
local uci = require("simple-uci").cursor()
local autoupdater = uci:get_first("autoupdater", "autoupdater")
local f = SimpleForm("autoupdater", translate("Automatic updates"))
local s = f:section(SimpleSection, nil, nil)
local f = Form(translate("Automatic updates"))
local s = f:section(Section)
local o
o = s:option(Flag, "enabled", translate("Enable"))
o.default = uci:get_bool("autoupdater", autoupdater, "enabled") and o.enabled or o.disabled
o.rmempty = false
o.default = uci:get_bool("autoupdater", autoupdater, "enabled")
function o:write(data)
uci:set("autoupdater", autoupdater, "enabled", data)
end
o = s:option(ListValue, "branch", translate("Branch"))
uci:foreach("autoupdater", "branch",
......@@ -30,16 +28,11 @@ uci:foreach("autoupdater", "branch",
end
)
o.default = uci:get("autoupdater", autoupdater, "branch")
function f.handle(self, state, data)
if state ~= FORM_VALID then
return
function o:write(data)
uci:set("autoupdater", autoupdater, "branch", data)
end
uci:set("autoupdater", autoupdater, "enabled", data.enabled)
uci:set("autoupdater", autoupdater, "branch", data.branch)
uci:save("autoupdater")
function f:write()
uci:commit("autoupdater")
end
......
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-luci-mesh-vpn-fastd
PKG_NAME:=gluon-web-mesh-vpn-fastd
PKG_VERSION:=1
PKG_RELEASE:=1
......@@ -11,11 +11,11 @@ include ../gluon.mk
PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
define Package/gluon-luci-mesh-vpn-fastd
define Package/gluon-web-mesh-vpn-fastd
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Luci module to enable and disable encryption for the mesh VPN
DEPENDS:=+gluon-luci-admin +gluon-mesh-vpn-fastd
TITLE:=gluon-web module to enable and disable encryption for the mesh VPN
DEPENDS:=+gluon-web-admin +gluon-mesh-vpn-fastd
endef
define Build/Prepare
......@@ -30,15 +30,15 @@ define Build/Compile
$(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
endef
define Package/gluon-luci-mesh-vpn-fastd/install
define Package/gluon-web-mesh-vpn-fastd/install
$(CP) ./files/* $(1)/
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
$(call GluonInstallI18N,gluon-mesh-vpn-fastd,$(1))
endef
define Package/gluon-luci-mesh-vpn-fastd/postinst
define Package/gluon-web-mesh-vpn-fastd/postinst
#!/bin/sh
$(call GluonCheckSite,check_site.lua)
endef
$(eval $(call BuildPackage,gluon-luci-mesh-vpn-fastd))
$(eval $(call BuildPackage,gluon-web-mesh-vpn-fastd))
<div class="cbi-value">
<div class="cbi-value-title">
<input class="cbi-input-radio" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)" type="radio" value="security"<%= attr("id", cbid..'1') .. attr("name", cbid) .. ifattr((self:cfgvalue(section) or self.default) == "security", "checked", "checked") %> />
<div class="gluon-value">
<div class="gluon-value-title">
<input class="gluon-input-radio" data-update="change" type="radio" value="security"<%= attr("id", id..'1') .. attr("name", id) .. attr("checked", ((self:cfgvalue() or self.default) == "security") and "checked") %> />
</div>
<div class="cbi-value-field-long">
<label<%= attr("for", cbid..'1') %> class="cbi-value-title"><%:Security mode%></label>
<div class="gluon-value-field-long">
<label<%= attr("for", id..'1') %> class="gluon-value-title"><%:Security mode%></label>
<br />
<%= translate(
'In security mode, the mesh VPN uses an encrypted tunnel to connect to the VPN servers. ' ..
......@@ -12,15 +12,15 @@
) %>
<br />
</div>
<div class="cbi-value-field-long-after"></div>
<div class="gluon-value-field-long-after"></div>
</div>
<div class="cbi-value cbi-value-last">
<div class="cbi-value-title">
<input class="cbi-input-radio" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)" type="radio" value="performance"<%= attr("id", cbid..'2') .. attr("name", cbid) .. ifattr((self:cfgvalue(section) or self.default) == "performance", "checked", "checked") %> />
<div class="gluon-value gluon-value-last">
<div class="gluon-value-title">
<input class="gluon-input-radio" data-update="change" type="radio" value="performance"<%= attr("id", id..'2') .. attr("name", id) .. attr("checked", ((self:cfgvalue() or self.default) == "performance") and "checked") %> />
</div>
<div class="cbi-value-field-long">
<label<%= attr("for", cbid..'2') %> class="cbi-value-title"><%:Performance mode%></label>
<div class="gluon-value-field-long">
<label<%= attr("for", id..'2') %> class="gluon-value-title"><%:Performance mode%></label>
<br />
<%= translate(
'In performance mode, no encryption is used. This usually allows for higher throughput, but the data exchanged over your node is not ' ..
......@@ -28,5 +28,5 @@
) %>
<br />
</div>
<div class="cbi-value-field-long-after"></div>
<div class="gluon-value-field-long-after"></div>
</div>
......@@ -15,7 +15,7 @@ msgid ""
"throughput, but the data exchanged over your node is not protected against "
"eavesdropping."
msgstr ""
"Im Modus &bdquo;Hohe Geschwindigkeit&ldquo; wird auf Verschlüsselung "
"Im Modus Hohe Geschwindigkeit wird auf Verschlüsselung "
"verzichtet. Dies erlaubt häufig eine höhere Bandbreite als mit "
"Verschlüsselung, aber die Verbindung ist nicht gegen Abhören geschützt."
......@@ -24,7 +24,7 @@ msgid ""
"VPN servers. The encryption ensures that it is impossible for your internet "
"access provider to see what data is exchanged over your node."
msgstr ""
"Im Modus &bdquo;Hohe Sicherheit&ldquo; wird ein verschlüsselter Tunnel "
"Im Modus Hohe Sicherheit wird ein verschlüsselter Tunnel "
"verwendet. Dies schließt aus, dass dein Internetzugangsprovider herausfinden "
"kann, was für Daten über deinen Knoten übertragen werden."
......
entry({"admin", "mesh_vpn_fastd"}, model("admin/mesh_vpn_fastd"), _("Mesh VPN"), 20)
local uci = require("simple-uci").cursor()
local util = gluon.web.util
local f = Form(translate('Mesh VPN'))
local s = f:section(Section)
local mode = s:option(Value, 'mode')
mode.template = "gluon/model/mesh-vpn-fastd"
local methods = uci:get('fastd', 'mesh_vpn', 'method')
if util.contains(methods, 'null') then
mode.default = 'performance'
else
mode.default = 'security'
end
function mode:write(data)
local site = require 'gluon.site_config'
local methods = {}
if data == 'performance' then
table.insert(methods, 'null')
end
for _, method in ipairs(site.fastd_mesh_vpn.methods) do
if method ~= 'null' then
table.insert(methods, method)
end
end
uci:set('fastd', 'mesh_vpn', 'method', methods)
uci:save('fastd')
uci:commit('fastd')
end
return f
......@@ -3,7 +3,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-luci-portconfig
PKG_NAME:=gluon-web-network
PKG_VERSION:=1
PKG_RELEASE:=1
......@@ -14,11 +14,11 @@ include ../gluon.mk
PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
define Package/gluon-luci-portconfig
define Package/gluon-web-network
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Luci module for advanced ethernet port configuration
DEPENDS:=+gluon-luci-admin +gluon-client-bridge
TITLE:=gluon-web module for network port configuration
DEPENDS:=+gluon-web-admin +gluon-client-bridge
endef
define Build/Prepare
......@@ -29,13 +29,13 @@ define Build/Configure
endef
define Build/Compile
$(call GluonBuildI18N,gluon-luci-portconfig,i18n)
$(call GluonBuildI18N,gluon-web-network,i18n)
$(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
endef
define Package/gluon-luci-portconfig/install
define Package/gluon-web-network/install
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
$(call GluonInstallI18N,gluon-luci-portconfig,$(1))
$(call GluonInstallI18N,gluon-web-network,$(1))
endef
$(eval $(call BuildPackage,gluon-luci-portconfig))
$(eval $(call BuildPackage,gluon-web-network))
......@@ -16,6 +16,9 @@ msgstr "Automatisch (DHCP)"
msgid "Automatic (RA/DHCPv6)"
msgstr "Automatisch (RA/DHCPv6)"
msgid "Disabled"
msgstr "Deaktiviert"
msgid "Enable PoE passthrough"
msgstr "PoE-Passthrough aktivieren"
......@@ -25,6 +28,24 @@ msgstr "Mesh auf dem LAN-Port aktivieren"
msgid "Enable meshing on the WAN interface"
msgstr "Mesh auf dem WAN-Port aktivieren"
msgid "Gateway"
msgstr "Gateway"
msgid "IP address"
msgstr "IP-Adresse"
msgid "IPv4"
msgstr "IPv4"
msgid "IPv6"
msgstr "IPv6"
msgid "Netmask"
msgstr "Netzmaske"
msgid "Network"
msgstr "Netzwerk"
msgid "Static"
msgstr "Statisch"
......
......@@ -16,6 +16,9 @@ msgstr "Automatique (DHCP)"
msgid "Automatic (RA/DHCPv6)"
msgstr "Automatique (RA/DHCPv6)"
msgid "Disabled"
msgstr "Désactivé"
msgid "Enable PoE passthrough"
msgstr ""
......@@ -25,6 +28,24 @@ msgstr "Activer le réseau MESH sur le port LAN"
msgid "Enable meshing on the WAN interface"
msgstr "Activer le réseau MESH sur les ports WAN"
msgid "Gateway"
msgstr "Passerelle"
msgid "IP address"
msgstr "Adresse IP"
msgid "IPv4"
msgstr "IPv4"
msgid "IPv6"
msgstr "IPv6"
msgid "Netmask"
msgstr "Masque de réseau"
msgid "Network"
msgstr "Réseau"
msgid "Static"
msgstr "Statique"
......
......@@ -7,6 +7,9 @@ msgstr ""
msgid "Automatic (RA/DHCPv6)"
msgstr ""
msgid "Disabled"
msgstr ""
msgid "Enable PoE passthrough"
msgstr ""
......@@ -16,6 +19,24 @@ msgstr ""
msgid "Enable meshing on the WAN interface"
msgstr ""
msgid "Gateway"
msgstr ""
msgid "IP address"
msgstr ""
msgid "IPv4"
msgstr ""
msgid "IPv6"
msgstr ""
msgid "Netmask"
msgstr ""
msgid "Network"
msgstr ""
msgid "Static"
msgstr ""
......
entry({"admin", "network"}, model("admin/network"), _("Network"), 20)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment