mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-03-29 11:11:44 +01:00
Uses NIP-65 preferably for zap requests.
This commit is contained in:
parent
f81c83326c
commit
4a43b57f79
@ -730,8 +730,10 @@ class Account(
|
||||
note.event?.let { event ->
|
||||
LnZapRequestEvent.create(
|
||||
event,
|
||||
userProfile().latestContactList?.relays()?.keys?.ifEmpty { null }
|
||||
?: localRelays.map { it.url }.toSet(),
|
||||
relays =
|
||||
getNIP65RelayList()?.readRelays()?.toSet()
|
||||
?: userProfile().latestContactList?.relays()?.keys?.ifEmpty { null }
|
||||
?: localRelays.map { it.url }.toSet(),
|
||||
signer,
|
||||
pollOption,
|
||||
message,
|
||||
|
@ -54,6 +54,34 @@ class AdvertisedRelayListEvent(
|
||||
}
|
||||
}
|
||||
|
||||
fun readRelays(): List<String>? {
|
||||
return tags.mapNotNull {
|
||||
if (it.size > 1 && it[0] == "r") {
|
||||
when (it.getOrNull(2)) {
|
||||
"read" -> it[1]
|
||||
"write" -> null
|
||||
else -> it[1]
|
||||
}
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}.ifEmpty { null }
|
||||
}
|
||||
|
||||
fun writeRelays(): List<String> {
|
||||
return tags.mapNotNull {
|
||||
if (it.size > 1 && it[0] == "r") {
|
||||
when (it.getOrNull(2)) {
|
||||
"read" -> null
|
||||
"write" -> it[1]
|
||||
else -> it[1]
|
||||
}
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val KIND = 10002
|
||||
const val FIXED_D_TAG = ""
|
||||
|
Loading…
x
Reference in New Issue
Block a user