mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 08:04:45 +00:00
Merge pull request #3309 from vitorpamplona/claude/remove-alt-tags-events-786j5p
Remove unused NIP-31 alt tag surrogate code and clean up imports
This commit is contained in:
@@ -104,7 +104,6 @@ import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||
import com.vitorpamplona.amethyst.ui.theme.ripple24dp
|
||||
import com.vitorpamplona.amethyst.ui.theme.subtleBorder
|
||||
import com.vitorpamplona.quartz.experimental.zapPolls.ZapPollEvent
|
||||
import com.vitorpamplona.quartz.nip31Alts.AltTag
|
||||
import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -204,7 +203,6 @@ fun ZapZapPollNotePreview2() {
|
||||
arrayOf("poll_option", "1", "Pesquisa em ingles"),
|
||||
arrayOf("value_maximum", "2"),
|
||||
arrayOf("value_minimum", "2"),
|
||||
AltTag.assemble("Poll event"),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
-5
@@ -137,7 +137,6 @@ import com.vitorpamplona.quartz.nip19Bech32.entities.NPub
|
||||
import com.vitorpamplona.quartz.nip19Bech32.entities.NRelay
|
||||
import com.vitorpamplona.quartz.nip19Bech32.entities.NSec
|
||||
import com.vitorpamplona.quartz.nip28PublicChat.base.IsInPublicChatChannel
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip37Drafts.DraftWrapEvent
|
||||
import com.vitorpamplona.quartz.nip47WalletConnect.Nip47WalletConnect
|
||||
import com.vitorpamplona.quartz.nip47WalletConnect.rpc.Response
|
||||
@@ -1761,7 +1760,6 @@ class AccountViewModel(
|
||||
nostrGroupId: String,
|
||||
url: String,
|
||||
imeta: com.vitorpamplona.quartz.nip92IMeta.IMetaTag,
|
||||
caption: String? = null,
|
||||
) {
|
||||
val template =
|
||||
eventTemplate(
|
||||
@@ -1769,9 +1767,6 @@ class AccountViewModel(
|
||||
description = url,
|
||||
) {
|
||||
imeta(imeta)
|
||||
if (!caption.isNullOrEmpty()) {
|
||||
alt(caption)
|
||||
}
|
||||
}
|
||||
// MIP-03: inner events MUST remain unsigned (no `sig`) so a leaked
|
||||
// plaintext can't be replayed as a valid public kind:9. Authorship
|
||||
|
||||
+1
-1
@@ -44,13 +44,13 @@ class MarmotFileSender(
|
||||
dimensions = upload.dimensions,
|
||||
blurhash = upload.blurhash,
|
||||
thumbhash = upload.thumbhash,
|
||||
alt = upload.caption,
|
||||
)
|
||||
|
||||
accountViewModel.sendMarmotGroupMediaMessage(
|
||||
nostrGroupId = nostrGroupId,
|
||||
url = upload.url,
|
||||
imeta = imeta,
|
||||
caption = upload.caption,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+2
-4
@@ -66,10 +66,11 @@ class ChatFileSender(
|
||||
blurhash = result.fileHeader.blurHash?.blurhash,
|
||||
thumbhash = result.fileHeader.thumbHash?.thumbhash,
|
||||
) {
|
||||
// NIP-94 accessibility description of the file (kept; the deprecated
|
||||
// generic NIP-31 boilerplate alt is not written).
|
||||
if (!caption.isNullOrEmpty()) {
|
||||
alt(caption)
|
||||
}
|
||||
|
||||
contentWarningReason?.let { contentWarning(it) }
|
||||
},
|
||||
)
|
||||
@@ -89,9 +90,6 @@ class ChatFileSender(
|
||||
ChatMessageEvent.build(result.url, toUsers) {
|
||||
references(listOf(result.url))
|
||||
|
||||
if (!caption.isNullOrEmpty()) {
|
||||
alt(caption)
|
||||
}
|
||||
contentWarningReason?.let { contentWarning(it) }
|
||||
|
||||
imetas(iMetaAttachments.filterIsIn(setOf(result.url)))
|
||||
|
||||
+4
-8
@@ -216,21 +216,17 @@ class HlsVideoEventBuilderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun horizontalTemplateCarriesAutoGeneratedAltTag() {
|
||||
fun horizontalTemplateOmitsDeprecatedAltTag() {
|
||||
val result = HlsVideoEventBuilder.build(input(landscapeRenditions))
|
||||
val tags = (result.template as HlsVideoEventTemplate.Horizontal).template.tags
|
||||
val alt = tags.findTag("alt")
|
||||
assertNotNull(alt)
|
||||
assertEquals(VideoHorizontalEvent.ALT_DESCRIPTION, alt!![1])
|
||||
assertNull(tags.findTag("alt"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun verticalTemplateCarriesVerticalAltTag() {
|
||||
fun verticalTemplateOmitsDeprecatedAltTag() {
|
||||
val result = HlsVideoEventBuilder.build(input(portraitRenditions))
|
||||
val tags = (result.template as HlsVideoEventTemplate.Vertical).template.tags
|
||||
val alt = tags.findTag("alt")
|
||||
assertNotNull(alt)
|
||||
assertEquals(VideoVerticalEvent.ALT_DESCRIPTION, alt!![1])
|
||||
assertNull(tags.findTag("alt"))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
-2
@@ -23,7 +23,6 @@ package com.vitorpamplona.amethyst.desktop.ui.highlights
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.aTag.ATag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.AltTag
|
||||
import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent
|
||||
import com.vitorpamplona.quartz.nip84Highlights.tags.CommentTag
|
||||
import com.vitorpamplona.quartz.nip84Highlights.tags.ContextTag
|
||||
@@ -39,7 +38,6 @@ object HighlightPublishAction {
|
||||
): HighlightEvent {
|
||||
val tags = mutableListOf<Array<String>>()
|
||||
|
||||
tags.add(AltTag.assemble(HighlightEvent.ALT))
|
||||
tags.add(ATag.assemble(articleAddressTag, null))
|
||||
|
||||
// Tag the article author
|
||||
|
||||
-5
@@ -37,7 +37,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.aTag.ATag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.events.ETag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -85,7 +84,6 @@ class AttestationEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 31871
|
||||
const val ALT_DESCRIPTION = "Attestation"
|
||||
|
||||
fun buildEvent(
|
||||
dTagId: String,
|
||||
@@ -98,7 +96,6 @@ class AttestationEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<AttestationEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, content, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
dTag(dTagId)
|
||||
about(about)
|
||||
status?.let { status(it) }
|
||||
@@ -119,7 +116,6 @@ class AttestationEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<AttestationEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, content, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
dTag(dTagId)
|
||||
aboutReplaceable(about)
|
||||
status?.let { status(it) }
|
||||
@@ -140,7 +136,6 @@ class AttestationEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<AttestationEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, content, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
dTag(dTagId)
|
||||
aboutAddressable(about)
|
||||
status?.let { status(it) }
|
||||
|
||||
-3
@@ -26,7 +26,6 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.Kind
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@@ -48,7 +47,6 @@ class AttestorProficiencyEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 11871
|
||||
const val ALT_DESCRIPTION = "Attestor Proficiency Declaration"
|
||||
|
||||
fun build(
|
||||
kinds: List<Kind>,
|
||||
@@ -56,7 +54,6 @@ class AttestorProficiencyEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<AttestorProficiencyEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, description ?: "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
kinds(kinds)
|
||||
initializer()
|
||||
}
|
||||
|
||||
-3
@@ -27,7 +27,6 @@ import com.vitorpamplona.quartz.nip01Core.core.Kind
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@@ -49,7 +48,6 @@ class AttestorRecommendationEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 31873
|
||||
const val ALT_DESCRIPTION = "Attestor Recommendation"
|
||||
|
||||
fun build(
|
||||
attestorPubKey: HexKey,
|
||||
@@ -58,7 +56,6 @@ class AttestorRecommendationEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<AttestorRecommendationEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, description ?: "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
dTag(attestorPubKey)
|
||||
kinds(kinds)
|
||||
initializer()
|
||||
|
||||
-5
@@ -37,7 +37,6 @@ import com.vitorpamplona.quartz.nip01Core.tags.aTag.ATag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.events.ETag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -82,7 +81,6 @@ class AttestationRequestEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 31872
|
||||
const val ALT_DESCRIPTION = "Attestation Request"
|
||||
|
||||
fun buildEvent(
|
||||
dTagId: String,
|
||||
@@ -93,7 +91,6 @@ class AttestationRequestEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<AttestationRequestEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, content, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
dTag(dTagId)
|
||||
about(about)
|
||||
attestorPubKeys(attestorPubKeys)
|
||||
@@ -110,7 +107,6 @@ class AttestationRequestEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<AttestationRequestEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, content, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
dTag(dTagId)
|
||||
aboutReplaceable(about)
|
||||
attestorPubKeys(attestorPubKeys)
|
||||
@@ -127,7 +123,6 @@ class AttestationRequestEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<AttestationRequestEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, content, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
dTag(dTagId)
|
||||
aboutAddressable(about)
|
||||
attestorPubKeys(attestorPubKeys)
|
||||
|
||||
-3
@@ -28,7 +28,6 @@ import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@@ -52,7 +51,6 @@ class AudioHeaderEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 1808
|
||||
const val ALT = "Audio header"
|
||||
|
||||
fun build(
|
||||
description: String,
|
||||
@@ -62,7 +60,6 @@ class AudioHeaderEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<AudioHeaderEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, description, createdAt) {
|
||||
alt(ALT)
|
||||
downloadUrl.let { downloadUrl(it) }
|
||||
streamUrl?.let { streamUrl(it) }
|
||||
wavefront?.let { wavefront(it) }
|
||||
|
||||
-3
@@ -32,7 +32,6 @@ import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip14Subject.SubjectTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import kotlin.uuid.ExperimentalUuidApi
|
||||
@@ -65,7 +64,6 @@ class AudioTrackEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 31337
|
||||
const val ALT_DESCRIPTION = "Audio track"
|
||||
|
||||
@OptIn(ExperimentalUuidApi::class)
|
||||
fun build(
|
||||
@@ -79,7 +77,6 @@ class AudioTrackEvent(
|
||||
initializer: TagArrayBuilder<AudioTrackEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
dTag(dTag)
|
||||
alt(ALT_DESCRIPTION)
|
||||
|
||||
type(type)
|
||||
media(media)
|
||||
|
||||
-3
@@ -30,7 +30,6 @@ import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent
|
||||
import com.vitorpamplona.quartz.nip10Notes.tags.MarkedETag
|
||||
import com.vitorpamplona.quartz.nip10Notes.tags.markedETag
|
||||
import com.vitorpamplona.quartz.nip10Notes.tags.toMarkedETag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.BigDecimal
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@@ -40,7 +39,6 @@ import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
class BountyAddValueEvent {
|
||||
companion object {
|
||||
const val KIND = 1
|
||||
const val ALT_DESCRIPTION = "Add Value to Bounty"
|
||||
|
||||
const val BOUNTY_HASH_TAG = "bounty-added-reward"
|
||||
|
||||
@@ -54,7 +52,6 @@ class BountyAddValueEvent {
|
||||
tags.markedETag(bountyRoot.toMarkedETag(MarkedETag.MARKER.ROOT))
|
||||
tags.hashtag(BOUNTY_HASH_TAG)
|
||||
tags.pTag(bountyRootAuthor)
|
||||
tags.alt(ALT_DESCRIPTION)
|
||||
return EventTemplate(createdAt, KIND, tags.build(), amount.toString())
|
||||
}
|
||||
}
|
||||
|
||||
-4
@@ -32,7 +32,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.events.ETag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.pTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
/**
|
||||
@@ -87,7 +86,6 @@ class DebitEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 21002
|
||||
const val ALT = "CLINK debit"
|
||||
|
||||
/** Builds a request event (requestor side) addressed to the debit service. */
|
||||
suspend fun createRequest(
|
||||
@@ -101,7 +99,6 @@ class DebitEvent(
|
||||
eventTemplate(KIND, encrypted, createdAt) {
|
||||
pTag(servicePubKey, null)
|
||||
clinkVersion()
|
||||
alt(ALT)
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -120,7 +117,6 @@ class DebitEvent(
|
||||
pTag(requestorPubKey, null)
|
||||
add(ETag.assemble(requestEvent.id, null, null))
|
||||
clinkVersion()
|
||||
alt(ALT)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
-4
@@ -32,7 +32,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.events.ETag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.pTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
/**
|
||||
@@ -87,7 +86,6 @@ class ManageEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 21003
|
||||
const val ALT = "CLINK manage"
|
||||
|
||||
/** Builds a request event (app side) addressed to the wallet server. */
|
||||
suspend fun createRequest(
|
||||
@@ -101,7 +99,6 @@ class ManageEvent(
|
||||
eventTemplate(KIND, encrypted, createdAt) {
|
||||
pTag(serverPubKey, null)
|
||||
clinkVersion()
|
||||
alt(ALT)
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -120,7 +117,6 @@ class ManageEvent(
|
||||
pTag(appPubKey, null)
|
||||
add(ETag.assemble(requestEvent.id, null, null))
|
||||
clinkVersion()
|
||||
alt(ALT)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
-5
@@ -32,7 +32,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.events.ETag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.pTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
/**
|
||||
@@ -91,7 +90,6 @@ class OfferEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 21001
|
||||
const val ALT = "CLINK offer"
|
||||
|
||||
/** Builds a request event (payer side) addressed to the offer service. */
|
||||
suspend fun createRequest(
|
||||
@@ -105,7 +103,6 @@ class OfferEvent(
|
||||
eventTemplate(KIND, encrypted, createdAt) {
|
||||
pTag(servicePubKey, null)
|
||||
clinkVersion()
|
||||
alt(ALT)
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -124,7 +121,6 @@ class OfferEvent(
|
||||
pTag(payerPubKey, null)
|
||||
add(ETag.assemble(requestEvent.id, null, null))
|
||||
clinkVersion()
|
||||
alt(ALT)
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -147,7 +143,6 @@ class OfferEvent(
|
||||
pTag(payerPubKey, null)
|
||||
add(ETag.assemble(requestEvent.id, null, null))
|
||||
clinkVersion()
|
||||
alt(ALT)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
-5
@@ -27,7 +27,6 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventUpdate
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -43,7 +42,6 @@ class EncryptionKeyListEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 10044
|
||||
const val ALT = "Encryption keys"
|
||||
|
||||
fun add(
|
||||
key: KeyTag,
|
||||
@@ -51,7 +49,6 @@ class EncryptionKeyListEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<EncryptionKeyListEvent>.() -> Unit = {},
|
||||
) = eventUpdate(currentEvent, createdAt) {
|
||||
alt(ALT)
|
||||
key(key)
|
||||
initializer()
|
||||
}
|
||||
@@ -62,7 +59,6 @@ class EncryptionKeyListEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<EncryptionKeyListEvent>.() -> Unit = {},
|
||||
) = eventUpdate(currentEvent, createdAt) {
|
||||
alt(ALT)
|
||||
removeIf(KeyTag::isSameKey, key.toTagArray())
|
||||
initializer()
|
||||
}
|
||||
@@ -72,7 +68,6 @@ class EncryptionKeyListEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<EncryptionKeyListEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT)
|
||||
keys(keys)
|
||||
initializer()
|
||||
}
|
||||
|
||||
-4
@@ -25,7 +25,6 @@ import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.events.firstTaggedEvent
|
||||
import com.vitorpamplona.quartz.nip31Alts.AltTag
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -43,7 +42,6 @@ class TextNoteModificationEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 1010
|
||||
const val ALT = "Content Change Event"
|
||||
|
||||
suspend fun create(
|
||||
content: String,
|
||||
@@ -63,8 +61,6 @@ class TextNoteModificationEvent(
|
||||
tags.add(arrayOf("summary", it))
|
||||
}
|
||||
|
||||
tags.add(AltTag.assemble(ALT))
|
||||
|
||||
return signer.sign(createdAt, KIND, tags.toTypedArray(), content)
|
||||
}
|
||||
}
|
||||
|
||||
-3
@@ -28,7 +28,6 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -50,7 +49,6 @@ class EphemeralChatEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 23333
|
||||
const val ALT_DESCRIPTION = "Ephemeral Chat"
|
||||
|
||||
const val DEFAULT_ROOM = "_"
|
||||
|
||||
@@ -63,7 +61,6 @@ class EphemeralChatEvent(
|
||||
) = eventTemplate(KIND, message, createdAt) {
|
||||
room(room)
|
||||
relay(relay)
|
||||
alt(ALT_DESCRIPTION)
|
||||
initializer()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-15
@@ -27,12 +27,9 @@ import com.vitorpamplona.quartz.nip01Core.core.Address
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArray
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.core.fastAny
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.SignerExceptions
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip31Alts.AltTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip51Lists.PrivateTagArrayEvent
|
||||
import com.vitorpamplona.quartz.nip51Lists.encryption.PrivateTagsInContent
|
||||
import com.vitorpamplona.quartz.nip51Lists.removeParsing
|
||||
@@ -53,7 +50,6 @@ class EphemeralChatListEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 10023
|
||||
const val ALT = "Ephemeral Chat List"
|
||||
const val FIXED_D_TAG = ""
|
||||
|
||||
fun createAddress(pubKey: HexKey) = Address(KIND, pubKey, FIXED_D_TAG)
|
||||
@@ -136,16 +132,7 @@ class EphemeralChatListEvent(
|
||||
tags: TagArray,
|
||||
signer: NostrSigner,
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
): EphemeralChatListEvent {
|
||||
val newTags =
|
||||
if (tags.fastAny(AltTag::match)) {
|
||||
tags
|
||||
} else {
|
||||
tags + AltTag.assemble(ALT)
|
||||
}
|
||||
|
||||
return signer.sign(createdAt, KIND, newTags, content)
|
||||
}
|
||||
): EphemeralChatListEvent = signer.sign(createdAt, KIND, tags, content)
|
||||
|
||||
suspend fun create(
|
||||
publicRooms: List<RoomId> = emptyList(),
|
||||
@@ -168,7 +155,6 @@ class EphemeralChatListEvent(
|
||||
description = PrivateTagsInContent.encryptNip44(privateRooms.map { it.toTagArray() }.toTypedArray(), signer),
|
||||
createdAt = createdAt,
|
||||
) {
|
||||
alt(ALT)
|
||||
rooms(publicRooms)
|
||||
|
||||
initializer()
|
||||
|
||||
-3
@@ -27,7 +27,6 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip22Comments.RootScope
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import kotlin.uuid.ExperimentalUuidApi
|
||||
@@ -89,7 +88,6 @@ class WorkoutRecordEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 1301
|
||||
const val ALT_DESCRIPTION = "Workout record"
|
||||
|
||||
@OptIn(ExperimentalUuidApi::class)
|
||||
fun build(
|
||||
@@ -101,7 +99,6 @@ class WorkoutRecordEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<WorkoutRecordEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, notes, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
dTag(workoutId)
|
||||
exercise(exercise)
|
||||
hashtag(exercise.hashtag)
|
||||
|
||||
-4
@@ -35,7 +35,6 @@ import com.vitorpamplona.quartz.nip01Core.tags.aTag.ATag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip23LongContent.tags.ImageTag
|
||||
import com.vitorpamplona.quartz.nip23LongContent.tags.TitleTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip94FileMetadata.tags.SummaryTag
|
||||
import com.vitorpamplona.quartz.nip99Classifieds.tags.StatusTag
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
@@ -63,8 +62,6 @@ class InteractiveStoryReadingStateEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 30298
|
||||
const val ALT1 = "Interactive Story Reading state"
|
||||
const val ALT2 = "The reading state of "
|
||||
|
||||
fun createAddress(
|
||||
pubKey: HexKey,
|
||||
@@ -125,7 +122,6 @@ class InteractiveStoryReadingStateEvent(
|
||||
}
|
||||
|
||||
dTag(rootTag.toTag())
|
||||
alt(root.event.title()?.let { ALT2 + it } ?: ALT1)
|
||||
|
||||
rootScene(rootTag)
|
||||
currentScene(sceneTag)
|
||||
|
||||
-3
@@ -25,7 +25,6 @@ import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -39,14 +38,12 @@ class FhirResourceEvent(
|
||||
) : Event(id, pubKey, createdAt, KIND, tags, content, sig) {
|
||||
companion object {
|
||||
const val KIND = 82
|
||||
const val ALT_DESCRIPTION = "Medical data"
|
||||
|
||||
fun build(
|
||||
fhirPayload: String,
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<FhirResourceEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, fhirPayload, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
initializer()
|
||||
}
|
||||
}
|
||||
|
||||
-4
@@ -39,7 +39,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.aTag.ATag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hashtag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import kotlin.uuid.ExperimentalUuidApi
|
||||
@@ -92,7 +91,6 @@ class MusicPlaylistEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 34139
|
||||
const val ALT_DESCRIPTION_PREFIX = "Playlist"
|
||||
const val CATEGORY_TAG = "playlist"
|
||||
|
||||
@OptIn(ExperimentalUuidApi::class)
|
||||
@@ -111,7 +109,6 @@ class MusicPlaylistEvent(
|
||||
initializer: TagArrayBuilder<MusicPlaylistEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, content, createdAt) {
|
||||
dTag(dTag)
|
||||
alt("$ALT_DESCRIPTION_PREFIX: $title")
|
||||
|
||||
title(title)
|
||||
hashtag(CATEGORY_TAG)
|
||||
@@ -172,7 +169,6 @@ class MusicPlaylistEvent(
|
||||
val newTags =
|
||||
earlierVersion.tags.builder<MusicPlaylistEvent> {
|
||||
title(title)
|
||||
alt("$ALT_DESCRIPTION_PREFIX: $title")
|
||||
setOrRemove(image, ImageTag.TAG_NAME, ::image)
|
||||
setOrRemove(description, DescriptionTag.TAG_NAME, ::description)
|
||||
|
||||
|
||||
-4
@@ -43,7 +43,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.EventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hashtag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import kotlin.uuid.ExperimentalUuidApi
|
||||
@@ -91,7 +90,6 @@ class MusicTrackEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 36787
|
||||
const val ALT_DESCRIPTION_PREFIX = "Music track"
|
||||
const val GENRE_TAG = "music"
|
||||
|
||||
@OptIn(ExperimentalUuidApi::class)
|
||||
@@ -116,7 +114,6 @@ class MusicTrackEvent(
|
||||
initializer: TagArrayBuilder<MusicTrackEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, description, createdAt) {
|
||||
dTag(dTag)
|
||||
alt("$ALT_DESCRIPTION_PREFIX: $title by $artist")
|
||||
|
||||
title(title)
|
||||
artist(artist)
|
||||
@@ -166,7 +163,6 @@ class MusicTrackEvent(
|
||||
title(title)
|
||||
artist(artist)
|
||||
url(url)
|
||||
alt("$ALT_DESCRIPTION_PREFIX: $title by $artist")
|
||||
setOrRemove(image, ImageTag.TAG_NAME, ::image)
|
||||
setOrRemove(album, AlbumTag.TAG_NAME, ::album)
|
||||
if (duration != null) duration(duration) else remove(DurationTag.TAG_NAME)
|
||||
|
||||
-3
@@ -28,7 +28,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.aTag.ATag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.hashtags.HashtagTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@@ -75,7 +74,6 @@ class SoftwareApplicationEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 32267
|
||||
const val ALT_DESCRIPTION = "Software application"
|
||||
|
||||
fun build(
|
||||
appId: String,
|
||||
@@ -85,7 +83,6 @@ class SoftwareApplicationEvent(
|
||||
initializer: TagArrayBuilder<SoftwareApplicationEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, description, createdAt) {
|
||||
dTag(appId)
|
||||
alt(ALT_DESCRIPTION)
|
||||
name(name)
|
||||
initializer()
|
||||
}
|
||||
|
||||
-3
@@ -25,7 +25,6 @@ import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
/**
|
||||
@@ -81,7 +80,6 @@ class SoftwareAssetEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 3063
|
||||
const val ALT_DESCRIPTION = "Software asset"
|
||||
|
||||
fun build(
|
||||
appId: String,
|
||||
@@ -93,7 +91,6 @@ class SoftwareAssetEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<SoftwareAssetEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
appId(appId)
|
||||
mimeType(mimeType)
|
||||
hash(hash)
|
||||
|
||||
-3
@@ -30,7 +30,6 @@ import com.vitorpamplona.quartz.nip01Core.hints.EventHintBundle
|
||||
import com.vitorpamplona.quartz.nip01Core.hints.EventHintProvider
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@@ -77,7 +76,6 @@ class SoftwareReleaseEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 30063
|
||||
const val ALT_DESCRIPTION = "Software release"
|
||||
|
||||
/** NIP-82 requires `d = <app-id>@<version>`. */
|
||||
fun buildDTag(
|
||||
@@ -95,7 +93,6 @@ class SoftwareReleaseEvent(
|
||||
initializer: TagArrayBuilder<SoftwareReleaseEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, releaseNotes, createdAt) {
|
||||
dTag(buildDTag(appId, version))
|
||||
alt(ALT_DESCRIPTION)
|
||||
appId(appId)
|
||||
version(version)
|
||||
channel(channel)
|
||||
|
||||
-3
@@ -26,7 +26,6 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.EventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import kotlin.io.encoding.Base64
|
||||
|
||||
@@ -45,7 +44,6 @@ class FileStorageEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 1064
|
||||
const val ALT = "Binary data"
|
||||
|
||||
fun decode(content: String): ByteArray? = runCatching { Base64.decode(content) }.getOrNull()
|
||||
|
||||
@@ -58,7 +56,6 @@ class FileStorageEvent(
|
||||
initializer: TagArrayBuilder<FileStorageEvent>.() -> Unit = {},
|
||||
): EventTemplate<FileStorageEvent> =
|
||||
eventTemplate(KIND, encode(data), createdAt) {
|
||||
alt(ALT)
|
||||
mimeType?.let { mimeType(it) }
|
||||
initializer()
|
||||
}
|
||||
|
||||
-3
@@ -31,7 +31,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.events.ETag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.events.eTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.events.toETag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.nip94FileMetadata.tags.BlurhashTag
|
||||
import com.vitorpamplona.quartz.nip94FileMetadata.tags.DimensionTag
|
||||
@@ -98,7 +97,6 @@ class FileStorageHeaderEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 1065
|
||||
const val ALT_DESCRIPTION = "Descriptors for a binary file"
|
||||
|
||||
fun build(
|
||||
storageEvent: EventHintBundle<FileStorageEvent>,
|
||||
@@ -107,7 +105,6 @@ class FileStorageHeaderEvent(
|
||||
initializer: TagArrayBuilder<FileStorageHeaderEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, caption ?: "", createdAt) {
|
||||
eTag(storageEvent.toETag())
|
||||
caption?.ifBlank { null }?.let { alt(caption) } ?: alt(ALT_DESCRIPTION)
|
||||
initializer()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-4
@@ -24,7 +24,6 @@ import com.vitorpamplona.quartz.nip01Core.core.Address
|
||||
import com.vitorpamplona.quartz.nip01Core.core.BaseReplaceableEvent
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner
|
||||
import com.vitorpamplona.quartz.nip31Alts.AltTag
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
class PaymentTargetsEvent(
|
||||
@@ -39,7 +38,6 @@ class PaymentTargetsEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 10133
|
||||
const val ALT = "Payment targets"
|
||||
const val FIXED_D_TAG = ""
|
||||
|
||||
fun createAddress(pubKey: HexKey): Address = Address(KIND, pubKey, FIXED_D_TAG)
|
||||
@@ -54,13 +52,12 @@ class PaymentTargetsEvent(
|
||||
earlierVersion.tags
|
||||
.filter(PaymentTargetTag::notMatch)
|
||||
.plus(targets.map { PaymentTargetTag.assemble(it) })
|
||||
.plusElement(AltTag.assemble(ALT))
|
||||
.toTypedArray()
|
||||
|
||||
return signer.sign(createdAt, KIND, tags, earlierVersion.content)
|
||||
}
|
||||
|
||||
fun createPaymentTargets(targets: List<PaymentTarget>) = (targets.map { PaymentTargetTag.assemble(it) } + listOf(AltTag.assemble(ALT))).toTypedArray()
|
||||
fun createPaymentTargets(targets: List<PaymentTarget>) = targets.map { PaymentTargetTag.assemble(it) }.toTypedArray()
|
||||
|
||||
suspend fun create(
|
||||
targets: List<PaymentTarget>,
|
||||
|
||||
-2
@@ -45,7 +45,6 @@ import com.vitorpamplona.quartz.nip19Bech32.eventHints
|
||||
import com.vitorpamplona.quartz.nip19Bech32.eventIds
|
||||
import com.vitorpamplona.quartz.nip22Comments.RootScope
|
||||
import com.vitorpamplona.quartz.nip23LongContent.tags.TitleTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import kotlin.uuid.ExperimentalUuidApi
|
||||
@@ -139,7 +138,6 @@ class NipTextEvent(
|
||||
initializer: TagArrayBuilder<NipTextEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, description, createdAt) {
|
||||
dTag(dTag)
|
||||
alt("NIP: $title")
|
||||
|
||||
title(title)
|
||||
kinds(kinds)
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.vitorpamplona.quartz.nip01Core.core.BaseAddressableEvent
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -48,13 +47,11 @@ class NNSEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 30053
|
||||
const val ALT = "DNS records"
|
||||
|
||||
fun build(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<NNSEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT)
|
||||
initializer()
|
||||
}
|
||||
|
||||
@@ -63,7 +60,6 @@ class NNSEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<NNSEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT)
|
||||
ipv4(ipv4)
|
||||
initializer()
|
||||
}
|
||||
|
||||
-3
@@ -33,7 +33,6 @@ import com.vitorpamplona.quartz.nip01Core.tags.events.ETag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.kinds.kind
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.toPTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import kotlinx.serialization.json.JsonNull.content
|
||||
|
||||
@@ -80,7 +79,6 @@ class WakeUpEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 23903
|
||||
const val ALT_DESCRIPTION = "WakeUp"
|
||||
|
||||
// p-tags on a WakeUp identify the AUTHORS of the referenced events —
|
||||
// the people whose events are the subject of the wake-up and who should
|
||||
@@ -91,7 +89,6 @@ class WakeUpEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<WakeUpEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, content, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
about(about)
|
||||
notify(about.toPTag())
|
||||
kind(about.event.kind)
|
||||
|
||||
+1
-12
@@ -24,7 +24,6 @@ import androidx.compose.runtime.Immutable
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.aTag.ATag
|
||||
import com.vitorpamplona.quartz.nip31Alts.AltTag
|
||||
import com.vitorpamplona.quartz.nip51Lists.PrivateTagArrayEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@@ -41,7 +40,6 @@ class GalleryListEvent(
|
||||
@Suppress("DEPRECATION")
|
||||
companion object {
|
||||
const val KIND = 10011
|
||||
const val ALT = "Profile Gallery"
|
||||
const val GALLERY_TAG_NAME = "url"
|
||||
|
||||
suspend fun addEvent(
|
||||
@@ -127,16 +125,7 @@ class GalleryListEvent(
|
||||
tags: Array<Array<String>>,
|
||||
signer: NostrSigner,
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
): GalleryListEvent {
|
||||
val newTags =
|
||||
if (tags.any { it.size > 1 && it[0] == "alt" }) {
|
||||
tags
|
||||
} else {
|
||||
tags + AltTag.assemble(ALT)
|
||||
}
|
||||
|
||||
return signer.sign(createdAt, KIND, newTags, content)
|
||||
}
|
||||
): GalleryListEvent = signer.sign(createdAt, KIND, tags, content)
|
||||
}
|
||||
|
||||
@Immutable
|
||||
|
||||
-3
@@ -27,7 +27,6 @@ import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.core.any
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.events.ETag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.nip94FileMetadata.tags.BlurhashTag
|
||||
import com.vitorpamplona.quartz.nip94FileMetadata.tags.DimensionTag
|
||||
@@ -99,7 +98,6 @@ class ProfileGalleryEntryEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 1163
|
||||
const val ALT_DESCRIPTION = "Profile Gallery Entry"
|
||||
|
||||
fun build(
|
||||
url: String,
|
||||
@@ -107,7 +105,6 @@ class ProfileGalleryEntryEvent(
|
||||
initializer: TagArrayBuilder<ProfileGalleryEntryEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
url(url)
|
||||
alt(ALT_DESCRIPTION)
|
||||
initializer()
|
||||
}
|
||||
}
|
||||
|
||||
-10
@@ -36,7 +36,6 @@ import com.vitorpamplona.quartz.nip01Core.hints.EventHintProvider
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.geohash.geohashes
|
||||
import com.vitorpamplona.quartz.nip31Alts.AltTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip40Expiration.expiration
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@@ -90,14 +89,6 @@ class RoadEventConfirmationEvent(
|
||||
companion object {
|
||||
const val KIND = 1316
|
||||
|
||||
/** NIP-31 fallback for a confirmation (`still_there`), per the roadstr spec. */
|
||||
const val ALT_CONFIRMED = "Roadstr: event confirmed"
|
||||
|
||||
/** NIP-31 fallback for a denial (`no_longer_there`), per the roadstr spec. */
|
||||
const val ALT_DENIED = "Roadstr: event denied"
|
||||
|
||||
fun altDescription(status: RoadEventStatus) = if (status == RoadEventStatus.NO_LONGER_THERE) ALT_DENIED else ALT_CONFIRMED
|
||||
|
||||
fun build(
|
||||
reportId: HexKey,
|
||||
status: RoadEventStatus,
|
||||
@@ -113,7 +104,6 @@ class RoadEventConfirmationEvent(
|
||||
coordinates(latitude, longitude)
|
||||
}
|
||||
expiration(createdAt + RoadEventReportEvent.RELAY_TTL_SECONDS)
|
||||
alt(altDescription(status))
|
||||
initializer()
|
||||
}
|
||||
|
||||
|
||||
-5
@@ -32,7 +32,6 @@ import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.geohash.geohashes
|
||||
import com.vitorpamplona.quartz.nip31Alts.AltTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip40Expiration.expiration
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@@ -87,13 +86,10 @@ class RoadEventReportEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 1315
|
||||
const val ALT_PREFIX = "Roadstr: "
|
||||
|
||||
/** Fixed relay-side NIP-40 window (14 days) for both report and confirmation events. */
|
||||
const val RELAY_TTL_SECONDS = 1_209_600L
|
||||
|
||||
fun altDescription(type: RoadEventType) = "$ALT_PREFIX${type.code} report"
|
||||
|
||||
fun build(
|
||||
type: RoadEventType,
|
||||
latitude: Double,
|
||||
@@ -106,7 +102,6 @@ class RoadEventReportEvent(
|
||||
roadGeohashes(latitude, longitude)
|
||||
coordinates(latitude, longitude)
|
||||
expiration(createdAt + RELAY_TTL_SECONDS)
|
||||
alt(altDescription(type))
|
||||
initializer()
|
||||
}
|
||||
}
|
||||
|
||||
-3
@@ -46,7 +46,6 @@ import com.vitorpamplona.quartz.nip19Bech32.eventHints
|
||||
import com.vitorpamplona.quartz.nip19Bech32.eventIds
|
||||
import com.vitorpamplona.quartz.nip19Bech32.pubKeyHints
|
||||
import com.vitorpamplona.quartz.nip19Bech32.pubKeys
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@@ -129,7 +128,6 @@ class ZapPollEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 6969
|
||||
const val ALT_DESCRIPTION = "Poll event"
|
||||
|
||||
fun build(
|
||||
post: String,
|
||||
@@ -139,7 +137,6 @@ class ZapPollEvent(
|
||||
): EventTemplate<ZapPollEvent> {
|
||||
val tags = TagArrayBuilder<ZapPollEvent>()
|
||||
tags.pollOptions(options)
|
||||
tags.alt(ALT_DESCRIPTION)
|
||||
tags.apply(initializer)
|
||||
return EventTemplate(createdAt, KIND, tags.build(), post)
|
||||
}
|
||||
|
||||
-3
@@ -28,7 +28,6 @@ import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
/**
|
||||
@@ -85,7 +84,6 @@ class KeyPackageEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 30443
|
||||
const val ALT_DESCRIPTION = "MLS KeyPackage"
|
||||
|
||||
fun build(
|
||||
keyPackageBase64: String,
|
||||
@@ -97,7 +95,6 @@ class KeyPackageEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<KeyPackageEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, keyPackageBase64, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
dTag(dTagSlot)
|
||||
mlsProtocolVersion()
|
||||
mlsCiphersuite(ciphersuite)
|
||||
|
||||
-3
@@ -28,7 +28,6 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.isLocalHost
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync
|
||||
import com.vitorpamplona.quartz.nip31Alts.AltTag
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
/**
|
||||
@@ -53,7 +52,6 @@ class KeyPackageRelayListEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 10051
|
||||
const val ALT_DESCRIPTION = "MLS KeyPackage relay list"
|
||||
|
||||
fun createAddress(pubKey: HexKey): Address = Address(KIND, pubKey, FIXED_D_TAG)
|
||||
|
||||
@@ -62,7 +60,6 @@ class KeyPackageRelayListEvent(
|
||||
private fun createTagArray(relays: List<NormalizedRelayUrl>): Array<Array<String>> =
|
||||
relays
|
||||
.map { RelayTag.assemble(it) }
|
||||
.plusElement(AltTag.assemble(ALT_DESCRIPTION))
|
||||
.toTypedArray()
|
||||
|
||||
suspend fun create(
|
||||
|
||||
+4
@@ -22,6 +22,7 @@ package com.vitorpamplona.quartz.marmot.mip04EncryptedMedia
|
||||
|
||||
import com.vitorpamplona.quartz.nip01Core.core.hexToByteArray
|
||||
import com.vitorpamplona.quartz.nip01Core.core.toHexKey
|
||||
import com.vitorpamplona.quartz.nip31Alts.AltTag
|
||||
import com.vitorpamplona.quartz.nip92IMeta.IMetaTag
|
||||
import com.vitorpamplona.quartz.nip92IMeta.IMetaTagBuilder
|
||||
import com.vitorpamplona.quartz.utils.Log
|
||||
@@ -167,6 +168,7 @@ fun buildMip04IMetaTag(
|
||||
dimensions: String? = null,
|
||||
blurhash: String? = null,
|
||||
thumbhash: String? = null,
|
||||
alt: String? = null,
|
||||
): IMetaTag =
|
||||
IMetaTagBuilder(url)
|
||||
.apply {
|
||||
@@ -178,4 +180,6 @@ fun buildMip04IMetaTag(
|
||||
dimensions?.let { add(Mip04Fields.DIMENSIONS, it) }
|
||||
blurhash?.let { add(Mip04Fields.BLURHASH, it) }
|
||||
thumbhash?.let { add(Mip04Fields.THUMBHASH, it) }
|
||||
// imeta accessibility description (NIP-92/94 "alt"); only when provided.
|
||||
alt?.ifBlank { null }?.let { add(AltTag.TAG_NAME, it) }
|
||||
}.build()
|
||||
|
||||
-7
@@ -41,7 +41,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.EventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.aTag.ATag
|
||||
import com.vitorpamplona.quartz.nip21UriScheme.toNostrUri
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip39ExtIdentities.IdentityClaimTag
|
||||
import com.vitorpamplona.quartz.nip39ExtIdentities.claims
|
||||
import com.vitorpamplona.quartz.nip39ExtIdentities.githubClaim
|
||||
@@ -127,8 +126,6 @@ class MetadataEvent(
|
||||
val content = Json.encodeToString(JsonObject.serializer(), newJsonObject)
|
||||
|
||||
return eventTemplate(KIND, content, createdAt) {
|
||||
alt("User profile for $name")
|
||||
|
||||
updateOrDeleteTagNames(metadata)
|
||||
|
||||
initializer()
|
||||
@@ -175,8 +172,6 @@ class MetadataEvent(
|
||||
val content = Json.encodeToString(JsonObject.serializer(), newJsonObject)
|
||||
|
||||
return eventTemplate(KIND, content, createdAt) {
|
||||
alt("User profile for ${currentMetadata["name"]?.text ?: "Anonymous"}")
|
||||
|
||||
// For https://github.com/nostr-protocol/nips/pull/1770
|
||||
updateOrDeleteTagNames(currentMetadata)
|
||||
|
||||
@@ -233,8 +228,6 @@ class MetadataEvent(
|
||||
|
||||
val tags =
|
||||
latest.tags.builder {
|
||||
alt("User profile for ${currentMetadata["name"]?.text ?: "Anonymous"}")
|
||||
|
||||
updateOrDeleteTagNames(currentMetadata)
|
||||
|
||||
val newClaims = latest.replaceClaims(twitter, mastodon, github)
|
||||
|
||||
+2
-15
@@ -33,7 +33,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.aTag.ATag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.isTaggedUser
|
||||
import com.vitorpamplona.quartz.nip02FollowList.tags.ContactTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.AltTag
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Stable
|
||||
@@ -80,7 +79,6 @@ class ContactListEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 3
|
||||
const val ALT = "Follow List"
|
||||
|
||||
fun createAddress(pubKey: HexKey): Address = Address(KIND, pubKey)
|
||||
|
||||
@@ -177,16 +175,7 @@ class ContactListEvent(
|
||||
tags: Array<Array<String>>,
|
||||
signer: NostrSigner,
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
): ContactListEvent {
|
||||
val newTags =
|
||||
if (tags.any { it.size > 1 && it[0] == "alt" }) {
|
||||
tags
|
||||
} else {
|
||||
tags + AltTag.assemble(ALT)
|
||||
}
|
||||
|
||||
return signer.sign(createdAt, KIND, newTags, content)
|
||||
}
|
||||
): ContactListEvent = signer.sign(createdAt, KIND, tags, content)
|
||||
|
||||
fun createFromScratch(
|
||||
followUsers: List<ContactTag> = emptyList(),
|
||||
@@ -196,9 +185,7 @@ class ContactListEvent(
|
||||
): ContactListEvent {
|
||||
val content = relayUse?.let { RelaySet.assemble(it) } ?: ""
|
||||
|
||||
val tags =
|
||||
listOf(AltTag.assemble(ALT)) +
|
||||
followUsers.map { it.toTagArray() }
|
||||
val tags = followUsers.map { it.toTagArray() }
|
||||
|
||||
return signer.sign(createdAt, KIND, tags.toTypedArray(), content)
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.vitorpamplona.quartz.nip01Core.hints.EventHintProvider
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.events.toETag
|
||||
import com.vitorpamplona.quartz.nip03Timestamp.tags.TargetEventTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import kotlin.io.encoding.Base64
|
||||
|
||||
@@ -60,7 +59,6 @@ class OtsEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 1040
|
||||
const val ALT = "Opentimestamps Attestation"
|
||||
|
||||
/**
|
||||
* Stamp is used to save OTS requests locally while we want for the bitcoin
|
||||
@@ -102,7 +100,6 @@ class OtsEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<OtsEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, encodeOtsState(otsState), createdAt) {
|
||||
alt(ALT)
|
||||
targetEvent(TargetEventTag(eventId))
|
||||
|
||||
initializer()
|
||||
@@ -114,8 +111,6 @@ class OtsEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<OtsEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, encodeOtsState(otsState), createdAt) {
|
||||
alt(ALT)
|
||||
|
||||
targetEvent(event.toETag())
|
||||
targetKind(event.event.kind)
|
||||
|
||||
|
||||
-3
@@ -36,7 +36,6 @@ import com.vitorpamplona.quartz.nip01Core.tags.people.pTag
|
||||
import com.vitorpamplona.quartz.nip10Notes.tags.MarkedETag
|
||||
import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKey
|
||||
import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKeyable
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip92IMeta.IMetaTag
|
||||
import com.vitorpamplona.quartz.utils.Hex
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
@@ -102,7 +101,6 @@ class PrivateDmEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 4
|
||||
const val ALT = "Private Message"
|
||||
const val NIP_18_ADVERTISEMENT = "[//]: # (nip18)\n"
|
||||
|
||||
fun prepareMessageToEncrypt(
|
||||
@@ -139,7 +137,6 @@ class PrivateDmEvent(
|
||||
),
|
||||
createdAt = createdAt,
|
||||
) {
|
||||
alt(ALT)
|
||||
pTag(toUser)
|
||||
replyingTo?.let { reply(it) }
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ import com.vitorpamplona.quartz.nip01Core.tags.kinds.kinds
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.pTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.pTagIds
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -77,15 +76,12 @@ class DeletionEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 5
|
||||
const val ALT = "Deletion event"
|
||||
|
||||
fun build(
|
||||
deleteEvents: List<Event>,
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<DeletionEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT)
|
||||
|
||||
deleteEvents.forEach {
|
||||
eTag(ETag(it.id))
|
||||
if (it is AddressableEvent) {
|
||||
@@ -104,8 +100,6 @@ class DeletionEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<DeletionEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT)
|
||||
|
||||
deleteEvents.forEach {
|
||||
if (it is AddressableEvent) {
|
||||
aTag(it.address())
|
||||
@@ -123,8 +117,6 @@ class DeletionEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<DeletionEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT)
|
||||
|
||||
deleteEvents.forEach {
|
||||
pTag(PTag(it.pubKey))
|
||||
eTag(ETag(it.id))
|
||||
|
||||
@@ -47,10 +47,8 @@ import com.vitorpamplona.quartz.nip19Bech32.eventHints
|
||||
import com.vitorpamplona.quartz.nip19Bech32.eventIds
|
||||
import com.vitorpamplona.quartz.nip19Bech32.pubKeyHints
|
||||
import com.vitorpamplona.quartz.nip19Bech32.pubKeys
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import com.vitorpamplona.quartz.utils.takeKeepingSurrogatePairs
|
||||
|
||||
@Immutable
|
||||
class TextNoteEvent(
|
||||
@@ -124,22 +122,12 @@ class TextNoteEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 1
|
||||
const val ALT = "A short note: "
|
||||
|
||||
private fun shortedMessageForAlt(msg: String): String {
|
||||
if (msg.length < 50) return ALT + msg
|
||||
// takeKeepingSurrogatePairs avoids leaving a lone surrogate (e.g. half
|
||||
// of an emoji) in the alt tag, which would be unencodable as UTF-8 and
|
||||
// corrupt the event id on the wire.
|
||||
return ALT + msg.takeKeepingSurrogatePairs(50) + "..."
|
||||
}
|
||||
|
||||
fun build(
|
||||
note: String,
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<TextNoteEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, note, createdAt) {
|
||||
alt(shortedMessageForAlt(note))
|
||||
initializer()
|
||||
}
|
||||
|
||||
@@ -150,8 +138,6 @@ class TextNoteEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<TextNoteEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, note, createdAt) {
|
||||
alt(shortedMessageForAlt(note))
|
||||
|
||||
if (replyingTo != null || forkingFrom != null) {
|
||||
markedETags(prepareETagsAsReplyTo(replyingTo, forkingFrom))
|
||||
}
|
||||
|
||||
-3
@@ -29,7 +29,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hashtags
|
||||
import com.vitorpamplona.quartz.nip21UriScheme.toNostrUri
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.Log
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import kotlinx.coroutines.CancellationException
|
||||
@@ -56,7 +55,6 @@ class AuctionEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 30020
|
||||
const val ALT_DESCRIPTION = "Marketplace auction"
|
||||
|
||||
fun build(
|
||||
auction: AuctionData,
|
||||
@@ -65,7 +63,6 @@ class AuctionEvent(
|
||||
initializer: TagArrayBuilder<AuctionEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, JsonMapper.toJson(auction), createdAt) {
|
||||
dTag(auction.id)
|
||||
alt(ALT_DESCRIPTION)
|
||||
categories?.let { hashtags(it) }
|
||||
initializer()
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.events.ETag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip15Marketplace.auction.AuctionEvent
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -59,7 +58,6 @@ class BidEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 1021
|
||||
const val ALT_DESCRIPTION = "Auction bid"
|
||||
|
||||
fun build(
|
||||
auction: EventHintBundle<AuctionEvent>,
|
||||
@@ -67,7 +65,6 @@ class BidEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<BidEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, amount.toLong().toString(), createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
auction(auction)
|
||||
notifyAuthor(auction)
|
||||
initializer()
|
||||
|
||||
-3
@@ -34,7 +34,6 @@ import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip15Marketplace.auction.AuctionEvent
|
||||
import com.vitorpamplona.quartz.nip15Marketplace.bid.BidEvent
|
||||
import com.vitorpamplona.quartz.nip21UriScheme.toNostrUri
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.Log
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import kotlinx.coroutines.CancellationException
|
||||
@@ -71,7 +70,6 @@ class BidConfirmationEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 1022
|
||||
const val ALT_DESCRIPTION = "Bid confirmation"
|
||||
|
||||
const val STATUS_ACCEPTED = "accepted"
|
||||
const val STATUS_REJECTED = "rejected"
|
||||
@@ -85,7 +83,6 @@ class BidConfirmationEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<BidConfirmationEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, JsonMapper.toJson(confirmation), createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
bid(bid)
|
||||
auction(auction)
|
||||
notifyBidder(bid)
|
||||
|
||||
-3
@@ -28,7 +28,6 @@ import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip21UriScheme.toNostrUri
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.Log
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import kotlinx.coroutines.CancellationException
|
||||
@@ -55,7 +54,6 @@ class MarketplaceEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 30019
|
||||
const val ALT_DESCRIPTION = "Marketplace UI"
|
||||
|
||||
fun build(
|
||||
marketplace: MarketplaceData,
|
||||
@@ -64,7 +62,6 @@ class MarketplaceEvent(
|
||||
initializer: TagArrayBuilder<MarketplaceEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, JsonMapper.toJson(marketplace), createdAt) {
|
||||
dTag(dTag)
|
||||
alt(ALT_DESCRIPTION)
|
||||
initializer()
|
||||
}
|
||||
}
|
||||
|
||||
-3
@@ -29,7 +29,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hashtags
|
||||
import com.vitorpamplona.quartz.nip21UriScheme.toNostrUri
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.Log
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import kotlinx.coroutines.CancellationException
|
||||
@@ -58,7 +57,6 @@ class ProductEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 30018
|
||||
const val ALT_DESCRIPTION = "Marketplace product"
|
||||
|
||||
fun build(
|
||||
product: ProductData,
|
||||
@@ -67,7 +65,6 @@ class ProductEvent(
|
||||
initializer: TagArrayBuilder<ProductEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, JsonMapper.toJson(product), createdAt) {
|
||||
dTag(product.id)
|
||||
alt(ALT_DESCRIPTION)
|
||||
categories?.let { hashtags(it) }
|
||||
initializer()
|
||||
}
|
||||
|
||||
-3
@@ -28,7 +28,6 @@ import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip21UriScheme.toNostrUri
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.Log
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import kotlinx.coroutines.CancellationException
|
||||
@@ -55,7 +54,6 @@ class StallEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 30017
|
||||
const val ALT_DESCRIPTION = "Marketplace stall"
|
||||
|
||||
fun build(
|
||||
stall: StallData,
|
||||
@@ -63,7 +61,6 @@ class StallEvent(
|
||||
initializer: TagArrayBuilder<StallEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, JsonMapper.toJson(stall), createdAt) {
|
||||
dTag(stall.id)
|
||||
alt(ALT_DESCRIPTION)
|
||||
initializer()
|
||||
}
|
||||
}
|
||||
|
||||
-4
@@ -33,7 +33,6 @@ import com.vitorpamplona.quartz.nip17Dm.files.tags.EncryptionKey
|
||||
import com.vitorpamplona.quartz.nip17Dm.files.tags.EncryptionNonce
|
||||
import com.vitorpamplona.quartz.nip17Dm.files.tags.FileTypeTag
|
||||
import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip94FileMetadata.tags.BlurhashTag
|
||||
import com.vitorpamplona.quartz.nip94FileMetadata.tags.DimensionTag
|
||||
import com.vitorpamplona.quartz.nip94FileMetadata.tags.HashSha256Tag
|
||||
@@ -78,7 +77,6 @@ class ChatMessageEncryptedFileHeaderEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 15
|
||||
const val ALT_DESCRIPTION = "Encrypted file in chat"
|
||||
|
||||
fun build(
|
||||
to: List<PTag>,
|
||||
@@ -97,8 +95,6 @@ class ChatMessageEncryptedFileHeaderEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<ChatMessageEncryptedFileHeaderEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, url, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
|
||||
group(to)
|
||||
|
||||
encryptionAlgo(cipher.name())
|
||||
|
||||
-4
@@ -29,7 +29,6 @@ import com.vitorpamplona.quartz.nip01Core.tags.events.ETag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.toPTag
|
||||
import com.vitorpamplona.quartz.nip17Dm.base.BaseDMGroupEvent
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@@ -50,7 +49,6 @@ class ChatMessageEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 14
|
||||
const val ALT_DESCRIPTION = "Direct message"
|
||||
|
||||
fun build(
|
||||
msg: String,
|
||||
@@ -58,7 +56,6 @@ class ChatMessageEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<ChatMessageEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, msg, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
group(to)
|
||||
initializer()
|
||||
}
|
||||
@@ -69,7 +66,6 @@ class ChatMessageEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<ChatMessageEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, msg, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
reply(reply)
|
||||
group((reply.event.recipients() + reply.toPTag()).distinctBy { it.pubKey })
|
||||
initializer()
|
||||
|
||||
+1
-4
@@ -29,7 +29,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.aTag.ATag
|
||||
import com.vitorpamplona.quartz.nip17Dm.settings.tags.RelayTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.AltTag
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -55,9 +54,7 @@ class ChatMessageRelayListEvent(
|
||||
fun createTagArray(relays: List<NormalizedRelayUrl>): Array<Array<String>> =
|
||||
relays
|
||||
.map { RelayTag.assemble(it) }
|
||||
.plusElement(
|
||||
AltTag.assemble("Relay list to receive private messages"),
|
||||
).toTypedArray()
|
||||
.toTypedArray()
|
||||
|
||||
suspend fun updateRelayList(
|
||||
earlierVersion: ChatMessageRelayListEvent,
|
||||
|
||||
-4
@@ -39,7 +39,6 @@ import com.vitorpamplona.quartz.nip01Core.tags.kinds.KindTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.kinds.kind
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.pTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import com.vitorpamplona.quartz.utils.lastNotNullOfOrNull
|
||||
|
||||
@@ -93,7 +92,6 @@ class GenericRepostEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 16
|
||||
const val ALT = "Generic repost"
|
||||
|
||||
fun build(
|
||||
eventHint: EventHintBundle<Event>,
|
||||
@@ -102,8 +100,6 @@ class GenericRepostEvent(
|
||||
) = eventTemplate(KIND, eventHint.event.toJson(), createdAt) {
|
||||
val boostedPost = eventHint.event
|
||||
|
||||
alt(ALT)
|
||||
|
||||
kind(boostedPost.kind)
|
||||
pTag(PTag(boostedPost.pubKey, eventHint.authorHomeRelay))
|
||||
eTag(ETag(boostedPost.id, eventHint.relay, boostedPost.pubKey))
|
||||
|
||||
@@ -39,7 +39,6 @@ import com.vitorpamplona.quartz.nip01Core.tags.kinds.KindTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.kinds.kind
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.pTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import com.vitorpamplona.quartz.utils.lastNotNullOfOrNull
|
||||
|
||||
@@ -93,7 +92,6 @@ class RepostEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 6
|
||||
const val ALT = "Repost event"
|
||||
|
||||
fun build(
|
||||
eventHint: EventHintBundle<Event>,
|
||||
@@ -102,8 +100,6 @@ class RepostEvent(
|
||||
) = eventTemplate(KIND, eventHint.event.toJson(), createdAt) {
|
||||
val boostedPost = eventHint.event
|
||||
|
||||
alt(ALT)
|
||||
|
||||
pTag(PTag(boostedPost.pubKey, eventHint.authorHomeRelay))
|
||||
eTag(ETag(boostedPost.id, eventHint.relay, boostedPost.pubKey))
|
||||
if (boostedPost is AddressableEvent) {
|
||||
|
||||
@@ -44,7 +44,6 @@ import com.vitorpamplona.quartz.nip19Bech32.eventHints
|
||||
import com.vitorpamplona.quartz.nip19Bech32.eventIds
|
||||
import com.vitorpamplona.quartz.nip19Bech32.pubKeyHints
|
||||
import com.vitorpamplona.quartz.nip19Bech32.pubKeys
|
||||
import com.vitorpamplona.quartz.nip21UriScheme.toNostrUri
|
||||
import com.vitorpamplona.quartz.nip22Comments.tags.ReplyAddressTag
|
||||
import com.vitorpamplona.quartz.nip22Comments.tags.ReplyAuthorTag
|
||||
import com.vitorpamplona.quartz.nip22Comments.tags.ReplyEventTag
|
||||
@@ -55,7 +54,6 @@ import com.vitorpamplona.quartz.nip22Comments.tags.RootAuthorTag
|
||||
import com.vitorpamplona.quartz.nip22Comments.tags.RootEventTag
|
||||
import com.vitorpamplona.quartz.nip22Comments.tags.RootIdentifierTag
|
||||
import com.vitorpamplona.quartz.nip22Comments.tags.RootKindTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent
|
||||
import com.vitorpamplona.quartz.nip73ExternalIds.ExternalId
|
||||
@@ -240,7 +238,6 @@ class CommentEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 1111
|
||||
const val ALT = "Reply to "
|
||||
|
||||
fun replyBuilder(
|
||||
msg: String,
|
||||
@@ -248,8 +245,6 @@ class CommentEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<CommentEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, msg, createdAt) {
|
||||
alt(ALT + replyingTo.toNostrUri())
|
||||
|
||||
if (replyingTo.event is CommentEvent) {
|
||||
addAll(replyingTo.event.rootScopes())
|
||||
addAll(replyingTo.event.rootKinds())
|
||||
@@ -278,8 +273,6 @@ class CommentEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<CommentEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, msg, createdAt) {
|
||||
alt(ALT + extId.toScope())
|
||||
|
||||
if (extId is GeohashId) {
|
||||
GeoHashTag.geoMipMap(extId.geohash).forEach { rootExternalIdentity(GeohashId(it, extId.hint)) }
|
||||
} else {
|
||||
|
||||
-2
@@ -49,7 +49,6 @@ import com.vitorpamplona.quartz.nip23LongContent.tags.ImageTag
|
||||
import com.vitorpamplona.quartz.nip23LongContent.tags.PublishedAtTag
|
||||
import com.vitorpamplona.quartz.nip23LongContent.tags.SummaryTag
|
||||
import com.vitorpamplona.quartz.nip23LongContent.tags.TitleTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import kotlin.uuid.ExperimentalUuidApi
|
||||
@@ -157,7 +156,6 @@ class LongTextNoteEvent(
|
||||
initializer: TagArrayBuilder<LongTextNoteEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, description, createdAt) {
|
||||
dTag(dTag)
|
||||
alt("Blog post: $title")
|
||||
|
||||
title(title)
|
||||
summary?.let { summary(it) }
|
||||
|
||||
-2
@@ -31,7 +31,6 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip28PublicChat.base.ChannelData
|
||||
import com.vitorpamplona.quartz.nip28PublicChat.base.ChannelDataNorm
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.Log
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
@@ -97,7 +96,6 @@ class ChannelCreateEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<ChannelCreateEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, data.toContent(), createdAt) {
|
||||
alt("Public chat creation event ${data.name?.let { "about $it" }}")
|
||||
initializer()
|
||||
}
|
||||
}
|
||||
|
||||
-3
@@ -31,7 +31,6 @@ import com.vitorpamplona.quartz.nip01Core.tags.events.eTags
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.events.taggedEventIds
|
||||
import com.vitorpamplona.quartz.nip28PublicChat.base.BasePublicChatEvent
|
||||
import com.vitorpamplona.quartz.nip28PublicChat.base.channel
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -52,7 +51,6 @@ class ChannelHideMessageEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 43
|
||||
const val ALT = "Hide message instruction for public chats"
|
||||
|
||||
fun build(
|
||||
reason: String,
|
||||
@@ -61,7 +59,6 @@ class ChannelHideMessageEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<ChannelHideMessageEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, reason, createdAt) {
|
||||
alt(ALT)
|
||||
channel(channel)
|
||||
eTags(messagesToHide)
|
||||
initializer()
|
||||
|
||||
-3
@@ -34,7 +34,6 @@ import com.vitorpamplona.quartz.nip28PublicChat.base.BasePublicChatEvent
|
||||
import com.vitorpamplona.quartz.nip28PublicChat.base.ChannelData
|
||||
import com.vitorpamplona.quartz.nip28PublicChat.base.ChannelDataNorm
|
||||
import com.vitorpamplona.quartz.nip28PublicChat.base.channel
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.Log
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
@@ -116,7 +115,6 @@ class ChannelMetadataEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<ChannelMetadataEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, data.toContent(), createdAt) {
|
||||
alt("Public chat update to ${data.name}")
|
||||
channel(channel)
|
||||
initializer()
|
||||
}
|
||||
@@ -127,7 +125,6 @@ class ChannelMetadataEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<ChannelMetadataEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, data.toContent(), createdAt) {
|
||||
alt("Public chat update to ${data.name}")
|
||||
channel(channel)
|
||||
initializer()
|
||||
}
|
||||
|
||||
-3
@@ -31,7 +31,6 @@ import com.vitorpamplona.quartz.nip01Core.tags.people.pTags
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.taggedUserIds
|
||||
import com.vitorpamplona.quartz.nip28PublicChat.base.BasePublicChatEvent
|
||||
import com.vitorpamplona.quartz.nip28PublicChat.base.channel
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -52,7 +51,6 @@ class ChannelMuteUserEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 44
|
||||
const val ALT = "Mute user instruction for public chats"
|
||||
|
||||
fun build(
|
||||
reason: String,
|
||||
@@ -61,7 +59,6 @@ class ChannelMuteUserEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<ChannelMuteUserEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, reason, createdAt) {
|
||||
alt(ALT)
|
||||
channel(channel)
|
||||
pTags(usersToMute)
|
||||
initializer()
|
||||
|
||||
+2
-16
@@ -25,15 +25,12 @@ import com.vitorpamplona.quartz.nip01Core.core.Address
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArray
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.core.fastAny
|
||||
import com.vitorpamplona.quartz.nip01Core.hints.EventHintProvider
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.SignerExceptions
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip28PublicChat.list.tags.ChannelTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.AltTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip51Lists.PrivateTagArrayEvent
|
||||
import com.vitorpamplona.quartz.nip51Lists.encryption.PrivateTagsInContent
|
||||
import com.vitorpamplona.quartz.nip51Lists.encryption.signNip51List
|
||||
@@ -57,7 +54,6 @@ class ChannelListEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 10005
|
||||
const val ALT = "Public Chat List"
|
||||
const val FIXED_D_TAG = ""
|
||||
|
||||
fun createAddress(pubKey: HexKey) = Address(KIND, pubKey, FIXED_D_TAG)
|
||||
@@ -166,16 +162,7 @@ class ChannelListEvent(
|
||||
tags: TagArray,
|
||||
signer: NostrSigner,
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
): ChannelListEvent {
|
||||
val newTags =
|
||||
if (tags.fastAny(AltTag::match)) {
|
||||
tags
|
||||
} else {
|
||||
tags + AltTag.assemble(ALT)
|
||||
}
|
||||
|
||||
return signer.sign(createdAt, KIND, newTags, content)
|
||||
}
|
||||
): ChannelListEvent = signer.sign(createdAt, KIND, tags, content)
|
||||
|
||||
suspend fun create(
|
||||
publicChannels: List<ChannelTag> = emptyList(),
|
||||
@@ -194,7 +181,7 @@ class ChannelListEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
): ChannelListEvent {
|
||||
val privateTagArray = privateChannels.map { it.toTagArray() }.toTypedArray()
|
||||
val publicTagArray = publicChannels.map { it.toTagArray() }.toTypedArray() + AltTag.assemble(ALT)
|
||||
val publicTagArray = publicChannels.map { it.toTagArray() }.toTypedArray()
|
||||
return signer.signNip51List(createdAt, KIND, publicTagArray, privateTagArray)
|
||||
}
|
||||
|
||||
@@ -209,7 +196,6 @@ class ChannelListEvent(
|
||||
description = PrivateTagsInContent.encryptNip44(privateChannels.map { it.toTagArray() }.toTypedArray(), signer),
|
||||
createdAt = createdAt,
|
||||
) {
|
||||
alt(ALT)
|
||||
channels(publicChannels)
|
||||
|
||||
initializer()
|
||||
|
||||
-3
@@ -27,7 +27,6 @@ import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip29RelayGroups.tags.GroupAdminTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -45,7 +44,6 @@ class GroupAdminsEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 39001
|
||||
const val ALT_DESCRIPTION = "Group admins"
|
||||
|
||||
fun build(
|
||||
groupId: String,
|
||||
@@ -53,7 +51,6 @@ class GroupAdminsEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<GroupAdminsEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
dTag(groupId)
|
||||
addAll(GroupAdminTag.assemble(admins))
|
||||
initializer()
|
||||
|
||||
-3
@@ -27,7 +27,6 @@ import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -45,7 +44,6 @@ class GroupMembersEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 39002
|
||||
const val ALT_DESCRIPTION = "Group members"
|
||||
|
||||
fun build(
|
||||
groupId: String,
|
||||
@@ -53,7 +51,6 @@ class GroupMembersEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<GroupMembersEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
dTag(groupId)
|
||||
memberPubKeys.forEach { add(arrayOf("p", it)) }
|
||||
initializer()
|
||||
|
||||
-3
@@ -28,7 +28,6 @@ import com.vitorpamplona.quartz.nip01Core.core.firstTagValue
|
||||
import com.vitorpamplona.quartz.nip01Core.core.hasTagWithContent
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@@ -81,7 +80,6 @@ class GroupMetadataEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 39000
|
||||
const val ALT_DESCRIPTION = "Group metadata"
|
||||
|
||||
fun build(
|
||||
groupId: String,
|
||||
@@ -92,7 +90,6 @@ class GroupMetadataEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<GroupMetadataEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
dTag(groupId)
|
||||
name?.let { add(arrayOf("name", it)) }
|
||||
about?.let { add(arrayOf("about", it)) }
|
||||
|
||||
-3
@@ -27,7 +27,6 @@ import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip29RelayGroups.tags.RoleTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -45,7 +44,6 @@ class SupportedRolesEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 39003
|
||||
const val ALT_DESCRIPTION = "Group supported roles"
|
||||
|
||||
fun build(
|
||||
groupId: String,
|
||||
@@ -53,7 +51,6 @@ class SupportedRolesEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<SupportedRolesEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
dTag(groupId)
|
||||
addAll(RoleTag.assemble(roles))
|
||||
initializer()
|
||||
|
||||
-3
@@ -25,7 +25,6 @@ import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -41,14 +40,12 @@ class CreateGroupEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 9007
|
||||
const val ALT_DESCRIPTION = "Group create"
|
||||
|
||||
fun build(
|
||||
groupId: String,
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<CreateGroupEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
groupId(groupId)
|
||||
initializer()
|
||||
}
|
||||
|
||||
-3
@@ -25,7 +25,6 @@ import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -43,7 +42,6 @@ class CreateInviteEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 9009
|
||||
const val ALT_DESCRIPTION = "Group create invite"
|
||||
|
||||
fun build(
|
||||
groupId: String,
|
||||
@@ -51,7 +49,6 @@ class CreateInviteEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<CreateInviteEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
groupId(groupId)
|
||||
inviteCode(code)
|
||||
initializer()
|
||||
|
||||
-3
@@ -25,7 +25,6 @@ import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -45,7 +44,6 @@ class DeleteEventEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 9005
|
||||
const val ALT_DESCRIPTION = "Group delete event"
|
||||
|
||||
fun build(
|
||||
groupId: String,
|
||||
@@ -54,7 +52,6 @@ class DeleteEventEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<DeleteEventEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
groupId(groupId)
|
||||
eventIds.forEach { add(arrayOf("e", it)) }
|
||||
previous(previousEvents)
|
||||
|
||||
-3
@@ -25,7 +25,6 @@ import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -41,14 +40,12 @@ class DeleteGroupEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 9008
|
||||
const val ALT_DESCRIPTION = "Group delete"
|
||||
|
||||
fun build(
|
||||
groupId: String,
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<DeleteGroupEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
groupId(groupId)
|
||||
initializer()
|
||||
}
|
||||
|
||||
-3
@@ -26,7 +26,6 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMetadataEvent
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -44,7 +43,6 @@ class EditMetadataEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 9002
|
||||
const val ALT_DESCRIPTION = "Group edit metadata"
|
||||
|
||||
fun build(
|
||||
groupId: String,
|
||||
@@ -56,7 +54,6 @@ class EditMetadataEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<EditMetadataEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
groupId(groupId)
|
||||
name?.let { add(arrayOf("name", it)) }
|
||||
about?.let { add(arrayOf("about", it)) }
|
||||
|
||||
-3
@@ -25,7 +25,6 @@ import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -45,7 +44,6 @@ class PutUserEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 9000
|
||||
const val ALT_DESCRIPTION = "Group add user"
|
||||
|
||||
fun build(
|
||||
groupId: String,
|
||||
@@ -54,7 +52,6 @@ class PutUserEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<PutUserEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
groupId(groupId)
|
||||
pubKeysWithRoles.forEach { (pubKey, roles) ->
|
||||
userPubKeyWithRoles(pubKey, roles)
|
||||
|
||||
-3
@@ -25,7 +25,6 @@ import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -45,7 +44,6 @@ class RemoveUserEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 9001
|
||||
const val ALT_DESCRIPTION = "Group remove user"
|
||||
|
||||
fun build(
|
||||
groupId: String,
|
||||
@@ -54,7 +52,6 @@ class RemoveUserEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<RemoveUserEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
groupId(groupId)
|
||||
pubKeys.forEach { userPubKey(it) }
|
||||
previous(previousEvents)
|
||||
|
||||
-3
@@ -27,7 +27,6 @@ import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip29RelayGroups.moderation.groupId
|
||||
import com.vitorpamplona.quartz.nip29RelayGroups.moderation.inviteCode
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -45,7 +44,6 @@ class JoinRequestEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 9021
|
||||
const val ALT_DESCRIPTION = "Group join request"
|
||||
|
||||
fun build(
|
||||
groupId: String,
|
||||
@@ -54,7 +52,6 @@ class JoinRequestEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<JoinRequestEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, reason, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
groupId(groupId)
|
||||
inviteCode?.let { inviteCode(it) }
|
||||
initializer()
|
||||
|
||||
-3
@@ -26,7 +26,6 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip29RelayGroups.moderation.groupId
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -42,7 +41,6 @@ class LeaveRequestEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 9022
|
||||
const val ALT_DESCRIPTION = "Group leave request"
|
||||
|
||||
fun build(
|
||||
groupId: String,
|
||||
@@ -50,7 +48,6 @@ class LeaveRequestEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<LeaveRequestEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, reason, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
groupId(groupId)
|
||||
initializer()
|
||||
}
|
||||
|
||||
-2
@@ -28,7 +28,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip30CustomEmoji.EmojiUrlTag
|
||||
import com.vitorpamplona.quartz.nip30CustomEmoji.emojis
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.nip51Lists.PrivateTagArrayEvent
|
||||
import com.vitorpamplona.quartz.nip51Lists.tags.DescriptionTag
|
||||
@@ -84,7 +83,6 @@ class EmojiPackEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<EmojiPackEvent>.() -> Unit = {},
|
||||
) = eventTemplate<EmojiPackEvent>(KIND, "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
dTag(dTag)
|
||||
title(name)
|
||||
initializer()
|
||||
|
||||
-3
@@ -32,7 +32,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventUpdate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.aTag.ATag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.aTag.toATag
|
||||
import com.vitorpamplona.quartz.nip30CustomEmoji.pack.EmojiPackEvent
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -55,7 +54,6 @@ class EmojiPackSelectionEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 10030
|
||||
const val ALT_DESCRIPTION = "Emoji selection"
|
||||
const val FIXED_D_TAG = ""
|
||||
|
||||
fun createAddress(pubKey: HexKey) = Address(KIND, pubKey, FIXED_D_TAG)
|
||||
@@ -87,7 +85,6 @@ class EmojiPackSelectionEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<EmojiPackSelectionEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
packs(listOfEmojiPacks.map { it.toATag() })
|
||||
initializer()
|
||||
}
|
||||
|
||||
@@ -23,4 +23,11 @@ package com.vitorpamplona.quartz.nip31Alts
|
||||
import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
|
||||
/**
|
||||
* Writes an `alt` tag. The generic NIP-31 "alt" client-hint is deprecated, so do
|
||||
* NOT use this to add a boilerplate description of the event kind. It remains only
|
||||
* for file-metadata events (e.g. NIP-94 kind 1063, NIP-17 encrypted file headers)
|
||||
* where the `alt` tag is the accessibility description of the file itself, and only
|
||||
* when the user actually provided one.
|
||||
*/
|
||||
fun <T : Event> TagArrayBuilder<T>.alt(altDescriptor: String) = addUnique(AltTag.assemble(altDescriptor))
|
||||
|
||||
@@ -39,7 +39,6 @@ import com.vitorpamplona.quartz.nip01Core.tags.events.toETag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.hashtags.HashtagTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.pTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip32Labeling.tags.LabelNamespaceTag
|
||||
import com.vitorpamplona.quartz.nip32Labeling.tags.LabelTag
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
@@ -114,7 +113,6 @@ class LabelEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 1985
|
||||
const val ALT = "Label event"
|
||||
|
||||
/**
|
||||
* NIP-32 tag-association namespace for hashtags. A label of the form
|
||||
@@ -133,7 +131,6 @@ class LabelEvent(
|
||||
hashtag: String,
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
) = eventTemplate<LabelEvent>(KIND, "", createdAt) {
|
||||
alt(ALT)
|
||||
eTag(labeledEvent.toETag())
|
||||
val tag = LabelTag(hashtag.removePrefix("#").lowercase(), HASHTAG_NAMESPACE)
|
||||
labelNamespace(tag.namespace)
|
||||
@@ -151,7 +148,6 @@ class LabelEvent(
|
||||
content: String = "",
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
) = eventTemplate<LabelEvent>(KIND, content, createdAt) {
|
||||
alt(ALT)
|
||||
eTag(ETag(labeledEventId, labeledEventRelay?.let { RelayUrlNormalizer.normalizeOrNull(it) }, labeledEventAuthor))
|
||||
labels.map { it.namespace }.distinct().forEach { labelNamespace(it) }
|
||||
labels.forEach { label(it) }
|
||||
@@ -167,7 +163,6 @@ class LabelEvent(
|
||||
content: String = "",
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
) = eventTemplate<LabelEvent>(KIND, content, createdAt) {
|
||||
alt(ALT)
|
||||
pTag(labeledPubKey, labeledPubKeyRelay?.let { RelayUrlNormalizer.normalizeOrNull(it) })
|
||||
labels.map { it.namespace }.distinct().forEach { labelNamespace(it) }
|
||||
labels.forEach { label(it) }
|
||||
@@ -181,7 +176,6 @@ class LabelEvent(
|
||||
content: String = "",
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
) = eventTemplate<LabelEvent>(KIND, content, createdAt) {
|
||||
alt(ALT)
|
||||
labels.map { it.namespace }.distinct().forEach { labelNamespace(it) }
|
||||
labels.forEach { label(it) }
|
||||
}
|
||||
|
||||
-4
@@ -27,7 +27,6 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip34Git.grasp.tags.GraspTag
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@@ -55,7 +54,6 @@ class UserGraspListEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 10317
|
||||
const val ALT = "Preferred grasp servers for Git over Nostr"
|
||||
|
||||
fun createAddress(pubKey: HexKey): Address = Address(KIND, pubKey, FIXED_D_TAG)
|
||||
|
||||
@@ -64,7 +62,6 @@ class UserGraspListEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<UserGraspListEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT)
|
||||
grasps.forEach { add(GraspTag.assemble(it)) }
|
||||
initializer()
|
||||
}
|
||||
@@ -74,7 +71,6 @@ class UserGraspListEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<UserGraspListEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT)
|
||||
grasps.forEach { add(GraspTag.assemble(it)) }
|
||||
initializer()
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ import com.vitorpamplona.quartz.nip19Bech32.eventHints
|
||||
import com.vitorpamplona.quartz.nip19Bech32.eventIds
|
||||
import com.vitorpamplona.quartz.nip19Bech32.pubKeyHints
|
||||
import com.vitorpamplona.quartz.nip19Bech32.pubKeys
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip34Git.repository.GitRepositoryEvent
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
@@ -119,7 +118,6 @@ class GitIssueEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 1621
|
||||
const val ALT_DESCRIPTION = "A Git Issue"
|
||||
|
||||
fun build(
|
||||
subject: String,
|
||||
@@ -130,7 +128,6 @@ class GitIssueEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<GitIssueEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, content, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
subject(subject)
|
||||
repository(repository)
|
||||
notify(notify)
|
||||
|
||||
@@ -37,7 +37,6 @@ import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.pTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.pTags
|
||||
import com.vitorpamplona.quartz.nip10Notes.tags.MarkedETag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip34Git.patch.tags.CommitPgpSigTag
|
||||
import com.vitorpamplona.quartz.nip34Git.patch.tags.CommitTag
|
||||
import com.vitorpamplona.quartz.nip34Git.patch.tags.Committer
|
||||
@@ -118,7 +117,6 @@ class GitPatchEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 1617
|
||||
const val ALT = "A Git Patch"
|
||||
const val ROOT = "root"
|
||||
const val ROOT_REVISION = "root-revision"
|
||||
|
||||
@@ -150,7 +148,6 @@ class GitPatchEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<GitPatchEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, patch, createdAt) {
|
||||
alt(ALT)
|
||||
repository(repository)
|
||||
euc(earliestUniqueCommit)
|
||||
pTag(repository.event.pubKey, repository.authorHomeRelay)
|
||||
|
||||
-3
@@ -36,7 +36,6 @@ import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.pTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.pTags
|
||||
import com.vitorpamplona.quartz.nip14Subject.SubjectTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip34Git.pr.tags.BranchNameTag
|
||||
import com.vitorpamplona.quartz.nip34Git.pr.tags.CurrentCommitTag
|
||||
import com.vitorpamplona.quartz.nip34Git.pr.tags.MergeBaseTag
|
||||
@@ -103,7 +102,6 @@ class GitPullRequestEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 1618
|
||||
const val ALT = "A Git Pull Request"
|
||||
|
||||
/**
|
||||
* Build a NIP-34 kind-1618 pull request event.
|
||||
@@ -135,7 +133,6 @@ class GitPullRequestEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<GitPullRequestEvent>.() -> Unit = {},
|
||||
) = eventTemplate<GitPullRequestEvent>(KIND, description, createdAt) {
|
||||
alt(ALT)
|
||||
repository(repository)
|
||||
euc(earliestUniqueCommit)
|
||||
pTag(repository.event.pubKey, repository.authorHomeRelay)
|
||||
|
||||
-3
@@ -35,7 +35,6 @@ import com.vitorpamplona.quartz.nip01Core.tags.people.pTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.pTags
|
||||
import com.vitorpamplona.quartz.nip22Comments.tags.RootAuthorTag
|
||||
import com.vitorpamplona.quartz.nip22Comments.tags.RootEventTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip34Git.pr.tags.CurrentCommitTag
|
||||
import com.vitorpamplona.quartz.nip34Git.pr.tags.MergeBaseTag
|
||||
import com.vitorpamplona.quartz.nip34Git.repository.GitRepositoryEvent
|
||||
@@ -90,7 +89,6 @@ class GitPullRequestUpdateEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 1619
|
||||
const val ALT = "A Git Pull Request Update"
|
||||
|
||||
/**
|
||||
* Build a NIP-34 kind-1619 pull-request update event.
|
||||
@@ -114,7 +112,6 @@ class GitPullRequestUpdateEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<GitPullRequestUpdateEvent>.() -> Unit = {},
|
||||
) = eventTemplate<GitPullRequestUpdateEvent>(KIND, "", createdAt) {
|
||||
alt(ALT)
|
||||
parentPullRequest(parentPullRequest)
|
||||
parentPullRequestAuthor(parentPullRequest)
|
||||
repository(repository)
|
||||
|
||||
-4
@@ -29,7 +29,6 @@ import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.hashtags.HashtagTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hashtag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hashtags
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip34Git.repository.tags.CloneTag
|
||||
import com.vitorpamplona.quartz.nip34Git.repository.tags.DescriptionTag
|
||||
import com.vitorpamplona.quartz.nip34Git.repository.tags.EucTag
|
||||
@@ -94,7 +93,6 @@ class GitRepositoryEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 30617
|
||||
const val ALT_DESCRIPTION = "Git Repository"
|
||||
const val PERSONAL_FORK = "personal-fork"
|
||||
|
||||
@OptIn(ExperimentalUuidApi::class)
|
||||
@@ -107,7 +105,6 @@ class GitRepositoryEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<GitRepositoryEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
dTag(dTag)
|
||||
name(name)
|
||||
description?.let { description(it) }
|
||||
@@ -131,7 +128,6 @@ class GitRepositoryEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<GitRepositoryEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
dTag(dTag)
|
||||
name(name)
|
||||
description?.let { description(it) }
|
||||
|
||||
-3
@@ -26,7 +26,6 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip34Git.state.tags.HeadTag
|
||||
import com.vitorpamplona.quartz.nip34Git.state.tags.RefTag
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
@@ -61,7 +60,6 @@ class GitRepositoryStateEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 30618
|
||||
const val ALT_DESCRIPTION = "Git Repository State"
|
||||
|
||||
fun build(
|
||||
dTag: String,
|
||||
@@ -70,7 +68,6 @@ class GitRepositoryStateEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<GitRepositoryStateEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
dTag(dTag)
|
||||
refs.forEach { ref(it) }
|
||||
head?.let { head(it) }
|
||||
|
||||
-2
@@ -60,7 +60,6 @@ class GitStatusAppliedEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = KIND_APPLIED
|
||||
const val ALT = "A Git Applied Status"
|
||||
|
||||
fun <T : Event> build(
|
||||
content: String,
|
||||
@@ -73,7 +72,6 @@ class GitStatusAppliedEvent(
|
||||
initializer: TagArrayBuilder<GitStatusAppliedEvent>.() -> Unit = {},
|
||||
) = GitStatusBuilders.buildStatus<GitStatusAppliedEvent, T>(
|
||||
kind = KIND,
|
||||
altDescriptor = ALT,
|
||||
content = content,
|
||||
target = target,
|
||||
notify = notify,
|
||||
|
||||
-3
@@ -28,7 +28,6 @@ import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.pTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.people.pTags
|
||||
import com.vitorpamplona.quartz.nip10Notes.tags.MarkedETag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
/**
|
||||
@@ -40,14 +39,12 @@ import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
object GitStatusBuilders {
|
||||
fun <E : GitStatusEvent, T : Event> buildStatus(
|
||||
kind: Int,
|
||||
altDescriptor: String,
|
||||
content: String,
|
||||
target: EventHintBundle<T>,
|
||||
notify: List<PTag> = emptyList(),
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<E>.() -> Unit = {},
|
||||
) = eventTemplate<E>(kind, content, createdAt) {
|
||||
alt(altDescriptor)
|
||||
add(
|
||||
MarkedETag.assemble(
|
||||
target.event.id,
|
||||
|
||||
-2
@@ -39,7 +39,6 @@ class GitStatusClosedEvent(
|
||||
) : GitStatusEvent(id, pubKey, createdAt, KIND, tags, content, sig) {
|
||||
companion object {
|
||||
const val KIND = KIND_CLOSED
|
||||
const val ALT = "A Git Closed Status"
|
||||
|
||||
fun <T : com.vitorpamplona.quartz.nip01Core.core.Event> build(
|
||||
content: String,
|
||||
@@ -49,7 +48,6 @@ class GitStatusClosedEvent(
|
||||
initializer: TagArrayBuilder<GitStatusClosedEvent>.() -> Unit = {},
|
||||
) = GitStatusBuilders.buildStatus<GitStatusClosedEvent, T>(
|
||||
kind = KIND,
|
||||
altDescriptor = ALT,
|
||||
content = content,
|
||||
target = target,
|
||||
notify = notify,
|
||||
|
||||
-2
@@ -39,7 +39,6 @@ class GitStatusDraftEvent(
|
||||
) : GitStatusEvent(id, pubKey, createdAt, KIND, tags, content, sig) {
|
||||
companion object {
|
||||
const val KIND = KIND_DRAFT
|
||||
const val ALT = "A Git Draft Status"
|
||||
|
||||
fun <T : com.vitorpamplona.quartz.nip01Core.core.Event> build(
|
||||
content: String,
|
||||
@@ -49,7 +48,6 @@ class GitStatusDraftEvent(
|
||||
initializer: TagArrayBuilder<GitStatusDraftEvent>.() -> Unit = {},
|
||||
) = GitStatusBuilders.buildStatus<GitStatusDraftEvent, T>(
|
||||
kind = KIND,
|
||||
altDescriptor = ALT,
|
||||
content = content,
|
||||
target = target,
|
||||
notify = notify,
|
||||
|
||||
-2
@@ -39,7 +39,6 @@ class GitStatusOpenEvent(
|
||||
) : GitStatusEvent(id, pubKey, createdAt, KIND, tags, content, sig) {
|
||||
companion object {
|
||||
const val KIND = KIND_OPEN
|
||||
const val ALT = "A Git Open Status"
|
||||
|
||||
fun <T : com.vitorpamplona.quartz.nip01Core.core.Event> build(
|
||||
content: String,
|
||||
@@ -49,7 +48,6 @@ class GitStatusOpenEvent(
|
||||
initializer: TagArrayBuilder<GitStatusOpenEvent>.() -> Unit = {},
|
||||
) = GitStatusBuilders.buildStatus<GitStatusOpenEvent, T>(
|
||||
kind = KIND,
|
||||
altDescriptor = ALT,
|
||||
content = content,
|
||||
target = target,
|
||||
notify = notify,
|
||||
|
||||
-3
@@ -47,7 +47,6 @@ import com.vitorpamplona.quartz.nip19Bech32.eventHints
|
||||
import com.vitorpamplona.quartz.nip19Bech32.eventIds
|
||||
import com.vitorpamplona.quartz.nip19Bech32.pubKeyHints
|
||||
import com.vitorpamplona.quartz.nip19Bech32.pubKeys
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip50Search.SearchableEvent
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@@ -118,7 +117,6 @@ class TorrentCommentEvent(
|
||||
@Suppress("DEPRECATION")
|
||||
companion object {
|
||||
const val KIND = 2004
|
||||
const val ALT_DESCRIPTION = "Comment for a Torrent file"
|
||||
|
||||
fun build(
|
||||
message: String,
|
||||
@@ -152,7 +150,6 @@ class TorrentCommentEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<TorrentCommentEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, post, createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
initializer()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ import com.vitorpamplona.quartz.nip10Notes.content.findNostrUris
|
||||
import com.vitorpamplona.quartz.nip10Notes.content.findURLs
|
||||
import com.vitorpamplona.quartz.nip18Reposts.quotes.quotes
|
||||
import com.vitorpamplona.quartz.nip23LongContent.tags.TitleTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip35Torrents.tags.BtihTag
|
||||
import com.vitorpamplona.quartz.nip35Torrents.tags.FileTag
|
||||
import com.vitorpamplona.quartz.nip35Torrents.tags.InfoHashTag
|
||||
@@ -98,7 +97,6 @@ class TorrentEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
initializer: TagArrayBuilder<TorrentEvent>.() -> Unit = {},
|
||||
) = eventTemplate(KIND, description ?: "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
initializer()
|
||||
}
|
||||
|
||||
@@ -109,11 +107,9 @@ class TorrentEvent(
|
||||
description: String? = null,
|
||||
x: String? = null,
|
||||
trackers: List<String>? = null,
|
||||
alt: String? = null,
|
||||
contentWarningReason: String? = null,
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
) = eventTemplate(KIND, description ?: "", createdAt) {
|
||||
alt(alt ?: ALT_DESCRIPTION)
|
||||
title(title)
|
||||
btih(btih)
|
||||
files(files)
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.SignerExceptions
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.kinds.kind
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip40Expiration.expiration
|
||||
import com.vitorpamplona.quartz.utils.Log
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
@@ -67,7 +66,6 @@ class DraftWrapEvent(
|
||||
|
||||
companion object {
|
||||
const val KIND = 31234
|
||||
const val ALT_DESCRIPTION = "Draft Event"
|
||||
|
||||
fun createAddress(
|
||||
pubKey: HexKey,
|
||||
@@ -90,7 +88,6 @@ class DraftWrapEvent(
|
||||
description = signer.nip44Encrypt(draft.toJson(), signer.pubKey),
|
||||
createdAt = createdAt,
|
||||
) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
dTag(dTag)
|
||||
kind(draft.kind)
|
||||
expiration(TimeUtils.ninetyDaysFromNow())
|
||||
@@ -111,7 +108,6 @@ class DraftWrapEvent(
|
||||
description = "",
|
||||
createdAt = createdAt,
|
||||
) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
expiration(TimeUtils.oneMinuteFromNow())
|
||||
dTag(dTag)
|
||||
initializer()
|
||||
|
||||
+2
-8
@@ -30,8 +30,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.SignerExceptions
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.aTag.ATag
|
||||
import com.vitorpamplona.quartz.nip31Alts.AltTag
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.nip51Lists.PrivateTagArrayEvent
|
||||
import com.vitorpamplona.quartz.nip51Lists.encryption.PrivateTagsInContent
|
||||
import com.vitorpamplona.quartz.nip51Lists.encryption.signNip51List
|
||||
@@ -59,9 +57,6 @@ class PrivateOutboxRelayListEvent(
|
||||
const val KIND = 10013
|
||||
const val FIXED_D_TAG = ""
|
||||
|
||||
val ALT = "Relay list to store private content from this author"
|
||||
val TAGS = arrayOf(AltTag.assemble(ALT))
|
||||
|
||||
fun createAddress(pubKey: HexKey): Address = Address(KIND, pubKey, FIXED_D_TAG)
|
||||
|
||||
fun createAddressATag(pubKey: HexKey): ATag = ATag(KIND, pubKey, FIXED_D_TAG, null)
|
||||
@@ -89,7 +84,7 @@ class PrivateOutboxRelayListEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
): PrivateOutboxRelayListEvent {
|
||||
val privateTagArray = relays.map { RelayTag.assemble(it) }.toTypedArray()
|
||||
return signer.signNip51List(createdAt, KIND, TAGS, privateTagArray)
|
||||
return signer.signNip51List(createdAt, KIND, emptyArray(), privateTagArray)
|
||||
}
|
||||
|
||||
suspend fun create(
|
||||
@@ -98,7 +93,7 @@ class PrivateOutboxRelayListEvent(
|
||||
createdAt: Long = TimeUtils.now(),
|
||||
): PrivateOutboxRelayListEvent {
|
||||
val privateTagArray = relays.map { RelayTag.assemble(it) }.toTypedArray()
|
||||
return signer.signNip51List(createdAt, KIND, TAGS, privateTagArray)
|
||||
return signer.signNip51List(createdAt, KIND, emptyArray(), privateTagArray)
|
||||
}
|
||||
|
||||
suspend fun build(
|
||||
@@ -112,7 +107,6 @@ class PrivateOutboxRelayListEvent(
|
||||
description = PrivateTagsInContent.encryptNip44(privateRelays.map { RelayTag.assemble(it) }.toTypedArray(), signer),
|
||||
createdAt = createdAt,
|
||||
) {
|
||||
alt(ALT)
|
||||
privateRelays(publicRelays)
|
||||
|
||||
initializer()
|
||||
|
||||
-4
@@ -28,7 +28,6 @@ import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||
import com.vitorpamplona.quartz.nip01Core.core.builder
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.EventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||
import com.vitorpamplona.quartz.nip31Alts.alt
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
@Immutable
|
||||
@@ -42,7 +41,6 @@ class ExternalIdentitiesEvent(
|
||||
) : BaseReplaceableEvent(id, pubKey, createdAt, KIND, tags, content, sig) {
|
||||
companion object {
|
||||
const val KIND = 10011
|
||||
const val ALT_DESCRIPTION = "External Identities"
|
||||
const val FIXED_D_TAG = ""
|
||||
|
||||
fun createAddress(pubKey: HexKey): Address = Address(KIND, pubKey, FIXED_D_TAG)
|
||||
@@ -57,7 +55,6 @@ class ExternalIdentitiesEvent(
|
||||
initializer: TagArrayBuilder<ExternalIdentitiesEvent>.() -> Unit = {},
|
||||
): EventTemplate<ExternalIdentitiesEvent> =
|
||||
eventTemplate(KIND, "", createdAt) {
|
||||
alt(ALT_DESCRIPTION)
|
||||
twitter?.let { twitterClaim(it) }
|
||||
mastodon?.let { mastodonClaim(it) }
|
||||
github?.let { githubClaim(it) }
|
||||
@@ -74,7 +71,6 @@ class ExternalIdentitiesEvent(
|
||||
): EventTemplate<ExternalIdentitiesEvent> {
|
||||
val tags =
|
||||
latest.tags.builder {
|
||||
alt(ALT_DESCRIPTION)
|
||||
val newClaims = latest.replaceClaims(twitter, mastodon, github)
|
||||
remove(IdentityClaimTag.TAG_NAME)
|
||||
claims(newClaims)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user