diff --git a/src/app/components/ContentLinkBlock.svelte b/src/app/components/ContentLinkBlock.svelte
index 50b4ee9..1f01eda 100644
--- a/src/app/components/ContentLinkBlock.svelte
+++ b/src/app/components/ContentLinkBlock.svelte
@@ -22,7 +22,7 @@
const expand = () => pushModal(ContentLinkDetail, {url}, {fullscreen: true})
-
+
{#if url.match(/\.(mov|webm|mp4)$/)}
{:else}
-
+
{formatTimestamp(event.created_at)}
{/if}
diff --git a/src/app/requests.ts b/src/app/requests.ts
index f67951c..a4d9faa 100644
--- a/src/app/requests.ts
+++ b/src/app/requests.ts
@@ -1,9 +1,9 @@
import {get} from "svelte/store"
-import {partition, assoc, now, ago, MONTH} from "@welshman/lib"
-import {MESSAGE, DELETE, THREAD, COMMENT} from "@welshman/util"
+import {partition, assoc, now} from "@welshman/lib"
+import {MESSAGE, THREAD, COMMENT} from "@welshman/util"
import type {Subscription} from "@welshman/net"
import type {AppSyncOpts} from "@welshman/app"
-import {subscribe, repository, pull, hasNegentropy} from "@welshman/app"
+import {subscribe, load, repository, pull, hasNegentropy} from "@welshman/app"
import {userRoomsByUrl, getUrlsForEvent} from "@app/state"
// Utils
@@ -35,12 +35,12 @@ export const listenForNotifications = () => {
const subs: Subscription[] = []
for (const [url, rooms] of userRoomsByUrl.get()) {
- pullConservatively({
+ load({
relays: [url],
filters: [
- {kinds: [THREAD, DELETE], since: ago(MONTH)},
- {kinds: [COMMENT], "#K": [String(THREAD)], since: ago(MONTH)},
- ...Array.from(rooms).map(room => ({kinds: [MESSAGE], "#h": [room], since: ago(MONTH)})),
+ {kinds: [THREAD], limit: 1},
+ {kinds: [COMMENT], "#K": [String(THREAD)], limit: 1},
+ ...Array.from(rooms).map(room => ({kinds: [MESSAGE], "#h": [room], limit: 1})),
],
})
diff --git a/src/app/state.ts b/src/app/state.ts
index 6902c9a..a127c9e 100644
--- a/src/app/state.ts
+++ b/src/app/state.ts
@@ -607,8 +607,7 @@ export const userSettingValues = withGetter(
derived(userSettings, $s => $s?.values || defaultSettings),
)
-export const getSetting = (key: keyof Settings["values"]) =>
- userSettingValues.get()[key] as T
+export const getSetting = (key: keyof Settings["values"]) => userSettingValues.get()[key] as T
export const userMembership = withGetter(
derived([pubkey, membershipByPubkey], ([$pubkey, $membershipByPubkey]) => {
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 9c3d6a2..11867d5 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -5,20 +5,12 @@
import {get, derived} from "svelte/store"
import {dev} from "$app/environment"
import {bytesToHex, hexToBytes} from "@noble/hashes/utils"
- import {
- identity,
- sleep,
- take,
- sortBy,
- ago,
- now,
- HOUR,
- WEEK,
- Worker,
- } from "@welshman/lib"
+ import {identity, sleep, take, sortBy, ago, now, HOUR, WEEK, MONTH, Worker} from "@welshman/lib"
import type {TrustedEvent} from "@welshman/util"
import {
+ MESSAGE,
PROFILE,
+ DELETE,
REACTION,
ZAP_RESPONSE,
FOLLOWS,
@@ -111,13 +103,13 @@
events: storageAdapters.fromRepositoryAndTracker(repository, tracker, {
throttle: 3000,
migrate: (events: TrustedEvent[]) => {
- if (events.length < 50_000) {
+ if (events.length < 15_000) {
return events
}
const NEVER_KEEP = 0
const ALWAYS_KEEP = Infinity
- const reactionKinds = [REACTION, ZAP_RESPONSE]
+ const reactionKinds = [REACTION, ZAP_RESPONSE, DELETE]
const metaKinds = [PROFILE, FOLLOWS, RELAYS, INBOX_RELAYS]
const $sessionKeys = new Set(Object.keys(app.sessions.get()))
const $userFollows = new Set(getPubkeyTagValues(getListTags(get(app.userFollows))))
@@ -129,6 +121,9 @@
// No need to keep a record of everyone who follows the current user
if (e.kind === FOLLOWS && !isFollowing) return NEVER_KEEP
+ // Drop room messages after a month, re-load on demand
+ if (e.kind === MESSAGE && e.created_at < ago(MONTH)) return NEVER_KEEP
+
// Always keep stuff by or tagging a signed in user
if ($sessionKeys.has(e.pubkey)) return ALWAYS_KEEP
if (e.tags.some(t => $sessionKeys.has(t[1]))) return ALWAYS_KEEP
@@ -148,7 +143,7 @@
}
return take(
- 30_000,
+ 10_000,
sortBy(e => -scoreEvent(e), events),
)
},
@@ -193,11 +188,11 @@
// Listen for chats, populate chat-based notifications
let chatsSub: any
- derived([pubkey, userInboxRelaySelections], identity).subscribe(
- ([$pubkey, $userInboxRelaySelections]) => {
+ derived([pubkey, canDecrypt, userInboxRelaySelections], identity).subscribe(
+ ([$pubkey, $canDecrypt, $userInboxRelaySelections]) => {
chatsSub?.close()
- if ($pubkey) {
+ if ($pubkey && $canDecrypt) {
chatsSub = subscribe({
filters: [
{kinds: [WRAP], "#p": [$pubkey], since: ago(WEEK, 2)},
diff --git a/src/routes/spaces/[relay]/+layout.svelte b/src/routes/spaces/[relay]/+layout.svelte
index 4abf265..b9f5c11 100644
--- a/src/routes/spaces/[relay]/+layout.svelte
+++ b/src/routes/spaces/[relay]/+layout.svelte
@@ -1,9 +1,9 @@
@@ -170,7 +200,7 @@
diff --git a/src/routes/spaces/[relay]/threads/+page.svelte b/src/routes/spaces/[relay]/threads/+page.svelte
index cbed2fa..10d2cc8 100644
--- a/src/routes/spaces/[relay]/threads/+page.svelte
+++ b/src/routes/spaces/[relay]/threads/+page.svelte
@@ -5,7 +5,7 @@
import {sortBy, min, nthEq, sleep} from "@welshman/lib"
import {getListTags, getPubkeyTagValues} from "@welshman/util"
import {throttled} from "@welshman/store"
- import {feedsFromFilters, makeIntersectionFeed, makeRelayFeed} from "@welshman/feeds"
+ import {feedFromFilters, makeIntersectionFeed, makeRelayFeed} from "@welshman/feeds"
import {createFeedController, userMutes} from "@welshman/app"
import {createScroller, type Scroller} from "@lib/html"
import {fly} from "@lib/transition"
@@ -21,7 +21,7 @@
import {pushModal} from "@app/modal"
const url = decodeRelay($page.params.relay)
- const feeds = feedsFromFilters([THREAD_FILTER, COMMENT_FILTER])
+ const feed = feedFromFilters([THREAD_FILTER, COMMENT_FILTER])
const threads = deriveEventsForUrl(url, [THREAD_FILTER])
const comments = deriveEventsForUrl(url, [COMMENT_FILTER])
const mutedPubkeys = getPubkeyTagValues(getListTags($userMutes))
@@ -50,7 +50,7 @@
const ctrl = createFeedController({
useWindowing: true,
- feed: makeIntersectionFeed(makeRelayFeed(url), feeds),
+ feed: makeIntersectionFeed(makeRelayFeed(url), feed),
onExhausted: () => {
loading = false
},