import { html } from 'hono/html'; import type { FC } from 'hono/jsx'; import type { Data } from '@/types'; import { getItemAttachments } from '@/utils/attachments'; const Link: FC> = (props) => html` value !== undefined) .map(([name, value]) => html` ${name}="${value}"`)} />`; const RSS: FC<{ data: Data }> = ({ data }) => ( {html`${data.title || 'RSSHub'}`} {data.id || data.link} {data.description || data.title} - Powered by RSSHub RSSHub {new Date(data.lastBuildDate || new Date()).toISOString()} {data.author || 'RSSHub'} {data.icon && {data.icon}} {data.logo && {data.logo}} {data.item?.map((item) => ( {html`${item.title}`} {item.description ? {item.description} : item.content?.text ? {item.content.text} : } {getItemAttachments(item).map((attachment) => ( ))} {item.guid || item.link || item.title} {item.pubDate && {new Date(item.pubDate).toISOString()}} {new Date(item.updated || item.pubDate || new Date()).toISOString()} {item.summary && {item.summary}} {item.author && ( {item.author} )} {item.category !== undefined && (Array.isArray(item.category) ? item.category : [item.category]).map((c) => )} {item.media && Object.entries(item.media).map(([key, value]) => { const Tag = `media:${key}`; return ; })} {item.upvotes ? {item.upvotes} : ''} {item.downvotes ? {item.downvotes} : ''} {item.comments ? {item.comments} : ''} ))} ); export default RSS;