aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrumeet <17158086+Trumeet@users.noreply.github.com>2021-01-22 15:55:19 -0800
committerTrumeet <17158086+Trumeet@users.noreply.github.com>2021-01-22 15:55:19 -0800
commit70454c8986dfa11b0e84afdd7d9e6c59fe285431 (patch)
tree3d639aff2f7e8ab7a3ed2167c9dfb4c20eeb3dba
parent134eaaad29b0b7459838bd9aeb144093af1f89cb (diff)
downloaddn42peering-70454c8986dfa11b0e84afdd7d9e6c59fe285431.tar
dn42peering-70454c8986dfa11b0e84afdd7d9e6c59fe285431.tar.gz
dn42peering-70454c8986dfa11b0e84afdd7d9e6c59fe285431.tar.bz2
dn42peering-70454c8986dfa11b0e84afdd7d9e6c59fe285431.zip
feat(central): do not show example configuration when the node is down
-rw-r--r--central/src/main/java/moe/yuuta/dn42peering/manage/ManageHandler.java2
-rw-r--r--central/src/main/resources/manage/showconf.ftlh2
2 files changed, 4 insertions, 0 deletions
diff --git a/central/src/main/java/moe/yuuta/dn42peering/manage/ManageHandler.java b/central/src/main/java/moe/yuuta/dn42peering/manage/ManageHandler.java
index 8785a69..001cde8 100644
--- a/central/src/main/java/moe/yuuta/dn42peering/manage/ManageHandler.java
+++ b/central/src/main/java/moe/yuuta/dn42peering/manage/ManageHandler.java
@@ -923,7 +923,9 @@ public class ManageHandler implements ISubRouter {
root.put("ipv6", "This node is currently down! Edit the peer to choose another one.");
root.put("asn", "This node is currently down! Edit the peer to choose another one.");
root.put("endpoint", "This node is currently down! Edit the peer to choose another one.");
+ root.put("show_example_config", false);
} else {
+ root.put("show_example_config", true);
root.put("ipv4", node.getDn42Ip4());
try {
if(peer.isIPv6LinkLocal()) {
diff --git a/central/src/main/resources/manage/showconf.ftlh b/central/src/main/resources/manage/showconf.ftlh
index 659cecc..21be4f4 100644
--- a/central/src/main/resources/manage/showconf.ftlh
+++ b/central/src/main/resources/manage/showconf.ftlh
@@ -16,6 +16,7 @@
<li>WireGuard Preshared Secret: ${wgPresharedSecret}</li>
<li>MP-BGP: ${mpbgp?string('Yes', 'No')}</li>
</ul>
+<#if show_example_config>
<h2>Example Configuration</h2>
<p>Notice: The following configuration is for newcomers or referencing purposes only.
You should always check and modify them according to your environment.
@@ -66,6 +67,7 @@
</pre>
</#if>
<p>Then, enable and start wg-quick service. For systemd users, you may want to use systemctl enable --now wg-quick@<b>&lt;Your WireGuard interface name&gt</b>.</p>
+</#if>
<a href="/manage">Back</a>
</body>
</html> \ No newline at end of file