Remove zod schemas that we can get from NSchema

This commit is contained in:
Alex Gleason
2024-05-01 19:51:12 -05:00
parent 79177cd6c3
commit fc7ed8bf24
17 changed files with 65 additions and 204 deletions

View File

@@ -1,6 +1,8 @@
import { NSchema as n } from '@nostrify/nostrify';
import { type AppController } from '@/app.ts';
import { Conf } from '@/config.ts';
import { jsonServerMetaSchema } from '@/schemas/nostr.ts';
import { serverMetaSchema } from '@/schemas/nostr.ts';
import { Storages } from '@/storages.ts';
const instanceController: AppController = async (c) => {
@@ -8,7 +10,7 @@ const instanceController: AppController = async (c) => {
const { signal } = c.req.raw;
const [event] = await Storages.db.query([{ kinds: [0], authors: [Conf.pubkey], limit: 1 }], { signal });
const meta = jsonServerMetaSchema.parse(event?.content);
const meta = n.json().pipe(serverMetaSchema).parse(event?.content);
/** Protocol to use for WebSocket URLs, depending on the protocol of the `LOCAL_DOMAIN`. */
const wsProtocol = protocol === 'http:' ? 'ws:' : 'wss:';