summaryrefslogtreecommitdiff
path: root/htroot
diff options
context:
space:
mode:
authorBurkhard <11603289+reger24@users.noreply.github.com>2022-02-11 08:09:17 +0100
committerGitHub <noreply@github.com>2022-02-11 08:09:17 +0100
commita6a982818177752cc4dfd7d5ce7470edf078bcdf (patch)
treea57ebdc5509e48f0931ad5262ba0111492be2ec1 /htroot
parent84651f2925270b6885887b1514094122b048bf21 (diff)
parent4219d729c3fde239ad9b283780a8c99f0fa1dc4a (diff)
Merge pull request #440 from lfuelling/master
Add setting for public facing port
Diffstat (limited to 'htroot')
-rw-r--r--htroot/SettingsAck_p.html1
-rw-r--r--htroot/SettingsAck_p.java13
-rw-r--r--htroot/Settings_ServerAccess.inc9
-rw-r--r--htroot/Settings_p.java1
4 files changed, 24 insertions, 0 deletions
diff --git a/htroot/SettingsAck_p.html b/htroot/SettingsAck_p.html
index 9e91137ed..7f26ca30e 100644
--- a/htroot/SettingsAck_p.html
+++ b/htroot/SettingsAck_p.html
@@ -63,6 +63,7 @@
::<!-- 12 -->
<p><strong>The Peer Name is:</strong> <span class="settingsValue">#[peerName]#</span><br />
<strong>Your static Ip(or DynDns) is:</strong> <span class="settingsValue">#[staticIP]#</span>
+ <strong>Your public port is:</strong> <span class="settingsValue">#[publicPort]#</span>
</p>
::<!-- 13 -->
<p><strong>Seed Settings changed.#(success)#::You are now a principal peer.#(/success)#</strong></p>
diff --git a/htroot/SettingsAck_p.java b/htroot/SettingsAck_p.java
index 1ca89cb56..953e506ee 100644
--- a/htroot/SettingsAck_p.java
+++ b/htroot/SettingsAck_p.java
@@ -211,6 +211,19 @@ public class SettingsAck_p {
sb.peers.mySeed().setIP("");
env.setConfig(SwitchboardConstants.SERVER_STATICIP, "");
}
+
+ // publicPort
+ String publicPort = (post.get("publicPort")).trim();
+ try {
+ Integer pport = Integer.parseInt(publicPort);
+ if(pport < 65535 && pport >= 0) {
+ serverCore.usePublicPort = true;
+ sb.peers.mySeed().setPort(pport);
+ env.setConfig(SwitchboardConstants.SERVER_PUBLICPORT, publicPort);
+ }
+ } catch (NumberFormatException e) {
+ // noop
+ }
// server access data
String filter = (post.get("serverfilter")).trim();
diff --git a/htroot/Settings_ServerAccess.inc b/htroot/Settings_ServerAccess.inc
index 314873437..9be7909fa 100644
--- a/htroot/Settings_ServerAccess.inc
+++ b/htroot/Settings_ServerAccess.inc
@@ -31,6 +31,15 @@
you will not be able to access the server pages anymore.</td>
</tr>
<tr valign="top">
+ <td><label for="publicPort">publicPort (optional):</label></td>
+ <td><input name="publicPort" id="publicPort" aria-describedby="publicPortInfo" type="text" size="32" maxlength="80" value="#[publicPort]#" /></td>
+ <td id="publicPortInfo"><strong>The publicPort can help that your peer can be reached by other peers in case that your
+ peer is behind a reverse proxy.</strong>
+ If the port used to access YaCy is the same port the application is listening on,
+ you don't need to set anything here, please leave it blank.<br />
+ </td>
+ </tr>
+ <tr valign="top">
<td><label for="fileHost">fileHost:</label></td>
<td><input name="fileHost" id="fileHost" aria-describedby="fileHostInfo" type="text" size="32" maxlength="80" value="#[fileHost]#" /><br />(requires restart)</td>
<td id="fileHostInfo"><strong>Set this to avoid error-messages like 'proxy use not allowed / granted' on accessing your Peer by its hostname.</strong>
diff --git a/htroot/Settings_p.java b/htroot/Settings_p.java
index 4f66d296c..329843394 100644
--- a/htroot/Settings_p.java
+++ b/htroot/Settings_p.java
@@ -93,6 +93,7 @@ public final class Settings_p {
prop.putHTML("peerName", sb.peers.mySeed().getName());
prop.putHTML("staticIP", env.getConfig("staticIP", ""));
+ prop.putHTML("publicPort", env.getConfig("publicPort",""));
prop.putHTML("fileHost", env.getConfig("fileHost", "localpeer"));
String peerLang = env.getConfig("locale.language", "default");
if (peerLang.equals("default")) peerLang = "en";