forked from I2P_Developers/i2p.i2p
Console: Disable browser launch on /configclients when a service
This commit is contained in:
@ -22,6 +22,7 @@ import net.i2p.router.web.PluginStarter;
|
|||||||
import net.i2p.router.web.RouterConsoleRunner;
|
import net.i2p.router.web.RouterConsoleRunner;
|
||||||
import net.i2p.router.web.WebAppStarter;
|
import net.i2p.router.web.WebAppStarter;
|
||||||
import net.i2p.util.Addresses;
|
import net.i2p.util.Addresses;
|
||||||
|
import net.i2p.util.SystemVersion;
|
||||||
|
|
||||||
public class ConfigClientsHelper extends HelperBase {
|
public class ConfigClientsHelper extends HelperBase {
|
||||||
private String _edit;
|
private String _edit;
|
||||||
@ -136,6 +137,7 @@ public class ConfigClientsHelper extends HelperBase {
|
|||||||
ClientAppConfig ca = cac.config;
|
ClientAppConfig ca = cac.config;
|
||||||
int cur = cac.index;
|
int cur = cac.index;
|
||||||
boolean isConsole = ca.className.equals("net.i2p.router.web.RouterConsoleRunner");
|
boolean isConsole = ca.className.equals("net.i2p.router.web.RouterConsoleRunner");
|
||||||
|
boolean isDisabledBrowser = SystemVersion.isService() && ca.className.equals("net.i2p.apps.systray.UrlLauncher");
|
||||||
boolean showStart;
|
boolean showStart;
|
||||||
boolean showStop;
|
boolean showStop;
|
||||||
boolean showEdit;
|
boolean showEdit;
|
||||||
@ -143,6 +145,10 @@ public class ConfigClientsHelper extends HelperBase {
|
|||||||
showStart = false;
|
showStart = false;
|
||||||
showStop = false;
|
showStop = false;
|
||||||
showEdit = true;
|
showEdit = true;
|
||||||
|
} else if (isDisabledBrowser) {
|
||||||
|
showStart = false;
|
||||||
|
showStop = false;
|
||||||
|
showEdit = false;
|
||||||
} else {
|
} else {
|
||||||
ClientApp clientApp = _context.routerAppManager().getClientApp(ca.className, LoadClientAppsJob.parseArgs(ca.args));
|
ClientApp clientApp = _context.routerAppManager().getClientApp(ca.className, LoadClientAppsJob.parseArgs(ca.args));
|
||||||
showStart = clientApp == null;
|
showStart = clientApp == null;
|
||||||
@ -152,11 +158,10 @@ public class ConfigClientsHelper extends HelperBase {
|
|||||||
String scur = Integer.toString(cur);
|
String scur = Integer.toString(cur);
|
||||||
renderForm(buf, scur, ca.clientName,
|
renderForm(buf, scur, ca.clientName,
|
||||||
// urlify, enabled
|
// urlify, enabled
|
||||||
false, !ca.disabled,
|
false, !ca.disabled && !isDisabledBrowser,
|
||||||
// read only, preventDisable
|
// read only, preventDisable
|
||||||
// dangerous, but allow editing the console args too
|
// dangerous, but allow editing the console args too
|
||||||
//"webConsole".equals(ca.clientName) || "Web console".equals(ca.clientName),
|
isDisabledBrowser, isConsole || isDisabledBrowser,
|
||||||
false, RouterConsoleRunner.class.getName().equals(ca.className),
|
|
||||||
// description
|
// description
|
||||||
DataHelper.escapeHTML(ca.className + ((ca.args != null) ? " " + ca.args : "")),
|
DataHelper.escapeHTML(ca.className + ((ca.args != null) ? " " + ca.args : "")),
|
||||||
// edit
|
// edit
|
||||||
@ -234,10 +239,11 @@ public class ConfigClientsHelper extends HelperBase {
|
|||||||
desc = _t("Email");
|
desc = _t("Email");
|
||||||
else
|
else
|
||||||
desc = DataHelper.escapeHTML(app) + ".war";
|
desc = DataHelper.escapeHTML(app) + ".war";
|
||||||
|
boolean isConsole = RouterConsoleRunner.ROUTERCONSOLE.equals(app);
|
||||||
renderForm(buf, app, app,
|
renderForm(buf, app, app,
|
||||||
RouterConsoleRunner.ROUTERCONSOLE.equals(app) || (isRunning && !"addressbook".equals(app)),
|
isConsole || (isRunning && !"addressbook".equals(app)),
|
||||||
"true".equals(val), RouterConsoleRunner.ROUTERCONSOLE.equals(app),
|
"true".equals(val), isConsole,
|
||||||
RouterConsoleRunner.ROUTERCONSOLE.equals(app), desc,
|
isConsole, desc,
|
||||||
false, false, false, isRunning, false, !isRunning);
|
false, false, false, isRunning, false, !isRunning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,9 +377,9 @@ public class ConfigClientsHelper extends HelperBase {
|
|||||||
buf.append("</td><td align=\"center\"><input type=\"checkbox\" class=\"optbox\" id=\"").append(index).append("\" name=\"").append(index).append(".enabled\"");
|
buf.append("</td><td align=\"center\"><input type=\"checkbox\" class=\"optbox\" id=\"").append(index).append("\" name=\"").append(index).append(".enabled\"");
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
buf.append(CHECKED);
|
buf.append(CHECKED);
|
||||||
if (ro || preventDisable)
|
|
||||||
buf.append("disabled=\"disabled\" ");
|
|
||||||
}
|
}
|
||||||
|
if (ro || preventDisable)
|
||||||
|
buf.append("disabled=\"disabled\" ");
|
||||||
buf.append("></td><td align=\"center\">");
|
buf.append("></td><td align=\"center\">");
|
||||||
|
|
||||||
if (showStartButton && (!ro) && !edit) {
|
if (showStartButton && (!ro) && !edit) {
|
||||||
|
Reference in New Issue
Block a user