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

View File

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