Use lib version of date functions

This commit is contained in:
Jon Staab
2025-05-05 10:11:02 -07:00
parent 5873e8aa60
commit c1b52b66ff
21 changed files with 221 additions and 150 deletions
+30 -25
View File
@@ -15,6 +15,7 @@
THREAD,
MESSAGE,
INBOX_RELAYS,
DIRECT_MESSAGE,
MUTES,
FOLLOWS,
PROFILE,
@@ -131,31 +132,6 @@
}
})
await initStorage("flotilla", 8, {
...defaultStorageAdapters,
events: new EventsStorageAdapter({
name: "events",
limit: 10_000,
repository,
rankEvent: (e: TrustedEvent) => {
if ([PROFILE, FOLLOWS, MUTES, RELAYS, BLOSSOM_SERVERS, INBOX_RELAYS].includes(e.kind))
return 1
if ([EVENT_TIME, THREAD, MESSAGE, WRAP].includes(e.kind)) return 0.9
return 0
},
}),
})
sleep(300).then(() => ready.resolve())
defaultSocketPolicies.push(
makeSocketPolicyAuth({
sign: (event: StampedEvent) => signer.get()?.sign(event),
shouldAuth: (socket: Socket) => true,
}),
)
// Unwrap gift wraps as they come in, but throttled
const unwrapper = new TaskQueue<TrustedEvent>({batchSize: 10, processItem: ensureUnwrapped})
@@ -171,6 +147,35 @@
}
})
await initStorage("flotilla", 8, {
...defaultStorageAdapters,
events: new EventsStorageAdapter({
name: "events",
limit: 10_000,
repository,
rankEvent: (e: TrustedEvent) => {
if ([PROFILE, FOLLOWS, MUTES, RELAYS, BLOSSOM_SERVERS, INBOX_RELAYS].includes(e.kind)) {
return 1
}
if ([EVENT_TIME, THREAD, MESSAGE, DIRECT_MESSAGE].includes(e.kind)) {
return 0.9
}
return 0
},
}),
})
sleep(300).then(() => ready.resolve())
defaultSocketPolicies.push(
makeSocketPolicyAuth({
sign: (event: StampedEvent) => signer.get()?.sign(event),
shouldAuth: (socket: Socket) => true,
}),
)
// Load relay info
for (const url of INDEXER_RELAYS) {
loadRelay(url)
@@ -3,10 +3,10 @@
import {onMount, onDestroy} from "svelte"
import {page} from "$app/stores"
import type {Readable} from "svelte/store"
import {now} from "@welshman/lib"
import {now, formatTimestampAsDate} from "@welshman/lib"
import type {TrustedEvent, EventContent} from "@welshman/util"
import {createEvent, MESSAGE, DELETE, REACTION} from "@welshman/util"
import {formatTimestampAsDate, pubkey, publishThunk, deriveRelay} from "@welshman/app"
import {pubkey, publishThunk, deriveRelay} from "@welshman/app"
import {slide, fade, fly} from "@lib/transition"
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
@@ -3,10 +3,9 @@
import type {Readable} from "svelte/store"
import {readable} from "svelte/store"
import {page} from "$app/stores"
import {now, last} from "@welshman/lib"
import {now, last, formatTimestampAsDate} from "@welshman/lib"
import type {TrustedEvent} from "@welshman/util"
import {REACTION, DELETE, EVENT_TIME, getTagValue} from "@welshman/util"
import {formatTimestampAsDate} from "@welshman/app"
import {fly} from "@lib/transition"
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"