mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-14 09:25:47 +01:00
fix: umlaute in RSS (#1755)
This commit is contained in:
@@ -39,10 +39,10 @@ const rssFeedResultObjectSchema = z
|
|||||||
title: z.string(),
|
title: z.string(),
|
||||||
content: z.string(),
|
content: z.string(),
|
||||||
pubDate: z.string().optional(),
|
pubDate: z.string().optional(),
|
||||||
})
|
}),
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
export const rssRouter = createTRPCRouter({
|
export const rssRouter = createTRPCRouter({
|
||||||
@@ -52,7 +52,7 @@ export const rssRouter = createTRPCRouter({
|
|||||||
widgetId: z.string().uuid(),
|
widgetId: z.string().uuid(),
|
||||||
feedUrls: z.array(z.string()),
|
feedUrls: z.array(z.string()),
|
||||||
configName: z.string(),
|
configName: z.string(),
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
.output(z.array(rssFeedResultObjectSchema))
|
.output(z.array(rssFeedResultObjectSchema))
|
||||||
.query(async ({ input }) => {
|
.query(async ({ input }) => {
|
||||||
@@ -75,8 +75,8 @@ export const rssRouter = createTRPCRouter({
|
|||||||
|
|
||||||
const result = await Promise.all(
|
const result = await Promise.all(
|
||||||
input.feedUrls.map(async (feedUrl) =>
|
input.feedUrls.map(async (feedUrl) =>
|
||||||
getFeedUrl(feedUrl, rssWidget.properties.dangerousAllowSanitizedItemContent)
|
getFeedUrl(feedUrl, rssWidget.properties.dangerousAllowSanitizedItemContent),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -106,11 +106,11 @@ const getFeedUrl = async (feedUrl: string, dangerousAllowSanitizedItemContent: b
|
|||||||
title: item.title ? decode(item.title) : undefined,
|
title: item.title ? decode(item.title) : undefined,
|
||||||
content: processItemContent(
|
content: processItemContent(
|
||||||
item['content:encoded'] ?? item.content,
|
item['content:encoded'] ?? item.content,
|
||||||
dangerousAllowSanitizedItemContent
|
dangerousAllowSanitizedItemContent,
|
||||||
),
|
),
|
||||||
enclosure: createEnclosure(item),
|
enclosure: createEnclosure(item),
|
||||||
link: createLink(item),
|
link: createLink(item),
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
.sort((a: { pubDate: number }, b: { pubDate: number }) => {
|
.sort((a: { pubDate: number }, b: { pubDate: number }) => {
|
||||||
if (!a.pubDate || !b.pubDate) {
|
if (!a.pubDate || !b.pubDate) {
|
||||||
@@ -159,7 +159,9 @@ const processItemContent = (content: string, dangerousAllowSanitizedItemContent:
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return encode(content);
|
return encode(content, {
|
||||||
|
level: "html5"
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const createLink = (item: any) => {
|
const createLink = (item: any) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user