diff --git a/htroot/ConfigBasic.html b/htroot/ConfigBasic.html index 36f7da4a2..44bd56908 100644 --- a/htroot/ConfigBasic.html +++ b/htroot/ConfigBasic.html @@ -18,6 +18,9 @@ #%env/templates/header.template%# #%env/templates/submenuConfig.template%#

Basic Configuration

+ #(reconnect)#:: +

Your port has changed. Please wait 10 seconds.

+ #(/reconnect)#

Your YaCy Peer needs some basic information to operate properly

diff --git a/htroot/ConfigBasic.java b/htroot/ConfigBasic.java index d82bb4111..a91cc3584 100644 --- a/htroot/ConfigBasic.java +++ b/htroot/ConfigBasic.java @@ -60,6 +60,7 @@ import de.anomic.server.serverInstantBusyThread; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; import de.anomic.yacy.yacySeed; +import de.anomic.yacy.yacyAccessible; public class ConfigBasic { @@ -141,6 +142,10 @@ public class ConfigBasic { prop.put("reconnect_sslSupport", theServerCore.withSSL() ? "1" : "0"); prop.put("nextStep_sslSupport", theServerCore.withSSL() ? "1" : "0"); + // generate new shortcut (used for Windows) + //yacyAccessible.setNewPortLink(Integer.parseInt(port)); + // TODO: Windows doesn't open new location even when new content is written to file (some cache seem to be active) + // force reconnection in 7 seconds theServerCore.reconnect(7000); } else { diff --git a/source/de/anomic/yacy/yacyAccessible.java b/source/de/anomic/yacy/yacyAccessible.java index 74a20c1ad..e566bd73d 100644 --- a/source/de/anomic/yacy/yacyAccessible.java +++ b/source/de/anomic/yacy/yacyAccessible.java @@ -47,7 +47,32 @@ package de.anomic.yacy; +import java.io.File; + +import de.anomic.plasma.plasmaSwitchboard; +import de.anomic.server.serverCore; +import de.anomic.server.serverFileUtils; + public class yacyAccessible { public long lastUpdated; public boolean IWasAccessed; + + /** + * updates Shortcut /addon/YaCy-Search.url + * @param newPort + */ + public static void setNewPortLink(int newPort){ + try { + plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard(); + File shortcut = new File(sb.getRootPath() + "/addon/YaCy-Search.url".replace("/", File.separator)); + // FIXME (doesn't work) try destroying some Windows cache + shortcut.delete(); + String content = + "[InternetShortcut]" + serverCore.LF_STRING + + "URL=http://localhost:" + newPort + "/" + serverCore.LF_STRING; + serverFileUtils.copy(content.getBytes(), shortcut); + } catch (Exception e) { + return; + } + } } diff --git a/startYACY.bat b/startYACY.bat index 164d5c172..fa2668ec0 100644 --- a/startYACY.bat +++ b/startYACY.bat @@ -16,6 +16,7 @@ set jms= set javacmd=-Xmx120m -Xms120m set priolvl=0 set priority=/NORMAL +set port=8080 if exist DATA\SETTINGS\httpProxy.conf GoTo :RENAMEINDEX if exist DATA\SETTINGS\yacy.conf GoTo :GETSTARTOPTS @@ -63,7 +64,6 @@ for /F "tokens=1,2 delims==" %%i in (DATA\SETTINGS\yacy.conf) do ( ) if defined jmx set javacmd=-%jmx% if defined jms set javacmd=-%jms% %javacmd% -if not defined port set port=8080 if defined priolvl ( if %priolvl% == 20 set priority=/LOW if %priolvl% == 10 set priority=/BELOWNORMAL