Skip to content

Commit b7130b6

Browse files
committed
sort notes
1 parent 9292d4f commit b7130b6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scripts/nostr-link-extract.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,12 @@ async function getNotesWithLinks (userPubkeys, timeIntervalHours, relayUrls, ign
405405
* @returns {String} - Formatted string with note information
406406
*/
407407
function formatNoteOutput (notes) {
408+
// Sort notes by timestamp (newest first)
409+
const sortedNotes = [...notes].sort((a, b) => b.created_at - a.created_at)
410+
408411
const output = []
409412

410-
for (const note of notes) {
413+
for (const note of sortedNotes) {
411414
// Get note ID as npub
412415
const noteId = nip19.noteEncode(note.id)
413416
const pubkey = nip19.npubEncode(note.pubkey)

0 commit comments

Comments
 (0)