Merge remote-tracking branch 'refs/remotes/origin/master'

This commit is contained in:
simio 2024-12-08 04:53:37 -03:00
commit 2ae4f5d04e
9 changed files with 139 additions and 7 deletions

38
package-lock.json generated
View File

@ -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"
}
}
}

View File

@ -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": {

View File

@ -4,7 +4,9 @@ const rootDir = dirname(require.main.filename);
module.exports = async (req, res) => {
try{
const commentsRead = (await readCsv(rootDir + '/public/dynamic/sync/comments.csv'))
const commentsRead = (await readCsv(rootDir + '/public/dynamic/sync/comments.csv')).filter(c => {
return c.approved === "1"
})
const comments = commentsRead.slice(commentsRead.length-16, commentsRead.length).reverse()
return {
comments

View 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

View File

@ -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}
@ -69,11 +70,26 @@ router.post('/comment', (req, res) => {
timeout: 3600
})
const comment = req.body.comment.replace(/"/g, '""');
fs.appendFileSync(thisDirectory + "/public/dynamic/sync/comments.csv", `\n${Date.now()},"${comment}",,1`)
fs.appendFileSync(thisDirectory + "/public/dynamic/sync/comments.csv", `\n${Date.now()},"${comment}",,0`)
res.redirect('/home#visitor_table')
})
router.get('/update_log/rss', async (_req, res) => {
const csvData = await readCsv(thisDirectory + '/public/dynamic/sync/updates.csv')
const rss = makeRss('https://lyricaltokarev.com/update_log/rss', "Update Log")
csvData.forEach((u, i) => {
rss.item({
title: "Update #" + i,
description: `${u.link && `<a href="${u.link}">`}${u.description}${u.link && `</a>`}`,
author: "Gor Down",
date: u.date
})
})
const xml = rss.xml({indent: true})
res.setHeader('Content-Type', 'text/xml');
res.send(xml)
})
setInterval(() => {
recent_posters.forEach(poster => {

13
src/utils/rss.js Normal file
View File

@ -0,0 +1,13 @@
const RSS = require("rss")
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)"
})
}
module.exports = makeRss

View File

@ -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>
@ -187,6 +190,9 @@
<table cellpadding="10" class="navigation_table" border="1">
<tbody align="center">
<tr>
<td colspan="4"><a href="/update_log">Update Log</a></td>
</tr>
<tr>
<td rowspan="2" width="200">
<img alt="Note" src="/public/images/icons/note.png"><br>
@ -194,7 +200,6 @@
<ul>
<li><a href="/lists/anime">Anime/"VN" List</a></li>
<li><a href="/lists/sites">Websites</a></li>
<li><a href="/update_log">Update Log</a></li>
</ul>
<hr>
<br>

View File

@ -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>

View File

@ -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">Updates RSS</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>