improve new settings handling, more options, change manage page styling

merge-requests/208/head
fatchan 5 years ago
parent 281dba8819
commit 0e3c6ede2b
  1. 1
      controllers/forms.js
  2. 11
      gulp/res/css/style.css
  3. 1
      helpers/captchaverify.js
  4. 8
      models/forms/make-post.js
  5. 21
      views/includes/bannerform.pug
  6. 4
      views/includes/postform.pug
  7. 2
      views/pages/changepassword.pug
  8. 2
      views/pages/home.pug
  9. 2
      views/pages/login.pug
  10. 58
      views/pages/manage.pug
  11. 2
      views/pages/register.pug
  12. 6
      wipe.js

@ -171,6 +171,7 @@ router.post('/board/:board/post', Boards.exists, banCheck, paramConverter, verif
numFiles = req.files.file.size > 0 ? 1 : 0;
req.files.file = [req.files.file];
}
numFiles = Math.min(numFiles, res.locals.board.settings.maxFiles)
}
const errors = [];

@ -34,6 +34,12 @@ body {
.mr-5 {
margin-right: 5px;
}
.mv-10 {
margin: 10px 0;
}
.mb-10 {
margin-bottom: 10px;
}
.ph-5 {
padding: 0 5px;
}
@ -194,9 +200,8 @@ td, th {
text-align: left;
}
.form-wrapper, .table-container {
.flex-center {
align-items: center;
margin: 10px 0;
}
.post-container, .pages, .toggle-label {
@ -248,7 +253,7 @@ td, th {
display: flex;
flex-direction: column;
max-width: 100%;
margin-top: 10px;
/*margin-top: 10px;*/
}
.togglable {

@ -27,7 +27,6 @@ module.exports = async (req, res, next) => {
});
}
// try to get the captcha from the DB
let captcha;
try {

@ -71,7 +71,7 @@ module.exports = async (req, res, next, numFiles) => {
// if we got a file
if (numFiles > 0) {
// check all mime types befoer we try saving anything
for (let i = 0; i < res.locals.board.settings.maxImages; i++) {
for (let i = 0; i < numFiles; i++) {
if (!fileCheckMimeType(req.files.file[i].mimetype, {image: true, video: true})) {
return res.status(400).render('message', {
'title': 'Bad request',
@ -166,7 +166,7 @@ module.exports = async (req, res, next, numFiles) => {
//forceanon only allow sage email
let email = hasPerms || !forceAnon || req.body.email === 'sage' ? req.body.email : null;
let name = res.locals.board.settins.defaultName;
let name = res.locals.board.settings.defaultName;
let tripcode = null;
let capcode = null;
if ((hasPerms || !forceAnon) && req.body.name && req.body.name.length > 0) {
@ -233,9 +233,9 @@ module.exports = async (req, res, next, numFiles) => {
let postId;
try {
postId = await Posts.insertOne(res.locals.board, data, thread);
postId = await Posts.insertOne(req.params.board, data, thread);
if (!data.thread) { //if we just added a new thread, prune anyold ones
await module.exports.pruneOldThreads(req.params.board, res.locals.board.settings.threadLimit);
await Posts.pruneOldThreads(req.params.board, res.locals.board.settings.threadLimit);
}
} catch (err) {
return next(err);

@ -1,21 +0,0 @@
section.form-wrapper
label.toggle-label Add Banners
input.toggle(type='checkbox')
form.form-post.togglable(action=`/forms/board/${board._id}/addbanners`, enctype='multipart/form-data', method='POST')
input(type='hidden' name='_csrf' value=csrf)
section.postform-section
span.fileupload
input#file(type='file', name='file' multiple)
input(type='submit', value='submit')
section.form-wrapper
label.toggle-label Delete Banners
input.toggle(type='checkbox')
form.form-post.togglable(action=`/forms/board/${board._id}/deletebanners`, enctype='application/x-www-form-urlencoded', method='POST')
input(type='hidden' name='_csrf' value=csrf)
each banner in board.banners
label.banner-check
input(type='checkbox' name='checkedbanners[]' value=banner)
object.board-banner(data=`/banner/${banner}` width='300' height='100')
input(type='submit', value='submit')

@ -1,11 +1,11 @@
section.form-wrapper
section.form-wrapper.flex-center.mv-10
form.form-post(action=`/forms/board/${board._id}/post`, enctype='multipart/form-data', method='POST')
input(type='hidden' name='_csrf' value=csrf)
input(type='hidden' name='thread' value=thread != null ? thread.postId : null)
unless board.settings.forceAnon
section.postform-row
.postform-label Name
input#name(type='text', name='name', placeholder='Anonymous' autocomplete='off' maxlength='50')
input#name(type='text', name='name', placeholder=board.defaultName autocomplete='off' maxlength='50')
section.postform-row
.postform-label Subject
input#title(type='text', name='subject', autocomplete='off' maxlength='50')

@ -4,7 +4,7 @@ block head
title Change Password
block content
section.form-wrapper
section.form-wrapper.flex-center.mv-10
form.form-post(action='/forms/changepassword' method='POST')
input(type='hidden' name='_csrf' value=csrf)
section.postform-row

@ -5,7 +5,7 @@ block head
block content
h1.board-title Board List
.table-container
.table-container.flex-center.mv-10
table.table-body
tr.table-head
th Board

@ -4,7 +4,7 @@ block head
title Login
block content
section.form-wrapper
section.form-wrapper.flex-center.mv-10
form.form-post(action='/forms/login' method='POST')
input(type='hidden' name='_csrf' value=csrf)
input(type='hidden' name='redirect' value=redirect)

@ -7,8 +7,8 @@ block head
block content
include ../includes/boardheader.pug
h4 Settings:
section.form-wrapper
h4.no-m-p Settings:
section.form-wrapper.flexleft.mv-10
form.form-post(action=`/forms/board/${board._id}/settings` method='POST' enctype='application/x-www-form-urlencoded')
input(type='hidden' name='_csrf' value=csrf)
section.postform-row
@ -31,25 +31,45 @@ block content
.postform-label Reply Limit
input(type='text' name='reply_limit' placeholder=board.settings.replyLimit)
section.postform-row
.postform-label Max Images
input(type='text' name='max_images' placeholder=board.settings.maxImages)
.postform-label Max Files
input(type='text' name='max_files' placeholder=board.settings.maxFiles)
input(type='submit', value='save settings')
h4 Banners:
include ../includes/bannerform.pug
h4 Reports:
form(action=`/forms/board/${board._id}/modactions` method='POST' enctype='application/x-www-form-urlencoded')
input(type='hidden' name='_csrf' value=csrf)
if reports.length === 0
p No reports.
hr(size=1)
else
for report in reports
section.thread
+post(report, false, true)
hr(size=1)
h4.no-m-p Add Banners:
section.form-wrapper.flexleft.mv-10
form.form-post(action=`/forms/board/${board._id}/addbanners`, enctype='multipart/form-data', method='POST')
input(type='hidden' name='_csrf' value=csrf)
section.postform-row
.postform-label Upload
input#file(type='file', name='file' multiple)
input(type='submit', value='submit')
hr(size=1)
if board.banners.length > 0
h4.no-m-p Delete Banners:
section.form-wrapper.flexleft.mv-10
form.form-post(action=`/forms/board/${board._id}/deletebanners`, enctype='application/x-www-form-urlencoded', method='POST')
input(type='hidden' name='_csrf' value=csrf)
each banner in board.banners
label.banner-check
input(type='checkbox' name='checkedbanners[]' value=banner)
object.board-banner(data=`/banner/${banner}` width='300' height='100')
input(type='submit', value='delete')
hr(size=1)
h4.no-m-p Reports:
.mv-10
form(action=`/forms/board/${board._id}/modactions` method='POST' enctype='application/x-www-form-urlencoded')
input(type='hidden' name='_csrf' value=csrf)
if reports.length === 0
p No reports.
hr(size=1)
include ../includes/actionfooter_manage.pug
hr(size=1)
h4 Bans:
else
for report in reports
section.thread
+post(report, false, true)
hr(size=1)
include ../includes/actionfooter_manage.pug
hr(size=1)
h4.no-m-p Bans:
form(action=`/forms/board/${board._id}/unban` method='POST' enctype='application/x-www-form-urlencoded')
input(type='hidden' name='_csrf' value=csrf)
if bans.length === 0

@ -4,7 +4,7 @@ block head
title Register
block content
section.form-wrapper
section.form-wrapper.flex-center.mv-10
form.form-post(action='/forms/register' method='POST')
input(type='hidden' name='_csrf' value=csrf)
section.postform-row

@ -44,7 +44,7 @@ const Mongo = require(__dirname+'/db/db.js')
ids: true,
threadLimit: 100,
replyLimit: 300,
maxImages: 3,
maxFiles: 3,
defaultName: 'Anonymous',
}
})
@ -60,8 +60,8 @@ const Mongo = require(__dirname+'/db/db.js')
ids: false,
threadLimit: 100,
replyLimit: 300,
maxImages: 3,
defaultNAme: 'Anonymous',
maxFiles: 3,
defaultName: 'Anonymous',
}
})
console.log('creating indexes')

Loading…
Cancel
Save