add guestbook
This commit is contained in:
parent
60d4a477bd
commit
9aa8365c2e
|
@ -0,0 +1,3 @@
|
||||||
|
async function handler(req, res, next) {
|
||||||
|
|
||||||
|
}
|
12
index.js
12
index.js
|
@ -8,14 +8,12 @@ const session = require('express-session');
|
||||||
const cookie_parse = require('cookie-parser');
|
const cookie_parse = require('cookie-parser');
|
||||||
const cookie_encrypt = require('cookie-encrypter');
|
const cookie_encrypt = require('cookie-encrypter');
|
||||||
const Redis = require("ioredis");
|
const Redis = require("ioredis");
|
||||||
|
|
||||||
let redisClient = new Redis(process.env.REDIS_PORT, process.env.REDIS_HOST);
|
let redisClient = new Redis(process.env.REDIS_PORT, process.env.REDIS_HOST);
|
||||||
let RedisStore = require("connect-redis")(session)
|
let RedisStore = require("connect-redis")(session)
|
||||||
|
|
||||||
const { APP_PORT, APP_KEY } = process.env;
|
const { APP_PORT, APP_KEY } = process.env;
|
||||||
|
|
||||||
app.use(require('./routes'));
|
|
||||||
app.use(express.static('public'));
|
|
||||||
|
|
||||||
app.use(cookie_parse(APP_KEY))
|
app.use(cookie_parse(APP_KEY))
|
||||||
app.use(cookie_encrypt(APP_KEY));
|
app.use(cookie_encrypt(APP_KEY));
|
||||||
app.use(session({
|
app.use(session({
|
||||||
|
@ -27,6 +25,14 @@ app.use(session({
|
||||||
}));
|
}));
|
||||||
app.use(require('./middleware'));
|
app.use(require('./middleware'));
|
||||||
|
|
||||||
|
app.use(require('./routes'));
|
||||||
|
app.use(express.static('public'));
|
||||||
|
|
||||||
|
// 404
|
||||||
|
app.use((req, res, next) => {
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
const server = app.listen(APP_PORT, () => {
|
const server = app.listen(APP_PORT, () => {
|
||||||
console.log("Listening on port " + APP_PORT);
|
console.log("Listening on port " + APP_PORT);
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
const Helpers = require('../helpers');
|
||||||
|
|
||||||
|
async function handler(req, res) {
|
||||||
|
res.send(await Helpers.ViewLoader.load('guestbook.pug', {
|
||||||
|
current_route: req.originalUrl,
|
||||||
|
ip: req.ip
|
||||||
|
}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = (router) => {
|
||||||
|
router.get('/guestbook', handler);
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
extends layout/main.pug
|
||||||
|
block root
|
||||||
|
- var title = 'Guestbook'
|
||||||
|
block content
|
||||||
|
h1 Guestbook
|
||||||
|
p.
|
||||||
|
Leave a message if you want.
|
||||||
|
hr
|
||||||
|
table
|
||||||
|
tr
|
||||||
|
td
|
||||||
|
h4 Message form
|
||||||
|
form(method='post' action='/guestbook/submit')
|
||||||
|
table
|
||||||
|
tr
|
||||||
|
td Your name:
|
||||||
|
td
|
||||||
|
input(type='text' name='name' value='John Doe')
|
||||||
|
tr
|
||||||
|
td Your email:
|
||||||
|
td
|
||||||
|
input(type='email' name='email' value='john.doe@example.com')
|
||||||
|
tr
|
||||||
|
td Hide your email?
|
||||||
|
td
|
||||||
|
input(type='checkbox' name='hidemail')
|
||||||
|
p(style='margin:6px 0') Your message (512 chars max):
|
||||||
|
textarea(name='message' style='width:100%;height:150px')
|
||||||
|
|
||||||
|
td(style='padding:0 16px;margin:0')
|
||||||
|
h5 Guidelines
|
||||||
|
ul
|
||||||
|
li Follow the DBAA policy.
|
||||||
|
li
|
||||||
|
| Do not post spam ads, keep it for humans.
|
||||||
|
ul
|
||||||
|
li There is no captcha for a reason. I'd like it to stay like this for as long as possible, so I humbly ask not to ruin it.
|
||||||
|
span(style='font-size:10pt;color:darkred;font-weight:bold').
|
||||||
|
Warning: Your ip (#{ip}) will be logged and displayed for everyone.<br/>
|
||||||
|
You can delete your own message if it was sent from the same ip for 24 hours after it was sent.
|
|
@ -25,4 +25,5 @@ block content
|
||||||
ul
|
ul
|
||||||
li
|
li
|
||||||
a(href='/project/blek_anal') blek! Analytics
|
a(href='/project/blek_anal') blek! Analytics
|
||||||
li blek! Launcher
|
li
|
||||||
|
a(href='/project/blek_launch') blek! Launcher
|
|
@ -0,0 +1,8 @@
|
||||||
|
extends ../layout/project.pug
|
||||||
|
block root
|
||||||
|
- var title = 'blek! Launcher'
|
||||||
|
|
||||||
|
block append content
|
||||||
|
h2 blek! Launcher
|
||||||
|
p.
|
||||||
|
|
Loading…
Reference in New Issue