This commit is contained in:
simio 2024-12-06 18:54:58 -03:00
parent 3172e4a941
commit a5be22611e
2 changed files with 11 additions and 13 deletions

View File

@ -75,19 +75,19 @@ router.post('/comment', (req, res) => {
router.get('/update_log/rss', async (_req, res) => {
const csvData = await readCsv(thisDirectory + '/public/dynamic/sync/updates.csv')
const rssMappedUpdates = csvData.map((u, i) => {
return {
const rss = makeRss('https://lyricaltokarev.com/update_log/rss', "Update Log")
csvData.reverse().forEach((u, i) => {
rss.item({
title: "Update #" + i,
description: u.description,
author: "Gor Down",
pubDate: u.date,
}
}).reverse()
const rss = makeRss(rssMappedUpdates, 'https://lyricaltokarev.com/update_log/rss', "Update Log")
res.send(rss)
return rss
date: u.date,
url: u.link ? u.link : 'https://lyricaltokarev.com/home'
})
})
const xml = rss.xml({indent: true})
res.setHeader('Content-Type', 'text/xml');
res.send(xml)
})
setInterval(() => {

View File

@ -1,14 +1,12 @@
const RSS = require("rss")
function makeRss(items, feed_link, name, description, link){
function makeRss(feed_link, name, description, link){
return new RSS({
title: `Lyrical Tokarev${name ? ` ~ ${name}` : ""}`,
site_url: link ? link : "https://lyricaltokarev.com/home",
feed_url: feed_link,
description: description ? description : "Anime site.",
managingEditor: "gor@lyricaltokarev.com (Gor Down)"
}, items).xml({
indent: true
})
}