🐛 Fix issue with rss widget

This commit is contained in:
Meier Lukas
2023-06-10 20:54:53 +02:00
parent afaaa1b346
commit 5021e8ed35

View File

@@ -1,13 +1,13 @@
import { z } from 'zod'; import { TRPCError } from '@trpc/server';
import RssParser from 'rss-parser';
import Consola from 'consola'; import Consola from 'consola';
import { decode, encode } from 'html-entities'; import { decode, encode } from 'html-entities';
import RssParser from 'rss-parser';
import xss from 'xss'; import xss from 'xss';
import { TRPCError } from '@trpc/server'; import { z } from 'zod';
import { createTRPCRouter, publicProcedure } from '../trpc';
import { Stopwatch } from '~/tools/shared/time/stopwatch.tool';
import { getConfig } from '~/tools/config/getConfig'; import { getConfig } from '~/tools/config/getConfig';
import { Stopwatch } from '~/tools/shared/time/stopwatch.tool';
import { IRssWidget } from '~/widgets/rss/RssWidgetTile'; import { IRssWidget } from '~/widgets/rss/RssWidgetTile';
import { createTRPCRouter, publicProcedure } from '../trpc';
type CustomItem = { type CustomItem = {
'media:content': string; 'media:content': string;
@@ -37,7 +37,7 @@ const rssFeedResultObjectSchema = z
categories: z.array(z.string()).or(z.undefined()), categories: z.array(z.string()).or(z.undefined()),
title: z.string(), title: z.string(),
content: z.string(), content: z.string(),
pubDate: z.string(), pubDate: z.string().optional(),
}) })
), ),
}), }),
@@ -73,6 +73,7 @@ export const rssRouter = createTRPCRouter({
getFeedUrl(feedUrl, rssWidget.properties.dangerousAllowSanitizedItemContent) getFeedUrl(feedUrl, rssWidget.properties.dangerousAllowSanitizedItemContent)
) )
); );
return result; return result;
}), }),
}); });
@@ -138,7 +139,7 @@ const processItemContent = (content: string, dangerousAllowSanitizedItemContent:
strong: [], strong: [],
i: [], i: [],
em: [], em: [],
img: ['src', 'width', 'height'], img: ['src', 'width', 'height', 'alt'],
br: [], br: [],
small: [], small: [],
ul: [], ul: [],