switch from paynym.is to paynym.rs and tor equivalents, update child wallet labels on displaying paynym dialog

This commit is contained in:
Craig Raw 2024-09-30 11:31:55 +02:00
parent 1bbc586cd6
commit e50fe4c68c
3 changed files with 14 additions and 5 deletions

View file

@ -125,7 +125,7 @@ public class PayNymAvatar extends StackPane {
}
try(InputStream is = (proxy == null ? new URI(url).toURL().openStream() : new URI(url).toURL().openConnection(proxy).getInputStream())) {
Image image = new Image(is, 150, 150, true, false);
Image image = new Image(is, 150, 150, true, true);
paymentCodeCache.put(cacheId, image);
Platform.runLater(() -> EventManager.get().post(new PayNymImageLoadedEvent(paymentCode, image)));
return image;

View file

@ -42,7 +42,8 @@ import static com.sparrowwallet.sparrow.wallet.PaymentController.MINIMUM_P2PKH_O
public class PayNymController {
private static final Logger log = LoggerFactory.getLogger(PayNymController.class);
public static final Pattern PAYNYM_REGEX = Pattern.compile("\\+[a-z]+[0-9][0-9a-fA-F][0-9a-fA-F]");
public static final Pattern SAMOURAI_PAYNYM_REGEX = Pattern.compile("\\+[a-z]+[0-9][0-9a-fA-F][0-9a-fA-F]");
public static final Pattern ASHIGARU_PAYNYM_REGEX = Pattern.compile("\\+[a-z]+[0-9][0-9]");
public static final String INVALID_PAYMENT_CODE_LABEL = "Invalid Payment Code";
private String walletId;
@ -127,7 +128,7 @@ public class PayNymController {
} catch(Exception e) {
//ignore
}
} else if(PAYNYM_REGEX.matcher(input).matches()) {
} else if(ASHIGARU_PAYNYM_REGEX.matcher(input).matches()) {
findNymProperty.set(input);
} else {
findNymProperty.set(null);
@ -343,7 +344,12 @@ public class PayNymController {
PaymentCode externalPaymentCode = childWallet.getKeystores().get(0).getExternalPaymentCode();
String walletNymName = PayNym.getNymName(childWallet);
if(payNymMap.get(externalPaymentCode) == null || (walletNymName != null && !walletNymName.equals(payNymMap.get(externalPaymentCode).nymName()))) {
payNymMap.put(externalPaymentCode, PayNym.fromWallet(childWallet));
if(walletNymName != null && payNymMap.get(externalPaymentCode) != null && SAMOURAI_PAYNYM_REGEX.matcher(walletNymName).matches()) {
childWallet.setLabel(payNymMap.get(externalPaymentCode).nymName() + " " + childWallet.getScriptType().getName());
EventManager.get().post(new WalletLabelChangedEvent(childWallet));
} else {
payNymMap.put(externalPaymentCode, PayNym.fromWallet(childWallet));
}
}
}
}

View file

@ -251,6 +251,9 @@ public class PayNymService {
}
public static String getHostUrl(boolean tor) {
return tor ? "http://paynym7bwekdtb2hzgkpl6y2waqcrs2dii7lwincvxme7mdpcpxzfsad.onion" : "https://paynym.is";
//Samourai PayNym server
//return tor ? "http://paynym7bwekdtb2hzgkpl6y2waqcrs2dii7lwincvxme7mdpcpxzfsad.onion" : "https://paynym.is";
//Ashigaru PayNym server
return tor ? "http://paynym25chftmsywv4v2r67agbrr62lcxagsf4tymbzpeeucucy2ivad.onion" : "https://paynym.rs";
}
}