diff --git a/docs/site-example/i18n/de.po b/docs/site-example/i18n/de.po
index 69cf1dd8..30f5c838 100644
--- a/docs/site-example/i18n/de.po
+++ b/docs/site-example/i18n/de.po
@@ -22,11 +22,11 @@ msgstr ""
"er auf den Servern des Entenhausener Freifunk-Projektes eingetragen wurde, "
"kann sich dein Knoten mit dem Entenhausener Mesh-VPN verbinden. Bitte "
"schicke dazu diesen Schlüssel und den Namen deines Knotens "
-"(<%=hostname%> ) an "
+"(<%=escape(hostname)%> ) an "
"keys@entenhausen.freifunk.net ."
"
"
""
-" # <%= hostname %>"
+" # <%= escape(hostname) %>"
" "
"<%= pubkey %>"
"
"
diff --git a/docs/site-example/i18n/en.po b/docs/site-example/i18n/en.po
index 13273230..e6d1e672 100644
--- a/docs/site-example/i18n/en.po
+++ b/docs/site-example/i18n/en.po
@@ -20,11 +20,11 @@ msgstr ""
"This is your Freifunk node's public key. The node won't be able to "
"connect to the mesh VPN until the key has been registered on the Freifunk "
"Duckburg servers. "
-"To register, send the key together with your node's name (<%=hostname%> ) to "
+"To register, send the key together with your node's name (<%=escape(hostname)%> ) to "
"keys@entenhausen.freifunk.net ."
"
"
""
-" # <%= hostname %>"
+" # <%= escape(hostname) %>"
" "
"<%= pubkey %>"
"
"
diff --git a/docs/site-example/i18n/fr.po b/docs/site-example/i18n/fr.po
index 30e21c50..1462fdbf 100644
--- a/docs/site-example/i18n/fr.po
+++ b/docs/site-example/i18n/fr.po
@@ -22,11 +22,11 @@ msgstr ""
"entrée sur les serveurs de votre groupe de Freifunk votre nœud pourra se connecter "
"sur les serveur Mesh-VPN de votre groupe Freifunk. Veuillez envoyer la clé avec le "
"nom de votre nœud "
-"(<%=hostname%> ) à "
+"(<%=escape(hostname)%> ) à "
"keys@entenhausen.freifunk.net ."
""
""
-" # <%= hostname %>"
+" # <%= escape(hostname) %>"
" "
"<%= pubkey %>"
"
"
diff --git a/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon/cbi/config-mode.htm b/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon/cbi/config-mode.htm
index d2210eca..b4aca92e 100644
--- a/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon/cbi/config-mode.htm
+++ b/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon/cbi/config-mode.htm
@@ -1,4 +1,5 @@
<%-
+ local gluon_luci = require 'gluon.luci'
local sysconfig = require 'gluon.sysconfig'
local i18n = require 'luci.i18n'
local template = require 'luci.template'
@@ -6,7 +7,12 @@
<%:Welcome!%>
- <%= template.render_string(i18n.translate('gluon-config-mode:welcome'), {hostname=hostname, sysconfig=sysconfig}) %>
+ <%= template.render_string(i18n.translate('gluon-config-mode:welcome'), {
+ hostname = hostname,
+ sysconfig = sysconfig,
+ escape = gluon_luci.escape,
+ urlescape = gluon_luci.urlescape,
+ }) %>
<% if not self.embedded then %>
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
index e8f32d99..25ad20bf 100644
--- 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
@@ -3,7 +3,7 @@
- <%=hostname%> is rebooting
+ <%=escape(hostname)%> is rebooting
diff --git a/package/gluon-config-mode-core/luasrc/usr/lib/lua/luci/controller/gluon-config-mode/index.lua b/package/gluon-config-mode-core/luasrc/usr/lib/lua/luci/controller/gluon-config-mode/index.lua
index 68c14746..43c96340 100644
--- a/package/gluon-config-mode-core/luasrc/usr/lib/lua/luci/controller/gluon-config-mode/index.lua
+++ b/package/gluon-config-mode-core/luasrc/usr/lib/lua/luci/controller/gluon-config-mode/index.lua
@@ -48,6 +48,7 @@ function action_reboot()
uci:save("gluon-setup-mode")
uci:commit("gluon-setup-mode")
+ local gluon_luci = require "gluon.luci"
local fs = require "nixio.fs"
local util = require "nixio.util"
@@ -73,6 +74,8 @@ function action_reboot()
{
parts = parts,
hostname = hostname,
+ escape = gluon_luci.escape,
+ urlescape = gluon_luci.urlescape,
}
)
diff --git a/package/gluon-config-mode-mesh-vpn/luasrc/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua b/package/gluon-config-mode-mesh-vpn/luasrc/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua
index c6e06975..da1f6407 100644
--- a/package/gluon-config-mode-mesh-vpn/luasrc/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua
+++ b/package/gluon-config-mode-mesh-vpn/luasrc/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua
@@ -6,6 +6,8 @@ if meshvpn_enabled ~= "1" then
else
local i18n = require "luci.i18n"
local util = require "luci.util"
+
+ local gluon_luci = require 'gluon.luci'
local site = require 'gluon.site_config'
local sysconfig = require 'gluon.sysconfig'
@@ -16,11 +18,14 @@ else
local msg = i18n.translate('gluon-config-mode:pubkey')
return function ()
- luci.template.render_string(msg, { pubkey=pubkey
- , hostname=hostname
- , site=site
- , sysconfig=sysconfig
- , contact=contact
- })
- end
+ luci.template.render_string(msg, {
+ pubkey = pubkey,
+ hostname = hostname,
+ site = site,
+ sysconfig = sysconfig,
+ contact = contact,
+ escape = gluon_luci.escape,
+ urlescape = gluon_luci.urlescape,
+ })
+ end
end
diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/info.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/info.htm
index da403c1b..3fd4fec0 100644
--- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/info.htm
+++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/info.htm
@@ -1,45 +1,46 @@
<%-
- local fs = require 'nixio.fs'
- local uci = require('luci.model.uci').cursor()
- local util = require 'luci.util'
- local i18n = require 'luci.i18n'
+ local fs = require 'nixio.fs'
+ local uci = require('luci.model.uci').cursor()
+ local util = require 'luci.util'
+ local i18n = require 'luci.i18n'
- local site = require 'gluon.site_config'
- local sysconfig = require 'gluon.sysconfig'
- local platform = require 'gluon.platform'
+ local gluon_luci = require "gluon.luci"
+ local site = require 'gluon.site_config'
+ local sysconfig = require 'gluon.sysconfig'
+ local platform = require 'gluon.platform'
- local keys = {
- hostname = i18n.translate('Hostname'),
- primary_mac = i18n.translate('MAC address'),
- model = i18n.translate('Hardware model'),
- version = i18n.translate('Gluon version'),
- release = i18n.translate('Firmware release'),
- site = i18n.translate('Site'),
- pubkey = i18n.translate('Public VPN key'),
- }
+ local keys = {
+ hostname = i18n.translate('Hostname'),
+ primary_mac = i18n.translate('MAC address'),
+ model = i18n.translate('Hardware model'),
+ version = i18n.translate('Gluon version'),
+ release = i18n.translate('Firmware release'),
+ site = i18n.translate('Site'),
+ pubkey = i18n.translate('Public VPN key'),
+ }
- local values = {
- hostname = uci:get_first('system', 'system', 'hostname'),
- primary_mac = sysconfig.primary_mac,
- model = platform.get_model(),
- version = util.trim(fs.readfile('/lib/gluon/gluon-version')),
- release = util.trim(fs.readfile('/lib/gluon/release')),
- site = site.site_name,
- pubkey = 'n/a',
- }
+ local values = {
+ hostname = uci:get_first('system', 'system', 'hostname'),
+ primary_mac = sysconfig.primary_mac,
+ model = platform.get_model(),
+ version = util.trim(fs.readfile('/lib/gluon/gluon-version')),
+ release = util.trim(fs.readfile('/lib/gluon/release')),
+ site = site.site_name,
+ pubkey = 'n/a',
+ }
- local meshvpn_enabled = uci:get("fastd", "mesh_vpn", "enabled", "0")
- if meshvpn_enabled == "1" then
- local pubkey = util.trim(util.exec('/etc/init.d/fastd show_key mesh_vpn'))
- if pubkey ~= '' then
- values.pubkey = pubkey
- end
- end
+ local meshvpn_enabled = uci:get("fastd", "mesh_vpn", "enabled", "0")
+ if meshvpn_enabled == "1" then
+ local pubkey = util.trim(util.exec('/etc/init.d/fastd show_key mesh_vpn'))
+ if pubkey ~= '' then
+ values.pubkey = pubkey
+ end
+ end
-%>
<%:Information%>
<% for _, key in ipairs({'hostname', 'primary_mac', 'model', 'version', 'release', 'site', 'pubkey'}) do %>
-
<%=keys[key]%>
<%=values[key] or 'n/a'%>
+
<%=keys[key]%>
<%=gluon_luci.escape(values[key] or 'n/a')%>
<% end %>