GUI read-model overhaul: server-assembled channel windows (Correct™ pagination + relay-signed bounds) (#1500)

Signed-off-by: Tyler Longwell <tlongwell@block.xyz>
Signed-off-by: npub12gtutshhh76rx0jx697f32f9tffd4hhp3hx58fp4x6u4uemkm7sqf8f757 <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@sprout-oss.stage.blox.sqprod.co>
Co-authored-by: npub1cc3ha7z055mu0rwwu7806t2wt8mj3pvu0uv5mfp2c50dahaqhczshdalg6 <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@sprout-oss.stage.blox.sqprod.co>
Co-authored-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@sprout-oss.stage.blox.sqprod.co>
Co-authored-by: Tyler Longwell <tlongwell@block.xyz>
Co-authored-by: npub12gtutshhh76rx0jx697f32f9tffd4hhp3hx58fp4x6u4uemkm7sqf8f757 <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@sprout-oss.stage.blox.sqprod.co>
This commit is contained in:
Tyler
2026-07-04 11:51:58 -04:00
committed by GitHub
parent c7a8b0babb
commit 62bb9fe8c8
45 changed files with 4524 additions and 950 deletions

View File

@@ -0,0 +1,17 @@
import { invokeTauri } from "@/shared/api/tauri";
import type { ChannelPageCursor, RelayEvent } from "@/shared/api/types";
/** Fetch the flat Nostr event array for one server-assembled channel window. */
export async function getChannelWindowEvents(
channelId: string,
cursor: ChannelPageCursor | null = null,
limitRows = 50,
): Promise<RelayEvent[]> {
return invokeTauri<RelayEvent[]>("get_channel_window", {
channelId,
limitRows,
cursor: cursor
? { created_at: cursor.createdAt, event_id: cursor.eventId }
: null,
});
}

View File

@@ -10,6 +10,7 @@ import {
KIND_STREAM_MESSAGE,
KIND_TYPING_INDICATOR,
KIND_USER_STATUS,
CHANNEL_EVENT_KINDS,
} from "@/shared/constants/kinds";
import {
getTextPayload,
@@ -332,19 +333,14 @@ export class RelayClient {
return this.subscribe(buildChannelFilter(channelId, 50), onEvent);
}
/**
* Subscribe to a channel starting from NOW — no history backfill.
* Used by huddle TTS where only live kind:9 messages should be spoken.
* The `since` filter ensures the relay never sends historical backlog.
* The high `limit` ensures reconnect replay can recover all missed events.
*/
/** Subscribe to channel rows and aux starting now, with no history replay. */
async subscribeToChannelLive(
channelId: string,
onEvent: (event: RelayEvent) => void,
) {
return this.subscribe(
{
kinds: [KIND_STREAM_MESSAGE],
kinds: [...CHANNEL_EVENT_KINDS],
"#h": [channelId],
limit: 1000,
since: Math.floor(Date.now() / 1_000),