added checkbox (near port) to switch on ssl support (https access) to

the admin interface.
pull/1/head
Michael Peter Christen 12 years ago
parent e6c8b545c2
commit 7095446ad3

@ -92,7 +92,8 @@
<dl>
<dt><label for="port">Peer Port: </label></dt>
<dd>
<input type="text" name="port" id="port" value="#[defaultPort]#" size="5" maxlength="5" />
<input type="text" name="port" id="port" value="#[defaultPort]#" size="5" maxlength="5" />&nbsp;&nbsp;&nbsp;
<input type="checkbox" name="withssl" id="withssl" #(withsslenabled)#::checked="checked"#(/withsslenabled)#>with SSL (https enabled)
</dd>
#(upnp)#::<dt>
<label for="enableUpnp">Configure your router for YaCy:&nbsp;</label>
@ -124,7 +125,7 @@
<!-- [3]: port not proper -->
<p>You did not open a port in your firewall or your router does not forward the server port to your peer. This is needed if you want to fully participate in the YaCy network. You can also use your peer without opening it, but this is not recomended.</p>::
<!-- [4]: reconnect to different port -->
<p>The peer port was changed successfully. Your browser will be redirected to the new <a href="#(sslSupport)#http::https#(/sslSupport)#://#[host]#:#[port]#/ConfigBasic.html">location</a> in 10 seconds.</p>
<p>The peer port was changed successfully. Your browser will be redirected to the new <a href="#(sslSupport)#http::https#(/sslSupport)#://#[host]#:#[port]#/ConfigBasic.html">location</a> in 5 seconds.</p>
#(/nextStep)#
#%env/templates/footer.template%#
</body>

@ -94,10 +94,13 @@ public class ConfigBasic {
// port settings
final long port;
boolean ssl;
if (post != null && post.getInt("port", 0) > 1023) {
port = post.getLong("port", 8090);
ssl = post.getBoolean("withssl", false);
} else {
port = env.getConfigLong("port", 8090); //this allows a low port, but it will only get one, if the user edits the config himself.
ssl = env.getConfigBool("server.https", false);
}
// check if peer name already exists
@ -124,12 +127,13 @@ public class ConfigBasic {
upnp = false;
}
// check port
// check port and ssl connection
final boolean reconnect;
if (!(env.getConfigLong("port", port) == port)) {
if (!(env.getConfigLong("port", port) == port) || env.getConfigBool("server.https", false) != ssl) {
// validate port
final serverCore theServerCore = (serverCore) env.getThread("10_httpd");
env.setConfig("port", port);
env.setConfig("server.https", ssl);
// redirect the browser to the new port
reconnect = true;
@ -160,8 +164,8 @@ public class ConfigBasic {
//yacyAccessible.setNewPortBat(Integer.parseInt(port));
//yacyAccessible.setNewPortLink(Integer.parseInt(port));
// force reconnection in 7 seconds
theServerCore.reconnect(7000);
// force reconnection in 5 seconds
theServerCore.reconnect(5000);
} else {
reconnect = false;
prop.put("reconnect", "0");
@ -263,6 +267,7 @@ public class ConfigBasic {
// set default values
prop.putHTML("defaultName", sb.peers.mySeed().getName());
prop.putHTML("defaultPort", env.getConfig("port", "8090"));
prop.put("withsslenabled", env.getConfigBool("server.https", false) ? 1 : 0);
lang = env.getConfig("locale.language", "default"); // re-assign lang, may have changed
prop.put("lang_de", "0");
prop.put("lang_fr", "0");

Loading…
Cancel
Save