CJ_Clippy 69310e8229
Some checks failed
ci / test (push) Failing after 12m59s
fp/our CI/CD / build (push) Successful in 1m18s
fix rss
2025-11-14 18:18:07 -08:00

55 lines
1.6 KiB
Plaintext

<%#
index.ejs — RSS Feed Generator (RSS 2.0)
Expects: data.vods = [{ id, title, notes, thumbnail, streamDate }]
%>
<%
response.header("Content-Type", "application/rss+xml")
// Build RSS XML as a string
let rss = `<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>Futureporn.net VODs</title>
<link>https://futureporn.net</link>
<description>Dedication to the preservaton of lewdtuber history</description>
<lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
<docs>https://validator.w3.org/feed/docs/rss2.html</docs>
<generator>pocketpages</generator>
<language>en</language>
<image>
<title>Futureporn.net</title>
<url>https://futureporn.net/images/futureporn-icon.png</url>
<link>https://futureporn.net</link>
</image>`;
for (const vod of data.vods) {
const url = `${env('ORIGIN')}/vods/${vod.id}`;
rss += `
<item>
<title><![CDATA[${
((vod?.get('expand')?.vtubers?.map(vt => vt.get('displayName')) || []).join(', ')
|| vod.get('streamDate'))
}]]></title>
<link>${url}</link>
<guid>${url}</guid>
<pubDate>${new Date(vod.get('streamDate')).toUTCString()}</pubDate>`;
if (vod.get('notes')) {
rss += `
<description><![CDATA[${vod.get('notes')}]]></description>`;
}
if (vod.get('thumbnail')) {
rss += `<image_link>${env('ORIGIN')}/api/files/vods/${vod.get('id')}/${vod.get('thumbnail')}</image_link>`
}
rss += `
</item>`;
}
rss += `
</channel>
</rss>`;
// Send the RSS
response.html(200, rss);
%>