lets gooo
This commit is contained in:
parent
eee5c8c359
commit
48c2cf7f32
8
app.js
8
app.js
@ -9,7 +9,13 @@ const publicPath = "/public"
|
|||||||
const inUrlPath = "public"
|
const inUrlPath = "public"
|
||||||
|
|
||||||
|
|
||||||
app.engine('.hbs', engine({extname: '.hbs'}));
|
app.engine('.hbs', engine({extname: '.hbs', helpers: {
|
||||||
|
ifDivisibleBy: function (index, divisor, options) {
|
||||||
|
if (index % divisor === 0) {
|
||||||
|
return options.fn(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}));
|
||||||
app.set('view engine', '.hbs');
|
app.set('view engine', '.hbs');
|
||||||
|
|
||||||
app.use(publicPath, express.static(inUrlPath), serveIndex(inUrlPath, {
|
app.use(publicPath, express.static(inUrlPath), serveIndex(inUrlPath, {
|
||||||
|
4
public/styles/lists/sites/index.css
Normal file
4
public/styles/lists/sites/index.css
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.archive{
|
||||||
|
font-size: 11px;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
@ -1,21 +1,29 @@
|
|||||||
|
:root{
|
||||||
|
--celeste: #20d6c7;
|
||||||
|
}
|
||||||
|
|
||||||
body{
|
body{
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
background-color: black;
|
background-color: black;
|
||||||
color: #20d6c7;
|
color: var(--celeste);
|
||||||
font-family: "Junicode";
|
font-family: "Junicode";
|
||||||
image-rendering: pixelated;
|
image-rendering: pixelated;
|
||||||
}
|
}
|
||||||
|
|
||||||
p{
|
p{
|
||||||
color: white
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
a{
|
||||||
|
color: var(--celeste);
|
||||||
}
|
}
|
||||||
|
|
||||||
hr{
|
hr{
|
||||||
display: block;
|
display: block;
|
||||||
height: 1px;
|
height: 1px;
|
||||||
border: 0;
|
border: 0;
|
||||||
border-top: 1px solid #20d6c7;
|
border-top: 1px solid var(--celeste);
|
||||||
margin: 1em 0;
|
margin: 1em 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
@ -1,23 +1,54 @@
|
|||||||
const express = require('express');
|
|
||||||
const createCommonPath = require('../utils/createCommonPath');
|
const createCommonPath = require('../utils/createCommonPath');
|
||||||
|
const express = require('express');
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const { readCsv } = require('../utils/csv');
|
const { readCsv } = require('../utils/csv');
|
||||||
const { dirname } = require('path');
|
const { dirname } = require('path');
|
||||||
const appDir = dirname(require.main.filename);
|
const appDir = dirname(require.main.filename);
|
||||||
|
|
||||||
createCommonPath(router, '/', "home", {
|
createCommonPath(router, '/', {view: "home"})
|
||||||
stylesheet: '/public/styles/home/home.css'
|
|
||||||
})
|
|
||||||
|
|
||||||
router.get('/lists/anime', async (_req, res) => {
|
createCommonPath(router, 'lists/anime', {title: "Anime List"}, async (req, res) => {
|
||||||
try{
|
try{
|
||||||
const animeList = await readCsv(appDir + '/public/dynamic/sync/media_list/anime.csv')
|
const animeList = await readCsv(appDir + '/public/dynamic/sync/media_list/anime.csv')
|
||||||
const vnList = await readCsv(appDir + '/public/dynamic/sync/media_list/vn_vidya.csv')
|
const vnList = await readCsv(appDir + '/public/dynamic/sync/media_list/vn_vidya.csv')
|
||||||
res.render('lists/anime', {
|
return {
|
||||||
animeList,
|
animeList,
|
||||||
vnList,
|
vnList
|
||||||
title: "Anime List"
|
}
|
||||||
|
}
|
||||||
|
catch(err){
|
||||||
|
console.error(err)
|
||||||
|
res.send("Mistakes were made")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
createCommonPath(router, 'lists/sites', {title: "Site List"}, async (_req, res) => {
|
||||||
|
try{
|
||||||
|
const siteList = await readCsv(appDir + '/public/dynamic/sync/sites.csv')
|
||||||
|
const categoryList = await readCsv(appDir + '/public/dynamic/sync/sites_category.csv')
|
||||||
|
|
||||||
|
const categoriesAndSites = {}
|
||||||
|
|
||||||
|
for(i in siteList){
|
||||||
|
const site = siteList[i]
|
||||||
|
for (j in categoryList){
|
||||||
|
const cat = categoryList[j]
|
||||||
|
if (cat.id === site.id_category){
|
||||||
|
if (!categoriesAndSites.hasOwnProperty(cat.name)) categoriesAndSites[cat.name] = {
|
||||||
|
...cat,
|
||||||
|
sites: [site]
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
categoriesAndSites[cat.name].sites.push(site)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
categoriesAndSites
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(err){
|
catch(err){
|
||||||
console.error(err)
|
console.error(err)
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
function createCommonPath(router, path, view = path, render_parameters = {}){
|
function createCommonPath(router, path, renderParams = {
|
||||||
router.get(path, (req, res) => {
|
}, cb = () => {}){
|
||||||
res.render(view, render_parameters)
|
router.get('/' + path, async (req, res) => {
|
||||||
|
const defaultParams = {
|
||||||
|
view: path,
|
||||||
|
}
|
||||||
|
const split_path = defaultParams.view.split('/')
|
||||||
|
const default_name = split_path[split_path.length-1]
|
||||||
|
defaultParams.name = default_name
|
||||||
|
defaultParams.stylesheet = !renderParams.view ? '/public/styles/' + defaultParams.view + '/index' + '.css' : '/public/styles/' + renderParams.view + '/index' + '.css'
|
||||||
|
let renderOptions = {...defaultParams, ...renderParams}
|
||||||
|
const cb_params = await cb(req, res)
|
||||||
|
renderOptions = {...renderOptions, ...cb_params}
|
||||||
|
res.render(renderOptions.view, renderOptions)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
<p>Cut the umbilical cord.</p>
|
<p>Cut the umbilical cord.</p>
|
||||||
<a href="https://spyware.neocities.org/articles/discord"><img src="/public/images/buttons/discord-no-way.gif"></a>
|
<a href="https://spyware.neocities.org/articles/discord"><img src="/public/images/buttons/discord-no-way.gif"></a>
|
||||||
<p>Back to the holy land.</p>
|
<p>Back to the holy land.</p>
|
||||||
<a href="https://koshka.love/irc/comic-chat.html"><img title="Kiki threatens to shoot Kurogami in case her demands aren't met." id="cc" src="/public/images/comicchat.png"></a><br>
|
<a href="https://cidoku.net/stuff/cchat/"><img title="Kiki threatens to shoot Kurogami in case her demands aren't met." id="cc" src="/public/images/comicchat.png"></a><br>
|
||||||
<a href="/public/cchat/"><img class="folder" src="/public/images/icons/folder/folder_file_kiki_small_head.png"><br>CC files</a>
|
<a href="/public/cchat/"><img class="folder" src="/public/images/icons/folder/folder_file_kiki_small_head.png"><br>CC files</a>
|
||||||
<hr>
|
<hr>
|
||||||
<h2>YuugenMagan</h2>
|
<h2>YuugenMagan</h2>
|
||||||
|
29
views/lists/sites.hbs
Normal file
29
views/lists/sites.hbs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<body>
|
||||||
|
<center>
|
||||||
|
<table>
|
||||||
|
{{#each categoriesAndSites}}
|
||||||
|
{{#ifDivisibleBy @index 2}}
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
{{/ifDivisibleBy}}
|
||||||
|
<td>
|
||||||
|
<h2>{{name}}</h2>
|
||||||
|
<ul>
|
||||||
|
{{#each sites}}
|
||||||
|
<li>
|
||||||
|
<a href="{{link}}">{{name}}</a> <a class="archive" href="#">[archive]</a>
|
||||||
|
{{#if image}}
|
||||||
|
<br>
|
||||||
|
<a href="{{link}}"><img src="/public/dynamic/sync/buttons/{{image}}"></a>
|
||||||
|
{{/if}}
|
||||||
|
{{#if description}}
|
||||||
|
<span>{{description}}</span>
|
||||||
|
{{/if}}
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</td>
|
||||||
|
</ul>
|
||||||
|
{{/each}}
|
||||||
|
</table>
|
||||||
|
</center>
|
||||||
|
</body>
|
Loading…
Reference in New Issue
Block a user