Publish events signed by the relay to the relay

This commit is contained in:
Jon Staab 2026-07-10 08:17:01 -07:00
parent e9f896f5ef
commit e1c439fb6b

View file

@ -30,9 +30,7 @@ import {
loadRelay, loadRelay,
manageRelay, manageRelay,
publishThunk, publishThunk,
repository,
sign, sign,
tracker,
waitForThunkError, waitForThunkError,
} from "@welshman/app" } from "@welshman/app"
import {checkRelayHasLivekit} from "$lib/livekit" import {checkRelayHasLivekit} from "$lib/livekit"
@ -125,12 +123,11 @@ export const signAsRelay = async (url: string, template: object): Promise<string
params: [template as unknown as string], params: [template as unknown as string],
}) })
if (!error && isSignedEvent(result)) { if (error) return error
repository.publish(result)
tracker.track(result.id, url)
}
return error if (!isSignedEvent(result)) return "Relay returned an invalid event"
return stripPrefix(await waitForThunkError(publishThunk({event: result, relays: [url]})))
} }
export const deriveSupportedMethods = simpleCache(([url]: [string]) => { export const deriveSupportedMethods = simpleCache(([url]: [string]) => {