diff --git a/index.js b/index.js
index 867c3fd..3184e46 100644
--- a/index.js
+++ b/index.js
@@ -1,6 +1,7 @@
// do startup jobs
require('./startup');
+if (process.env.APP_DEBUG == 'true') process.env.DEBUG = '*/*';
const express = require('express');
const app = express();
@@ -8,12 +9,15 @@ const session = require('express-session');
const cookie_parse = require('cookie-parser');
const cookie_encrypt = require('cookie-encrypter');
const Redis = require("ioredis");
+const bodyparser = require('body-parser');
let redisClient = new Redis(process.env.REDIS_PORT, process.env.REDIS_HOST);
let RedisStore = require("connect-redis")(session)
const { APP_PORT, APP_KEY } = process.env;
+app.use(bodyparser.json());
+app.use(bodyparser.urlencoded({ extended: true }));
app.use(cookie_parse(APP_KEY))
app.use(cookie_encrypt(APP_KEY));
app.use(session({
diff --git a/package.json b/package.json
index 4fd385e..38f4948 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,7 @@
"author": "",
"license": "ISC",
"dependencies": {
+ "body-parser": "^1.20.1",
"connect-redis": "^6.1.3",
"cookie-encrypter": "^1.0.1",
"cookie-parser": "^1.4.6",
diff --git a/public/static/ui/send_button.css b/public/static/ui/send_button.css
new file mode 100644
index 0000000..f47daac
--- /dev/null
+++ b/public/static/ui/send_button.css
@@ -0,0 +1,30 @@
+.send_button_1 {
+ user-select: none;
+
+ box-shadow:inset 0px 1px 1px 0px #91b8b3;
+ background:linear-gradient(to bottom, #768d87 5%, #6c7c7c 100%);
+ background-color:#768d87;
+ border-radius:5px;
+ border:1px solid #566963;
+ display:inline-block;
+ cursor:pointer;
+ color:#1e3038;
+ font-family:Arial;
+ font-size:15px;
+ font-weight:bold;
+ font-style:italic;
+ padding:4px 12px;
+ text-decoration:none;
+ text-shadow:0px -1px 1px #2b665e;
+}
+.send_button_1:hover {
+ background:linear-gradient(to bottom, #6c7c7c 5%, #768d87 100%);
+ background-color:#6c7c7c;
+}
+.send_button_1:active {
+ position:relative;
+ top:1px;
+}
+.send_button_1::before {
+ content: 'send!'
+}
\ No newline at end of file
diff --git a/routes/guestbook.js b/routes/guestbook.js
index fa2aa57..a321f15 100644
--- a/routes/guestbook.js
+++ b/routes/guestbook.js
@@ -8,6 +8,12 @@ async function handler(req, res) {
return;
}
+async function submit(req, res) {
+ res.send(req.body);
+ return;
+}
+
module.exports = (router) => {
router.get('/guestbook', handler);
+ router.post('/guestbook/submit', submit);
}
\ No newline at end of file
diff --git a/view/guestbook.pug b/view/guestbook.pug
index 997fd6e..38058df 100644
--- a/view/guestbook.pug
+++ b/view/guestbook.pug
@@ -1,6 +1,8 @@
extends layout/main.pug
block root
- var title = 'Guestbook'
+block head
+
block content
h1 Guestbook
p.
@@ -25,8 +27,9 @@ block content
td
input(type='checkbox' name='hidemail')
p(style='margin:6px 0') Your message (512 chars max):
- textarea(name='message' style='width:100%;height:150px')
-
+ textarea(name='message' style='width:100%;height:150px;max-width:600px;max-height:300px')
+ p
+ input(type='submit' class='send_button_1')
td(style='padding:0 16px;margin:0')
h5 Guidelines
ul
@@ -34,7 +37,7 @@ block content
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.
+ li There is no captcha for a reason. I'd like to keep it this way 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.
You can delete your own message if it was sent from the same ip for 24 hours after it was sent.
\ No newline at end of file