mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-08 16:14:22 +01:00
Catch metadata when parsing
This commit is contained in:
@@ -197,7 +197,7 @@ const updateCredentialsController: AppController = async (c) => {
|
||||
}
|
||||
|
||||
const author = await getAuthor(pubkey);
|
||||
const meta = author ? n.json().pipe(n.metadata()).parse(author.content) : {};
|
||||
const meta = author ? n.json().pipe(n.metadata()).catch({}).parse(author.content) : {};
|
||||
|
||||
const {
|
||||
avatar: avatarFile,
|
||||
|
||||
@@ -10,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 = n.json().pipe(serverMetaSchema).parse(event?.content);
|
||||
const meta = n.json().pipe(serverMetaSchema).catch({}).parse(event?.content);
|
||||
|
||||
/** Protocol to use for WebSocket URLs, depending on the protocol of the `LOCAL_DOMAIN`. */
|
||||
const wsProtocol = protocol === 'http:' ? 'ws:' : 'wss:';
|
||||
|
||||
@@ -405,7 +405,7 @@ const zapController: AppController = async (c) => {
|
||||
|
||||
const target = await getEvent(id, { kind: 1, relations: ['author', 'event_stats', 'author_stats'], signal });
|
||||
const author = target?.author;
|
||||
const meta = n.json().pipe(n.metadata()).parse(author?.content);
|
||||
const meta = n.json().pipe(n.metadata()).catch({}).parse(author?.content);
|
||||
const lnurl = getLnurl(meta);
|
||||
|
||||
if (target && lnurl) {
|
||||
|
||||
Reference in New Issue
Block a user