From 663b419cd51cfbbb7da62bc00d07393d28872c57 Mon Sep 17 00:00:00 2001
From: Nils Schneider <nils@nilsschneider.net>
Date: Mon, 30 Sep 2013 00:55:38 +0200
Subject: [PATCH] configmode: read pubkey message from site configuration

---
 package/gluon-config-mode/Makefile            |  1 +
 .../files/etc/config/configmode               |  1 -
 .../luci/controller/configmode/configmode.lua |  3 +-
 .../lib/lua/luci/view/configmode/reboot.htm   | 43 -------------------
 .../lib/lua/luci/view/configmode/reboot.htm   | 43 +++++++++++++++++++
 5 files changed, 45 insertions(+), 46 deletions(-)
 delete mode 100644 package/gluon-config-mode/files/usr/lib/lua/luci/view/configmode/reboot.htm
 create mode 100644 package/gluon-config-mode/generate/usr/lib/lua/luci/view/configmode/reboot.htm

diff --git a/package/gluon-config-mode/Makefile b/package/gluon-config-mode/Makefile
index 370350862..8a081aad7 100644
--- a/package/gluon-config-mode/Makefile
+++ b/package/gluon-config-mode/Makefile
@@ -34,6 +34,7 @@ endef
 
 define Package/gluon-config-mode/install
 	$(CP) ./files/* $(1)/
+	$(GLUON_GENERATE) ./generate/* $(1)/
 endef
 
 $(eval $(call BuildPackage,gluon-config-mode))
diff --git a/package/gluon-config-mode/files/etc/config/configmode b/package/gluon-config-mode/files/etc/config/configmode
index d5e910038..ff348bb87 100644
--- a/package/gluon-config-mode/files/etc/config/configmode
+++ b/package/gluon-config-mode/files/etc/config/configmode
@@ -1,4 +1,3 @@
 config wizard
   option enabled '1'
   option configured '0'
-  option keyaddress '<a href="mailto:keys@luebeck.freifunk.net">keys@luebeck.freifunk.net</a>'
diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua
index 5c12c4934..71a1a60f1 100644
--- a/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua
+++ b/package/gluon-config-mode/files/usr/lib/lua/luci/controller/configmode/configmode.lua
@@ -47,12 +47,11 @@ function action_reboot()
   local configmode = require "luci.tools.configmode"
   local pubkey
   local uci = luci.model.uci.cursor()
-  local address = uci:get_first("configmode", "wizard", "keyaddress")
   local meshvpn_enabled = uci:get("fastd", meshvpn_name, "enabled", "0")
   if meshvpn_enabled == "1" then
     pubkey = configmode.get_fastd_pubkey(meshvpn_name)
   end
-	luci.template.render("configmode/reboot", {pubkey=pubkey, address=address})
+	luci.template.render("configmode/reboot", {pubkey=pubkey})
 
   uci:foreach("configmode", "wizard", function(s)
       uci:set("configmode", s[".name"], "configured", "1")
diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/view/configmode/reboot.htm b/package/gluon-config-mode/files/usr/lib/lua/luci/view/configmode/reboot.htm
deleted file mode 100644
index 4ef5a1d08..000000000
--- a/package/gluon-config-mode/files/usr/lib/lua/luci/view/configmode/reboot.htm
+++ /dev/null
@@ -1,43 +0,0 @@
-<%#
-LuCI - Lua Configuration Interface
-Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-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$
-
--%>
-
-<html>
-	<head>
-		<title><%=luci.sys.hostname()%> - <% if title then %><%=title%><% else %><%:Rebooting...%><% end %></title>
-		<link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/cascade.css" />
-	</head>
-	<body>
-		<div id="maincontainer">
-			<div id="maincontent">
-        <h2>Geschafft! Dein Freifunkknoten ist nun fertig eingerichtet.</h2>
-        <% if pubkey then %>
-				<fieldset class="cbi-section">
-          <p>
-            Dies ist der öffentliche Schlüssel deines Freifunkknotens. Bitte schicke ihn an <%=address%>, um ihn auf den Freifunkservern eintragen zu lassen. Sobald der Schlüssel eingetragen wurde, kann dein Knoten das Mesh-VPN nutzen.
-          </p>
-          <div style="text-align: center;font-size: 2em;line-height: 1em; background: #f5f5f5; border: 1px solid #ececec; margin-bottom: 0.5em; padding: 0.5em">
-            <%=pubkey%>
-          </div>
-				</fieldset>
-        <% end %>
-				<fieldset class="cbi-section">
-					<p>
-						Dein Knoten startet jetzt neu. Anschließend wird er versuchen sich mit anderen Knoten in der Nähe zu verbinden. Wir wünschen dir viel Spaß dabei Freifunk zu erkunden!
-					</p>
-				</fieldset>
-			</div>
-		</div>
-	</body>
-</html>
diff --git a/package/gluon-config-mode/generate/usr/lib/lua/luci/view/configmode/reboot.htm b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/configmode/reboot.htm
new file mode 100644
index 000000000..c60dc9cf1
--- /dev/null
+++ b/package/gluon-config-mode/generate/usr/lib/lua/luci/view/configmode/reboot.htm
@@ -0,0 +1,43 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+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$
+
+-%>
+
+<html>
+  <head>
+    <title><%=luci.sys.hostname()%> - <% if title then %><%=title%><% else %><%:Rebooting...%><% end %></title>
+    <link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/cascade.css" />
+  </head>
+  <body>
+    <div id="maincontainer">
+      <div id="maincontent">
+        <h2>Geschafft! Dein Freifunkknoten ist nun fertig eingerichtet.</h2>
+        <% if pubkey then %>
+        <fieldset class="cbi-section">
+          <p>
+            @configmode.msg_pubkey@
+          </p>
+          <div style="text-align: center;font-size: 2em;line-height: 1em; background: #f5f5f5; border: 1px solid #ececec; margin-bottom: 0.5em; padding: 0.5em">
+            <%=pubkey%>
+          </div>
+        </fieldset>
+        <% end %>
+        <fieldset class="cbi-section">
+          <p>
+            Dein Knoten startet jetzt neu. Anschließend wird er versuchen sich mit anderen Knoten in der Nähe zu verbinden. Wir wünschen dir viel Spaß dabei Freifunk zu erkunden!
+          </p>
+        </fieldset>
+      </div>
+    </div>
+  </body>
+</html>
-- 
GitLab