From b7130b68fd5b0ce636917067cc20295b5d14ca5d Mon Sep 17 00:00:00 2001 From: k00b Date: Thu, 6 Mar 2025 15:21:50 -0600 Subject: [PATCH] sort notes --- scripts/nostr-link-extract.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/nostr-link-extract.js b/scripts/nostr-link-extract.js index a8d4a6d5..113e20f5 100644 --- a/scripts/nostr-link-extract.js +++ b/scripts/nostr-link-extract.js @@ -405,9 +405,12 @@ async function getNotesWithLinks (userPubkeys, timeIntervalHours, relayUrls, ign * @returns {String} - Formatted string with note information */ function formatNoteOutput (notes) { + // Sort notes by timestamp (newest first) + const sortedNotes = [...notes].sort((a, b) => b.created_at - a.created_at) + const output = [] - for (const note of notes) { + for (const note of sortedNotes) { // Get note ID as npub const noteId = nip19.noteEncode(note.id) const pubkey = nip19.npubEncode(note.pubkey)