feed
This commit is contained in:
parent
066821583d
commit
700a232781
38
package-lock.json
generated
38
package-lock.json
generated
@ -17,6 +17,7 @@
|
||||
"fs": "^0.0.1-security",
|
||||
"hbs": "^4.2.0",
|
||||
"japanese-date-converter": "^2.0.0",
|
||||
"rss": "^1.2.2",
|
||||
"serve-index": "^1.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -1001,6 +1002,37 @@
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/rss": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/rss/-/rss-1.2.2.tgz",
|
||||
"integrity": "sha512-xUhRTgslHeCBeHAqaWSbOYTydN2f0tAzNXvzh3stjz7QDhQMzdgHf3pfgNIngeytQflrFPfy6axHilTETr6gDg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mime-types": "2.1.13",
|
||||
"xml": "1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/rss/node_modules/mime-db": {
|
||||
"version": "1.25.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.25.0.tgz",
|
||||
"integrity": "sha512-5k547tI4Cy+Lddr/hdjNbBEWBwSl8EBc5aSdKvedav8DReADgWJzcYiktaRIw3GtGC1jjwldXtTzvqJZmtvC7w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/rss/node_modules/mime-types": {
|
||||
"version": "2.1.13",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.13.tgz",
|
||||
"integrity": "sha512-ryBDp1Z/6X90UvjUK3RksH0IBPM137T7cmg4OgD5wQBojlAiUwuok0QeELkim/72EtcYuNlmbkrcGuxj3Kl0YQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mime-db": "~1.25.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
@ -1527,6 +1559,12 @@
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/xml": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
|
||||
"integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
"fs": "^0.0.1-security",
|
||||
"hbs": "^4.2.0",
|
||||
"japanese-date-converter": "^2.0.0",
|
||||
"rss": "^1.2.2",
|
||||
"serve-index": "^1.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
36
src/router/common_path_logic/update_log.js
Normal file
36
src/router/common_path_logic/update_log.js
Normal file
@ -0,0 +1,36 @@
|
||||
const { dirname } = require("path");
|
||||
const { readCsv } = require("../../utils/csv")
|
||||
const thisDirectory = dirname(require.main.filename);
|
||||
|
||||
async function getUpdates(){
|
||||
const csvData = await readCsv(thisDirectory + '/public/dynamic/sync/updates.csv')
|
||||
|
||||
const updates = []
|
||||
let currentYear = ""
|
||||
for (let i = csvData.length-1; i > -1; i--){
|
||||
const {date, description, link} = csvData[i]
|
||||
const codeDate = new Date(date)
|
||||
const updateYear = codeDate.getFullYear()
|
||||
const updateDayMonth = codeDate.getDay() + '/' + (codeDate.getMonth()+1)
|
||||
|
||||
if (updateYear !== currentYear){
|
||||
currentYear = updateYear
|
||||
updates.push({
|
||||
year: currentYear,
|
||||
updates: []
|
||||
})
|
||||
}
|
||||
updates[updates.length-1].updates.push({
|
||||
date,
|
||||
description,
|
||||
link,
|
||||
updateDayMonth
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
updates
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = getUpdates
|
@ -4,7 +4,8 @@ const router = express.Router();
|
||||
const { readCsv } = require('../utils/csv');
|
||||
const { dirname } = require('path');
|
||||
const thisDirectory = dirname(require.main.filename);
|
||||
const fs = require('fs')
|
||||
const fs = require('fs');
|
||||
const makeRss = require('../utils/rss');
|
||||
|
||||
function addPaths(path, renderParams = {}){
|
||||
let currentDefaultParams = {...renderParams}
|
||||
@ -72,6 +73,22 @@ router.post('/comment', (req, res) => {
|
||||
res.redirect('/home#visitor_table')
|
||||
})
|
||||
|
||||
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 {
|
||||
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
|
||||
})
|
||||
|
||||
setInterval(() => {
|
||||
recent_posters.forEach(poster => {
|
||||
|
13
src/utils/rss.js
Normal file
13
src/utils/rss.js
Normal file
@ -0,0 +1,13 @@
|
||||
const RSS = require("rss")
|
||||
|
||||
function makeRss(items, 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)
|
||||
}
|
||||
|
||||
module.exports = makeRss
|
@ -24,7 +24,8 @@
|
||||
<li class="red">Creator</li>
|
||||
<li class="red">Opinion</li>
|
||||
<li class="red"><strong>Art</strong></li>
|
||||
<li>Motivation</li>
|
||||
<li class="red"><strong>Technologies</strong></li>
|
||||
<li>Motivation</li>ç
|
||||
<li class="red">Community</li>
|
||||
<li class="red"><strong>Toxic</strong></li>
|
||||
<li class="red">Views</li>
|
||||
@ -34,6 +35,7 @@
|
||||
<li class="red"><strong>Develop</strong></li>
|
||||
<li class="red">Saturated</li>
|
||||
<li>Right</li>
|
||||
<li>Left</li>
|
||||
<li class="red">Life</li>
|
||||
<li class="red">Tweet</li>
|
||||
<li>Obscure</li>
|
||||
@ -50,6 +52,7 @@
|
||||
<li class="red">Yikes</li>
|
||||
<li class="red">Project</li>
|
||||
<li>Idea</li>
|
||||
<li class="red">Pibes/Pibas</li>
|
||||
<li class="red"><strong>Identity</strong></li>
|
||||
<li class="red">Global</li>
|
||||
<li class="red">Emotional</li>
|
||||
|
@ -11,7 +11,7 @@
|
||||
{{/if}}
|
||||
{{#if rating}}
|
||||
{{#ifEquals rating "FAV"}}
|
||||
<img src="/public/images/assets/kiki_small_floating_head.png">
|
||||
<img align="center" src="/public/images/assets/kiki_small_floating_head.png">
|
||||
{{else}}
|
||||
{{rating}}
|
||||
{{/ifEquals}}
|
||||
@ -20,6 +20,7 @@
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
<h3>Total: {{animeList.length}}</h3>
|
||||
<hr>
|
||||
<h2>VN and vidya</h2>
|
||||
<ul>
|
||||
@ -33,6 +34,7 @@
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
<h3>Total: {{vnList.length}}</h3>
|
||||
<hr>
|
||||
{{>lyrics lyrics="常識という眼鏡で<br>
|
||||
僕たちの世界は のぞけやしないのさ<br>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<main>
|
||||
<h2>2024</h2>
|
||||
{{!-- <h2>2024</h2>
|
||||
<ul>
|
||||
<li>5/12 <a href="/home#visitor_table">This has to be a good idea...</a></li>
|
||||
<li>4/12 <a href="/home">Lyrical Tokarev is now under martial rule!</a></li>
|
||||
@ -13,7 +13,26 @@
|
||||
<li>29/10 Halloween Edition (truest fear has been known)</li>
|
||||
<li>5/10 真 Lyrical Tokarev is born.</li>
|
||||
<li>29/8 Lyrical Tokarev dies.</li>
|
||||
</ul> --}}
|
||||
|
||||
<a href="update_log/rss">RSS Feed</a>
|
||||
|
||||
{{#each updates}}
|
||||
<h2>{{year}}</h2>
|
||||
<ul>
|
||||
{{#each updates}}
|
||||
<li>
|
||||
{{updateDayMonth}}
|
||||
{{#if link}}
|
||||
<a href="{{link}}">{{description}}</a>
|
||||
{{else}}
|
||||
{{description}}
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{/each}}
|
||||
|
||||
<h2>2022</h2>
|
||||
<ul>
|
||||
<li>???/12 Lyrical Tokarev is born.</li>
|
||||
|
Loading…
Reference in New Issue
Block a user