From 9d0f6ec155a84a5c693c168edbd860e9664c91ad Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Mon, 18 Mar 2024 12:32:40 -0400 Subject: [PATCH] Fix the sneaker app RE: JSONB. --- apps/sneaker.json | 2 +- apps/sneaker/script.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/sneaker.json b/apps/sneaker.json index 20ab7890..5e58a425 100644 --- a/apps/sneaker.json +++ b/apps/sneaker.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "👟", - "previous": "&zhV2BKLLZ6aG3HsVyRTs9ESLxE2lb0e7TDE7PobnyNY=.sha256" + "previous": "&lYZRnT2UGQxXxYISbuaZewik9AuxBpcJumakwrePw5c=.sha256" } diff --git a/apps/sneaker/script.js b/apps/sneaker/script.js index a214ee0f..bd77d610 100644 --- a/apps/sneaker/script.js +++ b/apps/sneaker/script.js @@ -38,10 +38,11 @@ class TfSneakerAppElement extends LitElement { } format_message(message) { + const k_flag_sequence_before_author = 1; let out = { previous: message.previous ?? null, }; - if (message.sequence_before_author) { + if (message.flags & k_flag_sequence_before_author) { out.sequence = message.sequence; out.author = message.author; } else { @@ -188,7 +189,12 @@ class TfSneakerAppElement extends LitElement { )[0].total; while (true) { let messages = await tfrpc.rpc.query( - 'SELECT * FROM messages WHERE author = ? AND SEQUENCE > ? ORDER BY sequence LIMIT 100', + ` + SELECT author, id, sequence, timestamp, hash, json(content) AS content, signature, flags + FROM messages + WHERE author = ? AND SEQUENCE > ? + ORDER BY sequence LIMIT 100 + `, [id, sequence] ); if (messages?.length) {