Fix encrypted export

This commit is contained in:
Jon Staab 2024-05-23 14:57:00 -07:00
parent 2d41eb4874
commit 1b77f669c9

View File

@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import {isGiftWrap} from "src/util/nostr"
import FieldInline from "src/partials/FieldInline.svelte" import FieldInline from "src/partials/FieldInline.svelte"
import Toggle from "src/partials/Toggle.svelte" import Toggle from "src/partials/Toggle.svelte"
import Anchor from "src/partials/Anchor.svelte" import Anchor from "src/partials/Anchor.svelte"
@ -10,7 +9,7 @@
const submit = async () => { const submit = async () => {
const events = Array.from(repository.query([userOnly ? {authors: [$user.pubkey]} : {}])) const events = Array.from(repository.query([userOnly ? {authors: [$user.pubkey]} : {}]))
const jsonl = events const jsonl = events
.filter(e => includeEncrypted || !isGiftWrap(e)) .filter(e => includeEncrypted || (!e.wrap && e.kind !== 4))
// Important: re-wrap encrypted messages // Important: re-wrap encrypted messages
.map(e => JSON.stringify(e.wrap || e)) .map(e => JSON.stringify(e.wrap || e))
.join("\n") .join("\n")