mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-11-05 11:56:37 +00:00
handle scanning and pasting server urls in the electrum format
This commit is contained in:
parent
d426703dcc
commit
5c29bf51b7
1 changed files with 3 additions and 3 deletions
|
|
@ -129,7 +129,7 @@ public enum Protocol {
|
|||
public abstract CloseableTransport getTransport(HostAndPort server, File serverCert, HostAndPort proxy) throws IOException, CertificateException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException;
|
||||
|
||||
public HostAndPort getServerHostAndPort(String url) {
|
||||
String lessProtocol = url.substring(this.toUrlString().length());
|
||||
String lessProtocol = url.endsWith(":t") || url.endsWith(":s") ? url.substring(0, url.length() - 2) : url.substring(this.toUrlString().length());
|
||||
int pathStart = lessProtocol.indexOf('/');
|
||||
return HostAndPort.fromString(pathStart < 0 ? lessProtocol : lessProtocol.substring(0, pathStart));
|
||||
}
|
||||
|
|
@ -178,10 +178,10 @@ public enum Protocol {
|
|||
}
|
||||
|
||||
public static Protocol getProtocol(String url) {
|
||||
if(url.startsWith("tcp://")) {
|
||||
if(url.startsWith("tcp://") || url.endsWith(":t")) {
|
||||
return TCP;
|
||||
}
|
||||
if(url.startsWith("ssl://")) {
|
||||
if(url.startsWith("ssl://") || url.endsWith(":s")) {
|
||||
return SSL;
|
||||
}
|
||||
if(url.startsWith("http://")) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue