2011-11-24 11:22:02 +01:00
|
|
|
// ConfigBasic.java
|
2006-03-01 01:14:19 +01:00
|
|
|
// -----------------------
|
|
|
|
// part of YaCy
|
2008-07-20 19:14:51 +02:00
|
|
|
// (C) by Michael Peter Christen; mc@yacy.net
|
2006-03-01 01:14:19 +01:00
|
|
|
// first published on http://www.anomic.de
|
|
|
|
// Frankfurt, Germany, 2006
|
|
|
|
// Created 28.02.2006
|
|
|
|
//
|
2011-12-08 09:44:53 +01:00
|
|
|
// $LastChangedDate: 2011-11-25 12:23:52 +0100 (Fr, 25 Nov 2011) $
|
|
|
|
// $LastChangedRevision: 8101 $
|
|
|
|
// $LastChangedBy: orbiter $
|
2006-03-01 01:14:19 +01:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
|
|
|
// You must compile this file with
|
|
|
|
// javac -classpath .:../classes ConfigBasic_p.java
|
|
|
|
// if the shell's current path is HTROOT
|
|
|
|
|
2009-06-01 02:13:23 +02:00
|
|
|
import java.io.File;
|
2010-12-06 12:09:16 +01:00
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
import java.io.IOException;
|
2006-11-20 21:03:05 +01:00
|
|
|
import java.util.regex.Pattern;
|
2006-03-02 23:25:46 +01:00
|
|
|
|
2010-08-23 14:32:02 +02:00
|
|
|
import net.yacy.cora.protocol.Domains;
|
|
|
|
import net.yacy.cora.protocol.HeaderFramework;
|
|
|
|
import net.yacy.cora.protocol.RequestHeader;
|
2012-09-21 15:48:16 +02:00
|
|
|
import net.yacy.data.WorkTables;
|
2013-10-09 00:40:48 +02:00
|
|
|
import net.yacy.http.YaCyHttpServer;
|
2009-10-11 02:12:19 +02:00
|
|
|
import net.yacy.kelondro.workflow.InstantBusyThread;
|
2011-10-04 11:06:24 +02:00
|
|
|
import net.yacy.peers.Seed;
|
2011-09-25 18:59:06 +02:00
|
|
|
import net.yacy.search.Switchboard;
|
|
|
|
import net.yacy.search.SwitchboardConstants;
|
2012-09-21 15:48:16 +02:00
|
|
|
import net.yacy.server.serverObjects;
|
|
|
|
import net.yacy.server.serverSwitch;
|
|
|
|
import net.yacy.server.http.HTTPDFileHandler;
|
2016-06-03 01:46:30 +02:00
|
|
|
import net.yacy.utils.translation.TranslatorXliff;
|
2014-08-26 22:47:13 +02:00
|
|
|
import net.yacy.utils.upnp.UPnPMappingType;
|
|
|
|
import net.yacy.utils.upnp.UPnP;
|
2006-03-01 01:14:19 +01:00
|
|
|
|
|
|
|
public class ConfigBasic {
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2008-05-15 13:26:43 +02:00
|
|
|
private static final int NEXTSTEP_FINISHED = 0;
|
2008-05-20 15:21:55 +02:00
|
|
|
private static final int NEXTSTEP_PWD = 1;
|
2008-05-15 13:26:43 +02:00
|
|
|
private static final int NEXTSTEP_PEERNAME = 2;
|
|
|
|
private static final int NEXTSTEP_PEERPORT = 3;
|
|
|
|
private static final int NEXTSTEP_RECONNECT = 4;
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2010-12-06 12:09:16 +01:00
|
|
|
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) throws FileNotFoundException, IOException {
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2006-03-01 01:14:19 +01:00
|
|
|
// return variable that accumulates replacements
|
2009-07-19 22:37:44 +02:00
|
|
|
final Switchboard sb = (Switchboard) env;
|
2008-08-02 14:12:04 +02:00
|
|
|
final serverObjects prop = new serverObjects();
|
2011-12-08 10:25:26 +01:00
|
|
|
final File langPath = new File(sb.getAppPath("locale.source", "locales").getAbsolutePath());
|
2007-07-04 12:32:30 +02:00
|
|
|
String lang = env.getConfig("locale.language", "default");
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2008-08-02 14:12:04 +02:00
|
|
|
final int authentication = sb.adminAuthenticated(header);
|
2006-03-01 23:27:20 +01:00
|
|
|
if (authentication < 2) {
|
|
|
|
// must authenticate
|
2012-05-24 13:24:31 +02:00
|
|
|
prop.authenticationRequired();
|
2006-03-01 23:27:20 +01:00
|
|
|
return prop;
|
|
|
|
}
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2010-01-21 23:06:03 +01:00
|
|
|
// store this call as api call
|
|
|
|
if (post != null && post.containsKey("set")) {
|
2010-02-04 12:26:23 +01:00
|
|
|
sb.tables.recordAPICall(post, "ConfigBasic.html", WorkTables.TABLE_API_TYPE_CONFIGURATION, "basic settings");
|
2010-01-21 23:06:03 +01:00
|
|
|
}
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2007-06-26 16:37:10 +02:00
|
|
|
//boolean doPeerPing = false;
|
2009-05-28 16:26:05 +02:00
|
|
|
if ((sb.peers.mySeed().isVirgin()) || (sb.peers.mySeed().isJunior())) {
|
2012-07-05 10:23:07 +02:00
|
|
|
InstantBusyThread.oneTimeJob(sb.yc, "peerPing", 0);
|
2007-06-26 16:37:10 +02:00
|
|
|
//doPeerPing = true;
|
|
|
|
}
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2006-03-02 23:25:46 +01:00
|
|
|
// language settings
|
2010-11-29 21:09:53 +01:00
|
|
|
if (post != null && post.containsKey("language") && !lang.equals(post.get("language", "default")) &&
|
2016-06-03 01:46:30 +02:00
|
|
|
(new TranslatorXliff().changeLang(env, langPath, post.get("language", "default") + ".lng"))) {
|
2010-11-27 01:54:59 +01:00
|
|
|
prop.put("changedLanguage", "1");
|
2006-03-02 23:25:46 +01:00
|
|
|
}
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2006-03-01 01:14:19 +01:00
|
|
|
// peer name settings
|
2012-08-24 21:44:22 +02:00
|
|
|
String peerName = (post == null) ? sb.peers.mySeed().getName() : post.get("peername", "");
|
2012-12-22 20:52:52 +01:00
|
|
|
if (peerName != null && peerName.length() > 0) peerName = peerName.replace(' ', '-');
|
2012-08-24 21:44:22 +02:00
|
|
|
|
2006-03-01 01:14:19 +01:00
|
|
|
// port settings
|
2010-11-27 01:54:59 +01:00
|
|
|
final long port;
|
2013-05-10 13:49:46 +02:00
|
|
|
boolean ssl;
|
2011-03-15 02:03:35 +01:00
|
|
|
if (post != null && post.getInt("port", 0) > 1023) {
|
2011-01-28 11:54:13 +01:00
|
|
|
port = post.getLong("port", 8090);
|
2013-07-31 10:49:26 +02:00
|
|
|
ssl = post.getBoolean("withssl");
|
2010-11-27 01:54:59 +01:00
|
|
|
} else {
|
2015-10-31 23:09:03 +01:00
|
|
|
port = env.getLocalPort(); //this allows a low port, but it will only get one, if the user edits the config himself.
|
2013-05-10 13:49:46 +02:00
|
|
|
ssl = env.getConfigBool("server.https", false);
|
2010-11-27 01:54:59 +01:00
|
|
|
}
|
2013-12-25 05:20:13 +01:00
|
|
|
if (ssl) prop.put("withsslenabled_sslport",env.getHttpServer().getSslPort());
|
|
|
|
|
2006-03-01 01:14:19 +01:00
|
|
|
// check if peer name already exists
|
2011-10-04 11:06:24 +02:00
|
|
|
final Seed oldSeed = sb.peers.lookupByName(peerName);
|
2011-03-20 00:52:09 +01:00
|
|
|
if (oldSeed == null &&
|
|
|
|
!peerName.equals(sb.peers.mySeed().getName()) &&
|
|
|
|
Pattern.compile("[A-Za-z0-9\\-_]{3,80}").matcher(peerName).matches()) {
|
2011-04-04 01:39:45 +02:00
|
|
|
sb.peers.setMyName(peerName);
|
2011-03-20 00:52:09 +01:00
|
|
|
sb.peers.saveMySeed();
|
2006-03-01 01:14:19 +01:00
|
|
|
}
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2009-02-14 14:12:08 +01:00
|
|
|
// UPnP config
|
2010-11-27 01:54:59 +01:00
|
|
|
final boolean upnp;
|
2011-03-15 02:03:35 +01:00
|
|
|
if (post != null && post.containsKey("port")) { // hack to allow checkbox
|
|
|
|
upnp = post.containsKey("enableUpnp");
|
|
|
|
if (upnp && !sb.getConfigBool(SwitchboardConstants.UPNP_ENABLED, false)) {
|
2014-08-26 22:47:13 +02:00
|
|
|
UPnP.addPortMappings();
|
2011-03-15 02:03:35 +01:00
|
|
|
}
|
|
|
|
sb.setConfig(SwitchboardConstants.UPNP_ENABLED, upnp);
|
|
|
|
if (!upnp) {
|
2014-08-26 22:47:13 +02:00
|
|
|
UPnP.deletePortMappings();
|
2011-03-15 02:03:35 +01:00
|
|
|
}
|
2010-11-27 01:54:59 +01:00
|
|
|
} else {
|
|
|
|
upnp = false;
|
2009-02-14 14:12:08 +01:00
|
|
|
}
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2013-05-10 13:49:46 +02:00
|
|
|
// check port and ssl connection
|
2010-11-27 01:54:59 +01:00
|
|
|
final boolean reconnect;
|
2013-05-10 13:49:46 +02:00
|
|
|
if (!(env.getConfigLong("port", port) == port) || env.getConfigBool("server.https", false) != ssl) {
|
2006-03-01 01:14:19 +01:00
|
|
|
// validate port
|
2013-10-09 00:40:48 +02:00
|
|
|
final YaCyHttpServer theServerCore = env.getHttpServer();
|
2006-03-01 01:14:19 +01:00
|
|
|
env.setConfig("port", port);
|
2013-05-10 13:49:46 +02:00
|
|
|
env.setConfig("server.https", ssl);
|
2013-12-25 05:20:13 +01:00
|
|
|
|
2006-05-20 16:05:49 +02:00
|
|
|
// redirect the browser to the new port
|
|
|
|
reconnect = true;
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2009-02-14 14:12:08 +01:00
|
|
|
// renew upnp port mapping
|
2010-11-27 01:54:59 +01:00
|
|
|
if (upnp) {
|
2014-08-26 22:47:13 +02:00
|
|
|
UPnP.addPortMappings();
|
2010-11-27 01:54:59 +01:00
|
|
|
}
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2006-07-02 15:03:01 +02:00
|
|
|
String host = null;
|
2009-07-19 22:37:44 +02:00
|
|
|
if (header.containsKey(HeaderFramework.HOST)) {
|
|
|
|
host = header.get(HeaderFramework.HOST);
|
2011-11-25 12:23:52 +01:00
|
|
|
final int idx = host.indexOf(':',0);
|
2006-07-02 15:03:01 +02:00
|
|
|
if (idx != -1) host = host.substring(0,idx);
|
|
|
|
} else {
|
2009-11-17 00:00:54 +01:00
|
|
|
host = Domains.myPublicLocalIP().getHostAddress();
|
2006-07-02 15:03:01 +02:00
|
|
|
}
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2007-10-24 23:38:19 +02:00
|
|
|
prop.put("reconnect", "1");
|
2006-07-02 15:03:01 +02:00
|
|
|
prop.put("reconnect_host", host);
|
|
|
|
prop.put("nextStep_host", host);
|
2006-05-20 16:05:49 +02:00
|
|
|
prop.put("reconnect_port", port);
|
2007-10-24 23:38:19 +02:00
|
|
|
prop.put("nextStep_port", port);
|
2013-09-12 22:02:11 +02:00
|
|
|
prop.put("reconnect_sslSupport", theServerCore.withSSL() ? "1" : "0");
|
2007-10-24 23:38:19 +02:00
|
|
|
prop.put("nextStep_sslSupport", theServerCore.withSSL() ? "1" : "0");
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2008-06-11 21:04:39 +02:00
|
|
|
// generate new shortcut (used for Windows)
|
2008-07-13 09:55:20 +02:00
|
|
|
//yacyAccessible.setNewPortBat(Integer.parseInt(port));
|
|
|
|
//yacyAccessible.setNewPortLink(Integer.parseInt(port));
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2013-05-10 13:49:46 +02:00
|
|
|
// force reconnection in 5 seconds
|
|
|
|
theServerCore.reconnect(5000);
|
2006-05-20 16:05:49 +02:00
|
|
|
} else {
|
2010-11-27 01:54:59 +01:00
|
|
|
reconnect = false;
|
2007-10-24 23:38:19 +02:00
|
|
|
prop.put("reconnect", "0");
|
2006-03-01 01:14:19 +01:00
|
|
|
}
|
2008-05-20 15:21:55 +02:00
|
|
|
|
|
|
|
// set a use case
|
2009-07-19 22:37:44 +02:00
|
|
|
String networkName = sb.getConfig(SwitchboardConstants.NETWORK_NAME, "");
|
2008-05-20 15:21:55 +02:00
|
|
|
if (post != null && post.containsKey("usecase")) {
|
2010-11-27 01:54:59 +01:00
|
|
|
if ("freeworld".equals(post.get("usecase", "")) && !"freeworld".equals(networkName)) {
|
2008-07-20 23:52:51 +02:00
|
|
|
// switch to freeworld network
|
2014-05-22 12:55:22 +02:00
|
|
|
sb.setConfig(SwitchboardConstants.CORE_SERVICE_RWI, true);
|
2008-07-20 23:52:51 +02:00
|
|
|
sb.switchNetwork("defaults/yacy.network.freeworld.unit");
|
2008-05-23 11:17:30 +02:00
|
|
|
// switch to p2p mode
|
2009-07-19 22:37:44 +02:00
|
|
|
sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW, true);
|
|
|
|
sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, true);
|
2013-11-13 13:38:01 +01:00
|
|
|
sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW_SEARCH, true);
|
2011-11-24 11:22:02 +01:00
|
|
|
// set default behavior for search verification
|
|
|
|
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY, "iffresh"); // nocache,iffresh,ifexist,cacheonly,false
|
|
|
|
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY_DELETE, "true");
|
2008-05-20 15:21:55 +02:00
|
|
|
}
|
2011-03-10 21:04:15 +01:00
|
|
|
if ("portal".equals(post.get("usecase", "")) && !"webportal".equals(networkName)) {
|
2008-07-20 23:52:51 +02:00
|
|
|
// switch to webportal network
|
2014-05-22 12:55:22 +02:00
|
|
|
sb.setConfig(SwitchboardConstants.CORE_SERVICE_RWI, false);
|
2008-07-20 23:52:51 +02:00
|
|
|
sb.switchNetwork("defaults/yacy.network.webportal.unit");
|
2008-05-23 11:17:30 +02:00
|
|
|
// switch to robinson mode
|
2009-07-19 22:37:44 +02:00
|
|
|
sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW, false);
|
|
|
|
sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false);
|
2013-11-13 13:38:01 +01:00
|
|
|
sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW_SEARCH, false);
|
2011-11-24 11:22:02 +01:00
|
|
|
// set default behavior for search verification
|
|
|
|
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY, "ifexist"); // nocache,iffresh,ifexist,cacheonly,false
|
|
|
|
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY_DELETE, "false");
|
2008-05-20 15:21:55 +02:00
|
|
|
}
|
2010-11-27 01:54:59 +01:00
|
|
|
if ("intranet".equals(post.get("usecase", "")) && !"intranet".equals(networkName)) {
|
2008-07-20 23:52:51 +02:00
|
|
|
// switch to intranet network
|
2014-05-22 12:55:22 +02:00
|
|
|
sb.setConfig(SwitchboardConstants.CORE_SERVICE_RWI, false);
|
2008-07-20 23:52:51 +02:00
|
|
|
sb.switchNetwork("defaults/yacy.network.intranet.unit");
|
2008-05-23 11:17:30 +02:00
|
|
|
// switch to p2p mode: enable ad-hoc networks between intranet users
|
2009-07-19 22:37:44 +02:00
|
|
|
sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW, false);
|
|
|
|
sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false);
|
2013-11-13 13:38:01 +01:00
|
|
|
sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW_SEARCH, false);
|
2011-11-24 11:22:02 +01:00
|
|
|
// set default behavior for search verification
|
|
|
|
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY, "cacheonly"); // nocache,iffresh,ifexist,cacheonly,false
|
|
|
|
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY_DELETE, "false");
|
2008-05-20 15:21:55 +02:00
|
|
|
}
|
|
|
|
}
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2009-07-19 22:37:44 +02:00
|
|
|
networkName = sb.getConfig(SwitchboardConstants.NETWORK_NAME, "");
|
2010-11-27 01:54:59 +01:00
|
|
|
if ("freeworld".equals(networkName)) {
|
2008-05-20 15:21:55 +02:00
|
|
|
prop.put("setUseCase", 1);
|
2008-05-23 11:17:30 +02:00
|
|
|
prop.put("setUseCase_freeworldChecked", 1);
|
2010-11-27 01:54:59 +01:00
|
|
|
} else if ("webportal".equals(networkName)) {
|
2008-05-23 11:17:30 +02:00
|
|
|
prop.put("setUseCase", 1);
|
|
|
|
prop.put("setUseCase_portalChecked", 1);
|
2010-11-27 01:54:59 +01:00
|
|
|
} else if ("intranet".equals(networkName)) {
|
2008-05-20 15:21:55 +02:00
|
|
|
prop.put("setUseCase", 1);
|
|
|
|
prop.put("setUseCase_intranetChecked", 1);
|
|
|
|
} else {
|
|
|
|
prop.put("setUseCase", 0);
|
|
|
|
}
|
|
|
|
prop.put("setUseCase_port", port);
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2006-03-01 01:14:19 +01:00
|
|
|
// check if values are proper
|
2014-01-05 04:23:44 +01:00
|
|
|
final boolean properPassword = (sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, "").length() > 0) || sb.getConfigBool(SwitchboardConstants.ADMIN_ACCOUNT_FOR_LOCALHOST, false);
|
2011-10-04 11:06:24 +02:00
|
|
|
final boolean properName = (sb.peers.mySeed().getName().length() >= 3) && (!(Seed.isDefaultPeerName(sb.peers.mySeed().getName())));
|
2009-05-28 16:26:05 +02:00
|
|
|
final boolean properPort = (sb.peers.mySeed().isSenior()) || (sb.peers.mySeed().isPrincipal());
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2012-02-26 20:53:32 +01:00
|
|
|
if ((env.getConfig(SwitchboardConstants.BROWSER_DEFAULT, "").startsWith("ConfigBasic.html,"))) {
|
|
|
|
env.setConfig(SwitchboardConstants.BROWSER_DEFAULT, env.getConfig(SwitchboardConstants.BROWSER_DEFAULT, "").substring(17));
|
2011-03-15 02:03:35 +01:00
|
|
|
env.setConfig("browserPopUpPage", "Status.html");
|
|
|
|
HTTPDFileHandler.initDefaultPath();
|
2006-03-04 19:52:04 +01:00
|
|
|
}
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2007-10-24 23:38:19 +02:00
|
|
|
prop.put("statusName", properName ? "1" : "0");
|
|
|
|
prop.put("statusPort", properPort ? "1" : "0");
|
2006-05-20 16:05:49 +02:00
|
|
|
if (reconnect) {
|
|
|
|
prop.put("nextStep", NEXTSTEP_RECONNECT);
|
|
|
|
} else if (!properName) {
|
|
|
|
prop.put("nextStep", NEXTSTEP_PEERNAME);
|
2008-05-20 15:21:55 +02:00
|
|
|
} else if (!properPassword) {
|
|
|
|
prop.put("nextStep", NEXTSTEP_PWD);
|
2006-05-20 16:05:49 +02:00
|
|
|
} else if (!properPort) {
|
|
|
|
prop.put("nextStep", NEXTSTEP_PEERPORT);
|
2006-03-01 01:14:19 +01:00
|
|
|
} else {
|
2006-05-20 16:05:49 +02:00
|
|
|
prop.put("nextStep", NEXTSTEP_FINISHED);
|
2006-03-01 01:14:19 +01:00
|
|
|
}
|
2011-11-24 11:22:02 +01:00
|
|
|
|
2009-07-19 22:37:44 +02:00
|
|
|
final boolean upnp_enabled = env.getConfigBool(SwitchboardConstants.UPNP_ENABLED, false);
|
2009-02-14 14:12:08 +01:00
|
|
|
prop.put("upnp", "1");
|
2009-03-07 16:31:24 +01:00
|
|
|
prop.put("upnp_enabled", upnp_enabled ? "1" : "0");
|
2010-11-27 01:54:59 +01:00
|
|
|
if (upnp_enabled) {
|
2014-08-26 22:47:13 +02:00
|
|
|
prop.put("upnp_success", (UPnP.getMappedPort(UPnPMappingType.HTTP) > 0) ? "2" : "1");
|
2010-11-27 01:54:59 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
prop.put("upnp_success", "0");
|
|
|
|
}
|
2011-11-24 11:22:02 +01:00
|
|
|
|
|
|
|
// set default values
|
2011-01-28 11:12:17 +01:00
|
|
|
prop.putHTML("defaultName", sb.peers.mySeed().getName());
|
2015-10-31 23:09:03 +01:00
|
|
|
prop.put("defaultPort", env.getLocalPort());
|
2013-05-10 13:49:46 +02:00
|
|
|
prop.put("withsslenabled", env.getConfigBool("server.https", false) ? 1 : 0);
|
2007-07-04 12:32:30 +02:00
|
|
|
lang = env.getConfig("locale.language", "default"); // re-assign lang, may have changed
|
2011-12-18 16:07:21 +01:00
|
|
|
prop.put("lang_de", "0");
|
|
|
|
prop.put("lang_fr", "0");
|
|
|
|
prop.put("lang_cn", "0");
|
|
|
|
prop.put("lang_ru", "0");
|
2012-01-17 17:45:28 +01:00
|
|
|
prop.put("lang_uk", "0");
|
2011-12-18 16:07:21 +01:00
|
|
|
prop.put("lang_en", "0");
|
2016-02-20 23:17:59 +01:00
|
|
|
prop.put("lang_jp", "0");
|
2010-11-27 01:54:59 +01:00
|
|
|
if ("default".equals(lang)) {
|
2011-12-18 16:07:21 +01:00
|
|
|
prop.put("lang_en", "1");
|
2006-03-02 23:25:46 +01:00
|
|
|
} else {
|
2011-12-18 16:07:21 +01:00
|
|
|
prop.put("lang_" + lang, "1");
|
2006-03-02 23:25:46 +01:00
|
|
|
}
|
2006-03-01 01:14:19 +01:00
|
|
|
return prop;
|
|
|
|
}
|
|
|
|
}
|