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", "name": "futureporn",
"version": "3.3.4", "version": "3.4.0",
"private": true, "private": true,
"description": "Dedication to the preservation of lewdtuber history", "description": "Dedication to the preservation of lewdtuber history",
"license": "Unlicense", "license": "Unlicense",

View File

@ -75,7 +75,9 @@
</p> </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> </div>
</footer> </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,58 +1,53 @@
<%# <%#
index.ejs — ATOM Feed Generator 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"); response.header("Content-Type", "application/atom+xml");
// Build Atom XML as a string // Build Atom XML as a string
let atom = `<?xml version="1.0" encoding="utf-8"?> let atom = `<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"> <feed xmlns="http://www.w3.org/2005/Atom">
<title>Futureporn.net</title> <title>Futureporn.net VODs</title>
<link href="<%= env('ORIGIN') %>"/> <link href="${env('ORIGIN')}" />
<updated>${new Date().toISOString()}</updated> <updated>${new Date().toISOString()}</updated>
<id><%= env('ORIGIN') %></id> <id>${env('ORIGIN')}</id>
<author> <author>
<name>CJ_Clippy</name> <name>CJ_Clippy</name>
<email>cj@futureporn.net</email> <email>cj@futureporn.net</email>
</author>`; </author>`;
for (const vod of data.vods) { for (const vod of data.vods) {
const url = `${env('ORIGIN')}/vods/${vod.id}`; const url = `${env('ORIGIN')}/vods/${vod.get('id')}`;
const entryTitle = ((vod?.get('expand')?.vtubers?.map(vt => vt.get('displayName')) || []) const entryTitle = ((vod?.expand?.vtubers?.map(vt => vt.displayName) || []).join(', ')
.join(', ') || vod.get('streamDate')); || vod.get('streamDate'));
atom += ` atom += `
<entry> <entry>
<title> <title><![CDATA[${((vod?.get('expand')?.vtubers?.map(vt => vt.get('displayName')) || []).join(', ')
<![CDATA[${entryTitle}]]> || vod.get('streamDate'))}]]></title>
</title>
<link href="${url}" /> <link href="${url}" />
<id>${url}</id> <id>${url}</id>
<updated>${vod.get('streamDate')}</updated>`; <updated>${vod.get('updated')}</updated>`;
if (vod.get('notes')) { if (vod.get('notes')) {
atom += ` atom += `
<summary type="html"> <summary type="html"><![CDATA[${vod.get('notes')}]]></summary>`;
<![CDATA[${vod.get('notes')}]]>
</summary>`;
} }
if (vod.get('thumbnail')) { if (vod.get('thumbnail')) {
atom += ` atom += `
<content type="image"> <content type="image"><![CDATA[<img src="${env('ORIGIN')}/api/files/vods/${vod.get('id')}/${vod.get('thumbnail')}" />]]></content>`;
<![CDATA[<img src="${vod.get('thumbnail')}" />]]>
</content>`;
} }
atom += ` atom += `
</entry>`; </entry>`;
} }
atom += ` atom += `
</feed>`; </feed>`;
// Send the 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"?> 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/"> <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel> <channel>
<title>Futureporn.net</title> <title>Futureporn.net VODs</title>
<link>https://futureporn.net</link> <link>https://futureporn.net</link>
<description>Dedication to the preservaton of lewdtuber history</description> <description>Dedication to the preservaton of lewdtuber history</description>
<lastBuildDate>${new Date().toUTCString()}</lastBuildDate> <lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
<docs>https://validator.w3.org/feed/docs/rss2.html</docs> <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
<generator> </generator> <generator>pocketpages</generator>
<language>en</language> <language>en</language>
<image> <image>
<title>Futureporn.net</title> <title>Futureporn.net</title>
@ -34,14 +34,13 @@ for (const vod of data.vods) {
}]]></title> }]]></title>
<link>${url}</link> <link>${url}</link>
<guid>${url}</guid> <guid>${url}</guid>
<pubDate>${vod.get('streamDate')}</pubDate>`; <pubDate>${new Date(vod.get('streamDate')).toUTCString()}</pubDate>`;
if (vod.notes) { if (vod.get('notes')) {
rss += ` rss += `
<description><![CDATA[${vod.notes}]]></description>`; <description><![CDATA[${vod.get('notes')}]]></description>`;
} }
if (vod.thumbnail) { if (vod.get('thumbnail')) {
rss += ` rss += `<image_link>${env('ORIGIN')}/api/files/vods/${vod.get('id')}/${vod.get('thumbnail')}</image_link>`
<enclosure url="${vod.thumbnail}" length="0" type="image/png" />`;
} }
rss += ` rss += `
</item>`; </item>`;