pl-fe: Accept posts without accounts (terrible workaround)

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2025-12-25 20:14:47 +01:00
parent 7c99bcb942
commit b892674a3f
6 changed files with 55 additions and 62 deletions

View File

@ -42,7 +42,10 @@ const baseStatusSchema = v.object({
id: v.string(),
uri: v.fallback(v.pipe(v.string(), v.url()), ''),
created_at: v.fallback(datetimeSchema, new Date().toISOString()),
account: accountSchema,
account: v.pipe(v.unknown(), v.transform((account) => {
if ((window as any).__PL_API_FALLBACK_ACCOUNT && JSON.stringify(account) === '{}') return (window as any).__PL_API_FALLBACK_ACCOUNT;
return account;
}), accountSchema),
content: v.fallback(v.pipe(v.string(), v.transform((note => note === '<p></p>' ? '' : note))), ''),
visibility: v.fallback(v.string(), 'public'),
sensitive: v.pipe(v.unknown(), v.transform(Boolean)),