i2ptunnel: Prevent changing sigtype after dest creation (ticket #2128)

Fix HTML error in editClient
This commit is contained in:
zzz
2018-01-19 12:58:41 +00:00
parent ae505995ac
commit 2f4ea9c588
6 changed files with 37 additions and 16 deletions

View File

@ -504,6 +504,8 @@ public class GeneralHelper {
/**
* @param newTunnelType used if tunnel < 0
* @return the current type if we have a destination already,
* else the default for that type of tunnel
*/
public int getSigType(int tunnel, String newTunnelType) {
SigType type;

View File

@ -23,6 +23,7 @@ import net.i2p.data.Signature;
import net.i2p.data.SigningPrivateKey;
import net.i2p.i2ptunnel.TunnelController;
import net.i2p.i2ptunnel.TunnelControllerGroup;
import net.i2p.i2ptunnel.ui.GeneralHelper;
import net.i2p.util.Addresses;
/**
@ -222,7 +223,16 @@ public class EditBean extends IndexBean {
public boolean isSigTypeAvailable(int code) {
return SigType.isAvailable(code);
}
/** @since 0.9.33 */
public boolean canChangeSigType(int tunnel) {
if (tunnel < 0)
return true;
if (getDestination(tunnel) != null)
return false;
return getTunnelStatus(tunnel) == GeneralHelper.NOT_RUNNING;
}
/**
* Random keys, hidden in forms
* @since 0.9.18