From 5bd4014d6dcdb3a11057122ab2fd1f901a0e80a3 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Thu, 2 Jul 2026 16:36:58 -0700 Subject: [PATCH] Tweak syncing, fix logo generation --- build.sh | 5 +++++ src/app.html | 2 +- src/app/sync.ts | 36 +++++++++++++++++++++++++----------- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/build.sh b/build.sh index 894db8e3..b9229dc3 100755 --- a/build.sh +++ b/build.sh @@ -17,6 +17,11 @@ fi if [[ $VITE_PLATFORM_LOGO =~ ^https:// ]]; then curl -fSL "$VITE_PLATFORM_LOGO" -o static/logo.png export VITE_PLATFORM_LOGO=static/logo.png + + # @capacitor/assets reads its source logo from assets/, not static/, so + # propagate a custom platform logo there too for the native app icon/splash + cp "$VITE_PLATFORM_LOGO" assets/logo.png + cp "$VITE_PLATFORM_LOGO" assets/logo-dark.png fi # Ensure generator uses local path (dotenv may have loaded URL from .env) diff --git a/src/app.html b/src/app.html index 56e67676..5124988f 100644 --- a/src/app.html +++ b/src/app.html @@ -24,7 +24,7 @@ - + %sveltekit.head% diff --git a/src/app/sync.ts b/src/app/sync.ts index de649b89..0953f812 100644 --- a/src/app/sync.ts +++ b/src/app/sync.ts @@ -1,6 +1,6 @@ import {page} from "$app/stores" import type {Unsubscriber} from "svelte/store" -import {last, call, assoc, WEEK, ago} from "@welshman/lib" +import {call, assoc, WEEK, MONTH, ago} from "@welshman/lib" import {merged} from "@welshman/store" import { getListTags, @@ -79,7 +79,6 @@ const pullOneWithFallback = async ( if (signal.aborted) return const cachedEvents = repository.query([filter]).filter(isSignedEvent) - const since = last(cachedEvents.slice(10))?.created_at || 0 if (onEvent) { for (const event of cachedEvents) { @@ -114,7 +113,7 @@ const pullOneWithFallback = async ( // })) if (shouldFallback && !signal.aborted) { - request({relays: [url], signal, autoClose: true, filters: [{since, ...filter}], onEvent}) + request({relays: [url], signal, autoClose: true, filters: [filter], onEvent}) } } @@ -289,21 +288,36 @@ const syncUserData = () => { // Spaces const syncSpace = (url: string) => { - const since = ago(WEEK) const controller = new AbortController() - const relayKinds = [RELAY_MEMBERS, RELAY_ROLE] - const roomMetaKinds = [ROOM_META, ROOM_ADMINS, ROOM_MEMBERS, LIVEKIT_PARTICIPANTS] - const roomDeleteKinds = [ROOM_DELETE, ROOM_JOIN, ROOM_LEAVE] + // Low cardinality we want everything for pullAndListen({ url, signal: controller.signal, filters: [ - {kinds: [...relayKinds, ...roomMetaKinds, ...roomDeleteKinds, ...CONTENT_KINDS, MESSAGE]}, + {kinds: [RELAY_MEMBERS, RELAY_ROLE]}, {kinds: [APP_DATA], "#d": [FEATURED_CONTENT_D]}, - {kinds: [BOARD, PIN]}, - {kinds: [...REACTION_KINDS, POLL_RESPONSE], since}, - makeCommentFilter(CONTENT_KINDS, {since}), + ], + }) + + // Higher cardinality stuff we want as much as we can get + pullAndListen({ + url, + signal: controller.signal, + filters: [ + {kinds: [ROOM_META, ROOM_ADMINS, ROOM_MEMBERS, ROOM_DELETE, LIVEKIT_PARTICIPANTS, BOARD]}, + {kinds: [APP_DATA], "#d": [FEATURED_CONTENT_D]}, + ], + }) + + // Recent stuff, best effort + pullAndListen({ + url, + signal: controller.signal, + filters: [ + {kinds: [...CONTENT_KINDS, MESSAGE, PIN, ROOM_JOIN, ROOM_LEAVE], since: ago(MONTH)}, + {kinds: [...REACTION_KINDS, POLL_RESPONSE], since: ago(WEEK)}, + makeCommentFilter(CONTENT_KINDS, {since: ago(WEEK)}), ], })