feat: long form rendering

This commit is contained in:
2023-10-11 11:44:53 +01:00
parent 3b505f6c3e
commit 6eca5a632d
25 changed files with 508 additions and 191 deletions

View File

@ -165,14 +165,14 @@ export class EventPublisher {
amount: number,
author: HexKey,
relays: Array<string>,
note?: HexKey,
note?: NostrLink,
msg?: string,
fnExtra?: EventBuilderHook,
) {
const eb = this.#eb(EventKind.ZapRequest);
eb.content(msg ?? "");
if (note) {
eb.tag(["e", note]);
eb.tag(unwrap(note.toEventTag()));
}
eb.tag(["p", author]);
eb.tag(["relays", ...relays.map(a => a.trim())]);
@ -205,7 +205,7 @@ export class EventPublisher {
eb.tag(["p", pk]);
}
} else {
eb.tag([...(NostrLink.fromEvent(replyTo).toEventTag() ?? []), "reply"]);
eb.tag([...(NostrLink.fromEvent(replyTo).toEventTag() ?? []), "root"]);
// dont tag self in replies
if (replyTo.pubkey !== this.#pubKey) {
eb.tag(["p", replyTo.pubkey]);
@ -219,7 +219,7 @@ export class EventPublisher {
async react(evRef: NostrEvent, content = "+") {
const eb = this.#eb(EventKind.Reaction);
eb.content(content);
eb.tag(["e", evRef.id]);
eb.tag(unwrap(NostrLink.fromEvent(evRef).toEventTag()));
eb.tag(["p", evRef.pubkey]);
return await this.#sign(eb);
}
@ -269,7 +269,7 @@ export class EventPublisher {
*/
async repost(note: NostrEvent) {
const eb = this.#eb(EventKind.Repost);
eb.tag(["e", note.id, ""]);
eb.tag(unwrap(NostrLink.fromEvent(note).toEventTag()));
eb.tag(["p", note.pubkey]);
return await this.#sign(eb);
}