mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-11-05 11:56:37 +00:00
allow server urls to be pasted into the server settings host fields
This commit is contained in:
parent
4d60a20336
commit
686c008e97
1 changed files with 29 additions and 0 deletions
|
|
@ -770,6 +770,20 @@ public class ServerSettingsController extends SettingsDetailController {
|
||||||
existingServer = null;
|
existingServer = null;
|
||||||
}
|
}
|
||||||
coreHost.setLeft(existingServer == null ? null : getGlyph(FontAwesome5.Glyph.TAG, null));
|
coreHost.setLeft(existingServer == null ? null : getGlyph(FontAwesome5.Glyph.TAG, null));
|
||||||
|
|
||||||
|
Protocol protocol = Protocol.getProtocol(newValue);
|
||||||
|
if(existingServer == null && protocol != null) {
|
||||||
|
if(Protocol.getProtocol(oldValue) == null) {
|
||||||
|
HostAndPort hostAndPort = protocol.getServerHostAndPort(newValue);
|
||||||
|
if(!hostAndPort.getHost().isEmpty()) {
|
||||||
|
coreHost.setText(hostAndPort.getHost());
|
||||||
|
corePort.setText(hostAndPort.hasPort() ? String.valueOf(hostAndPort.getPort()) : "");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setCoreServerInConfig(config);
|
setCoreServerInConfig(config);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -809,6 +823,21 @@ public class ServerSettingsController extends SettingsDetailController {
|
||||||
existingServer = null;
|
existingServer = null;
|
||||||
}
|
}
|
||||||
electrumHost.setLeft(existingServer == null ? null : getGlyph(FontAwesome5.Glyph.TAG, null));
|
electrumHost.setLeft(existingServer == null ? null : getGlyph(FontAwesome5.Glyph.TAG, null));
|
||||||
|
|
||||||
|
Protocol protocol = Protocol.getProtocol(newValue);
|
||||||
|
if(existingServer == null && protocol != null) {
|
||||||
|
if(Protocol.getProtocol(oldValue) == null) {
|
||||||
|
HostAndPort hostAndPort = protocol.getServerHostAndPort(newValue);
|
||||||
|
if(!hostAndPort.getHost().isEmpty()) {
|
||||||
|
electrumHost.setText(hostAndPort.getHost());
|
||||||
|
electrumPort.setText(hostAndPort.hasPort() ? String.valueOf(hostAndPort.getPort()) : "");
|
||||||
|
electrumUseSsl.setSelected(protocol == Protocol.SSL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setElectrumServerInConfig(config);
|
setElectrumServerInConfig(config);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue