Merge branch 'vitorpamplona:main' into profiles-list-management
This commit is contained in:
+1
-1
@@ -176,7 +176,7 @@ class MetadataEvent(
|
||||
|
||||
val tags =
|
||||
latest.tags.builder {
|
||||
alt("User profile for ${currentMetadata.get("name").asText() ?: "Anonymous"}")
|
||||
alt("User profile for ${currentMetadata.get("name")?.asText() ?: "Anonymous"}")
|
||||
|
||||
// For https://github.com/nostr-protocol/nips/pull/1770
|
||||
currentMetadata.get(NameTag.TAG_NAME)?.asText()?.let { name(it) } ?: run { remove(NameTag.TAG_NAME) }
|
||||
|
||||
+5
-2
@@ -93,8 +93,10 @@ class RelayUrlNormalizer {
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun fix(url: String): String? {
|
||||
if (url.length < 3) return null
|
||||
if (url.length > 100) {
|
||||
if (url.length < 4) return null
|
||||
if (url.length > 50) {
|
||||
if (url.indexOf("%00") > -1) return null
|
||||
|
||||
// removes multiple urls in the same line
|
||||
val schemeIdx = url.indexOf("://")
|
||||
val nextScheme = url.indexOf("://", schemeIdx + 3)
|
||||
@@ -184,6 +186,7 @@ class RelayUrlNormalizer {
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
if (e is CancellationException) throw e
|
||||
normalizedUrls.put(url, NormalizationResult.Error)
|
||||
Log.w("NormalizedRelayUrl", "Rejected Error $url")
|
||||
null
|
||||
}
|
||||
|
||||
+2
@@ -89,6 +89,8 @@ class LiveActivitiesEvent(
|
||||
|
||||
fun totalParticipants() = tags.firstNotNullOfOrNull(TotalParticipantsTag::parse)
|
||||
|
||||
fun participantKeys(): List<HexKey> = tags.mapNotNull(ParticipantTag::parseKey)
|
||||
|
||||
fun participants() = tags.mapNotNull(ParticipantTag::parse)
|
||||
|
||||
fun relays() = tags.mapNotNull(RelayListTag::parse)
|
||||
|
||||
Reference in New Issue
Block a user