fix rss
Some checks failed
ci / test (push) Failing after 12m59s
fp/our CI/CD / build (push) Successful in 1m18s

This commit is contained in:
CJ_Clippy 2025-11-14 18:18:07 -08:00
parent 17ea5c3336
commit 69310e8229
9 changed files with 37 additions and 198 deletions

View File

@ -1,6 +1,6 @@
{
"name": "futureporn",
"version": "3.3.4",
"version": "3.4.0",
"private": true,
"description": "Dedication to the preservation of lewdtuber history",
"license": "Unlicense",

View File

@ -75,7 +75,9 @@
</p>
<div class="notification is-warning">A lot of things are broken right now and may not work. Please check back again soon.</div>
<div class="container">
<div class="notification is-info">Hello World</div>
</div>
</div>
</footer>

View File

@ -1,26 +0,0 @@
// +load.js
/** @type {import('pocketpages').PageDataLoaderFunc} */
module.exports = function (api) {
const { params, response } = api;
try {
const vods = $app.findRecordsByFilter('vods', null, '-streamDate');
$app.expandRecords(vods, ["vtubers"], null);
// vods.expandedAll("vtubers");
return { vods };
} catch (e) {
console.error('error!', e.message);
if (e.message.match(/no rows/)) {
console.log('we are sending 404')
return response.html(404, 'VODs not found')
} else {
console.log('we are sending error 500')
return response.html(500, 'Unknown internal error while fetching vods')
}
}
};

View File

@ -1,50 +0,0 @@
<%#
index.ejs — Atom Feed Generator (Atom 1.0)
Expects: data.vods = [{ id, title, summary, streamDate }]
%>
<%
const siteBase = "https://futureporn.net";
const feedSelf = `${siteBase}/vods/feed.xml`;
const updated = new Date().toISOString();
response.header('Content-Type', 'application/atom+xml')
%>
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<id><%= siteBase %></id>
<title>Futureporn.net</title>
<updated><%= updated %></updated>
<generator> </generator>
<author>
<name>CJ_Clippy</name>
<email>cj@futureporn.net</email>
<uri><%= siteBase %></uri>
</author>
<link rel="alternate" href="<%= siteBase %>" />
<link rel="self" href="<%= feedSelf %>" />
<subtitle><%= meta('description') %></subtitle>
<logo><%= siteBase %>/images/futureporn-icon.png</logo>
<icon><%= siteBase %>/favicon.ico</icon>
<% for (const vod of data.vods) { %>
<%
const url = `${siteBase}/vods/${vod.id}`;
%>
<entry>
<title type="html">
<![CDATA[ <%= vod.title %> ]]>
</title>
<id><%= url %></id>
<link href="<%= url %>" />
<updated><%= new Date(vod.updated) %></updated>
<% if (vod.notes) { %>
<summary type="html">
<![CDATA[ <%= vod.notes %> ]]>
</summary>
<% } %>
</entry>
<% } %>
</feed>

View File

@ -1,25 +0,0 @@
// +load.js
/** @type {import('pocketpages').PageDataLoaderFunc} */
module.exports = function (api) {
const { params, response } = api;
try {
const vods = $app.findRecordsByFilter('vods', null, '-streamDate', 25);
$app.expandRecords(vods, ["vtubers"], null);
return { vods };
} catch (e) {
console.error('error!', e.message);
if (e.message.match(/no rows/)) {
console.log('we are sending 404')
return response.html(404, 'VODs not found')
} else {
console.log('we are sending error 500')
return response.html(500, 'Unknown internal error while fetching vods')
}
}
};

View File

@ -1,28 +0,0 @@
// +load.js
/** @type {import('pocketpages').PageDataLoaderFunc} */
module.exports = function (api) {
const { params, response } = api;
try {
const vods = $app.findRecordsByFilter('vods', null, '-streamDate', 99);
$app.expandRecords(vods, ["vtubers"], null);
console.log(JSON.stringify(vods, null, 2))
return { vods };
} catch (e) {
console.error('error!', e.message);
if (e.message.match(/no rows/)) {
console.log('we are sending 404')
return response.html(404, 'VODs not found')
} else {
console.log('we are sending error 500')
return response.html(500, 'Unknown internal error while fetching vods')
}
}
};

View File

@ -1,49 +1,44 @@
<%#
index.ejs — ATOM Feed Generator
Expects: data.vods = [{ id, title, notes, thumbnail, streamDate }]
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</title>
<link href="<%= env('ORIGIN') %>"/>
<title>Futureporn.net VODs</title>
<link href="${env('ORIGIN')}" />
<updated>${new Date().toISOString()}</updated>
<id><%= env('ORIGIN') %></id>
<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'));
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[${entryTitle}]]>
</title>
<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('streamDate')}</updated>`;
<updated>${vod.get('updated')}</updated>`;
if (vod.get('notes')) {
atom += `
<summary type="html">
<![CDATA[${vod.get('notes')}]]>
</summary>`;
<summary type="html"><![CDATA[${vod.get('notes')}]]></summary>`;
}
if (vod.get('thumbnail')) {
atom += `
<content type="image">
<![CDATA[<img src="${vod.get('thumbnail')}" />]]>
</content>`;
<content type="image"><![CDATA[<img src="${env('ORIGIN')}/api/files/vods/${vod.get('id')}/${vod.get('thumbnail')}" />]]></content>`;
}
atom += `
@ -54,5 +49,5 @@ atom += `
</feed>`;
// Send the Atom feed
response.html(200, '<p>HELLO</p>');
response.html(200, atom);
%>

View File

@ -1,28 +0,0 @@
// +load.js
/** @type {import('pocketpages').PageDataLoaderFunc} */
module.exports = function (api) {
const { params, response } = api;
try {
const vods = $app.findRecordsByFilter('vods', null, '-streamDate', 99);
$app.expandRecords(vods, ["vtubers"], null);
console.log(JSON.stringify(vods, null, 2))
return { vods };
} catch (e) {
console.error('error!', e.message);
if (e.message.match(/no rows/)) {
console.log('we are sending 404')
return response.html(404, 'VODs not found')
} else {
console.log('we are sending error 500')
return response.html(500, 'Unknown internal error while fetching vods')
}
}
};

View File

@ -10,12 +10,12 @@ response.header("Content-Type", "application/rss+xml")
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</title>
<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> </generator>
<generator>pocketpages</generator>
<language>en</language>
<image>
<title>Futureporn.net</title>
@ -34,14 +34,13 @@ for (const vod of data.vods) {
}]]></title>
<link>${url}</link>
<guid>${url}</guid>
<pubDate>${vod.get('streamDate')}</pubDate>`;
if (vod.notes) {
<pubDate>${new Date(vod.get('streamDate')).toUTCString()}</pubDate>`;
if (vod.get('notes')) {
rss += `
<description><![CDATA[${vod.notes}]]></description>`;
<description><![CDATA[${vod.get('notes')}]]></description>`;
}
if (vod.thumbnail) {
rss += `
<enclosure url="${vod.thumbnail}" length="0" type="image/png" />`;
if (vod.get('thumbnail')) {
rss += `<image_link>${env('ORIGIN')}/api/files/vods/${vod.get('id')}/${vod.get('thumbnail')}</image_link>`
}
rss += `
</item>`;