2025-11-05 20:49:00 -09:00

58 lines
1.2 KiB
Plaintext

<%#
index.ejs — ATOM Feed Generator
Expects: data.vods = [{ id, title, notes, thumbnail, streamDate }]
%>
<%=
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</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.id}`;
const entryTitle = ((vod?.get('expand')?.vtubers?.map(vt => vt.get('displayName')) || [])
.join(', ') || vod.get('streamDate'));
atom += `
<entry>
<title>
<![CDATA[${entryTitle}]]>
</title>
<link href="${url}" />
<id>${url}</id>
<updated>${vod.get('streamDate')}</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="${vod.get('thumbnail')}" />]]>
</content>`;
}
atom += `
</entry>`;
}
atom += `
</feed>`;
// Send the Atom feed
response.html(200, '<p>HELLO</p>');
%>