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

53 lines
1.4 KiB
Plaintext

<%#
index.ejs — ATOM Feed Generator
Expects: data.vods = [{ id, title, notes, thumbnail, streamDate, expand }]
%>
<%
response.header("Content-Type", "application/atom+xml");
// Build Atom XML as a string
let atom = `<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Futureporn.net VODs</title>
<link href="${env('ORIGIN')}" />
<updated>${new Date().toISOString()}</updated>
<id>${env('ORIGIN')}</id>
<author>
<name>CJ_Clippy</name>
<email>cj@futureporn.net</email>
</author>`;
for (const vod of data.vods) {
const url = `${env('ORIGIN')}/vods/${vod.get('id')}`;
const entryTitle = ((vod?.expand?.vtubers?.map(vt => vt.displayName) || []).join(', ')
|| vod.get('streamDate'));
atom += `
<entry>
<title><![CDATA[${((vod?.get('expand')?.vtubers?.map(vt => vt.get('displayName')) || []).join(', ')
|| vod.get('streamDate'))}]]></title>
<link href="${url}" />
<id>${url}</id>
<updated>${vod.get('updated')}</updated>`;
if (vod.get('notes')) {
atom += `
<summary type="html"><![CDATA[${vod.get('notes')}]]></summary>`;
}
if (vod.get('thumbnail')) {
atom += `
<content type="image"><![CDATA[<img src="${env('ORIGIN')}/api/files/vods/${vod.get('id')}/${vod.get('thumbnail')}" />]]></content>`;
}
atom += `
</entry>`;
}
atom += `
</feed>`;
// Send the Atom feed
response.html(200, atom);
%>