'BANNED FOR THIS POST' message + styling improvements

merge-requests/208/head
fatchan 5 years ago
parent 44e05e6220
commit 2de229337b
  1. 10
      controllers/forms.js
  2. 88
      gulp/res/css/style.css
  3. 8
      models/forms/ban-poster.js
  4. 1
      models/forms/make-post.js
  5. 2
      server.js
  6. 6
      views/includes/bannerform.pug
  7. 2
      views/includes/boardheader.pug
  8. 2
      views/includes/head.pug
  9. 15
      views/includes/pages.pug
  10. 26
      views/includes/postform.pug
  11. 2
      views/mixins/ban.pug
  12. 12
      views/mixins/post.pug
  13. 8
      views/pages/board.pug
  14. 10
      views/pages/catalog.pug
  15. 10
      views/pages/changepassword.pug
  16. 8
      views/pages/login.pug
  17. 16
      views/pages/register.pug
  18. 12
      views/pages/thread.pug

@ -369,10 +369,16 @@ router.post('/board/:board/actions', Boards.exists, banCheck, paramConverter, ve
if (hasPerms) {
// if getting global banned, board ban doesnt matter
if (req.body.global_ban) {
const { message } = await banPoster(req, res, next, null, posts);
const { message, action, query } = await banPoster(req, res, next, null, posts);
if (action) {
combinedQuery[action] = { ...combinedQuery[action], ...query}
}
messages.push(message);
} else if (req.body.ban) {
const { message } = await banPoster(req, res, next, req.params.board, posts);
const { message, action, query } = await banPoster(req, res, next, req.params.board, posts);
if (action) {
combinedQuery[action] = { ...combinedQuery[action], ...query}
}
messages.push(message);
}
}

@ -22,13 +22,33 @@ body {
white-space: pre;
}
.ml-1 {
margin-left: 1px;
}
.ml-5 {
margin-left: 5px;
}
.mr-1 {
margin-right: 1px;
}
.mr-5 {
margin-right: 5px;
}
.ph-5 {
padding: 0 5px;
}
.pv-5 {
padding: 5px 0;
}
.pages {
padding: 10px;
margin: 10px 0;
padding: 10px;
}
.pages a {
.pages a, a:visited {
text-decoration: none;
color: black;
}
object {
@ -41,7 +61,9 @@ object {
align-items: center;
}
.navbar {
border-bottom: 1px solid #a9a9a9;
}
.catalog-tile-button {
width: 100%;
@ -103,6 +125,11 @@ object {
text-align: center;
}
.banmessage {
color: red;
font-weight: bold;
}
.reports {
background: #fca!important;
border-color: #c97!important;
@ -118,8 +145,8 @@ object {
color: green;
}
blockquote a {
color: #d00;
blockquote a, a:hover {
color: #d00!important;
}
.op blockquote {
@ -127,14 +154,9 @@ blockquote a {
}
blockquote {
/*word-break: break-all;*/
white-space: pre-wrap;
}
span {
/*margin-right: 5px;*/
}
.thread, .action-wrapper, .form-wrapper {
display: flex;
flex-direction: column;
@ -223,7 +245,7 @@ span {
margin-right: 10px;
display: flex;
flex-flow: row wrap;
align-items: end;
align-items: start;
}
.post-data {
@ -287,6 +309,7 @@ input textarea {
.board-banner {
margin: 10px;
max-width: 100%;
border: 1px solid #a9a9a9;
}
.board-description {
@ -303,19 +326,19 @@ input textarea {
.post-container, .ban {
box-sizing: border-box;
margin: 2px 0;
padding: 2px;
padding: 5px;
max-width: 100%;
}
.post-container:target {
background-color: #d6bad0!important;
background-color: #d6bad0;
border-color: #ba9dbf;
}
.post-container.op {
background: none;
border: none;
width: 100%
width: 100%;
}
.post-subject {
@ -342,11 +365,9 @@ input textarea {
.post-info {
margin: -2px;
/*margin-left: -3px;*/
padding: 2px;
padding-left: 1px;
/*background-color: #B7C5D9;*/
margin: -5px;
padding: 5px;
padding-left: 3px;
}
.post-info * {
@ -383,6 +404,7 @@ input textarea {
flex-shrink: 0;
margin-top: auto;
line-height: 30px;
border-top: 1px solid #a9a9a9;
}
input[type="text"], input[type="submit"], input[type="password"], input[type="file"], textarea {
@ -399,25 +421,38 @@ input[type="submit"] {
}
input[type="file"] {
border: none;
background: white;
}
.postform-section {
.postform-row, .postform-col {
display: flex;
}
.postform-row {
margin-bottom: 1px;
overflow: hidden;
max-width: 100%;
}
.postform-data {
display: flex;
.postform-col {
flex-direction: column;
flex-grow: 1;
}
.postform-style {
display: flex;
border: 1px solid #a9a9a9;
background: white;
align-items: center;
}
.captcha {
margin-bottom: 1px;
border: 1px solid #a9a9a9;
background: white;
margin-bottom: 1px;
width: 100%;
box-sizing: border-box;
object-fit: contain;
}
.postform-label {
@ -442,8 +477,9 @@ hr {
@media only screen and (max-width: 800px) {
input {
input, .postform-style {
height: 30px;
box-sizing: border-box;
}
.form-post {
@ -459,7 +495,7 @@ hr {
}
.post-check {
top: 2px;
top: 1px;
margin-left: 2px!important;
height: 8px;
}

@ -18,6 +18,12 @@ module.exports = async (req, res, next, board, posts) => {
const bannedIps = await Bans.insertMany(bans).then(result => result.insertedCount);
return { message:`Banned ${bannedIps} ips` };
return {
message:`Banned ${bannedIps} ips`,
action:'$set',
query: {
'banmessage': req.body.ban_reason || ''
}
};
}

@ -197,6 +197,7 @@ module.exports = async (req, res, next, numFiles) => {
'email': req.body.email || null,
'salt': !req.body.thread ? salt : null,
'spoiler': req.body.spoiler ? true : false,
'banmessage': null,
'userId': userId,
'ip': ip,
'files': files,

@ -53,7 +53,7 @@ const express = require('express')
// use pug view engine
app.set('view engine', 'pug');
app.set('views', path.join(__dirname, 'views/pages'));
// app.enable('view cache');
app.enable('view cache');
// routes
app.use('/forms', require(__dirname+'/controllers/forms.js'))

@ -3,7 +3,9 @@ section.form-wrapper
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)
input#file(type='file', name='file' multiple)
section.postform-section
span.fileupload
input#file(type='file', name='file' multiple)
input(type='submit', value='submit')
section.form-wrapper
@ -14,6 +16,6 @@ section.form-wrapper
each banner in board.banners
label.banner-check
input(type='checkbox' name='checkedbanners[]' value=banner)
object.board-banner(data=`/img/${banner}` width='300' height='100')
object.board-banner(data=`/banner/${banner}` width='300' height='100')
input(type='submit', value='submit')

@ -1,6 +1,6 @@
section.board-header
if board.banners.length > 0
object.board-banner(data=`/banners?board=${board._id}` width='300' height='100')
a.no-decoration(href=`/${board._id}`)
a.no-decoration(href=`/${board._id}/`)
h1.board-title /#{board._id}/ - #{board.name}
h4.board-description #{board.description}

@ -1,4 +1,4 @@
meta(charset='utf-8')
meta(name='viewport', content='width=device-width, initial-scale=1')
link(rel='stylesheet' href='/css/style.css')
link(rel='shortcut icon' href='/img/favicon.ico' type='image/x-icon')
link(rel='shortcut icon' href='/favicon.ico' type='image/x-icon')

@ -1,8 +1,7 @@
nav.pages Page:
- for(let i = 1; i <= pages; i++)
if i === page
span: a(href=`/${board._id}?p=${i}`) [#{i}]
else
span: a(href=`/${board._id}?p=${i}`) #{i}
| |
a(href=`/${board._id}/catalog`) [Catalog]
| Page:
- for(let i = 1; i <= pages; i++)
if i === page
span: a(href=`/${board._id}?p=${i}`) [#{i}]
else
span: a(href=`/${board._id}?p=${i}`) #{i}
| |

@ -2,33 +2,33 @@ section.form-wrapper
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)
section.postform-section
section.postform-row
.postform-label Name
input#name(type='text', name='name', placeholder='Anonymous' autocomplete='off' maxlength='50')
section.postform-section
section.postform-row
.postform-label Subject
input#title(type='text', name='subject', autocomplete='off' maxlength='50')
section.postform-section
section.postform-row
.postform-label Email
input#name(type='text', name='email', autocomplete='off' maxlength='50')
section.postform-section
section.postform-row
.postform-label Password
input#password(type='password', name='password', autocomplete='off' maxlength='50')
section.postform-section
section.postform-row
.postform-label Message
textarea#message(name='message', rows='5', autocomplete='off' maxlength='2000')
section.postform-section
section.postform-row
.postform-label Files
span
input#file(type='file', name='file' multiple='multiple')
label
input.post-check#spoiler(type='checkbox', name='spoiler', value='true')
| Spoiler
section.postform-section
input#file(type='file', name='file' multiple='multiple')
label.postform-style.ph-5.ml-1
input#spoiler(type='checkbox', name='spoiler', value='true')
| Spoiler
section.postform-row
.postform-label Captcha
span.postform-data
.postform-col
img.captcha(src='/captcha' width=200 height=80)
input#captcha(type='text', name='captcha', autocomplete='off' placeholder='captcha text' maxlength='6')
input(type='submit', value='submit')

@ -4,7 +4,7 @@ mixin ban(ban)
.ban
input.post-check(type='checkbox', name='checkedbans[]' value=ban._id)
if ban.board
div Board: #[a(href=`/${ban.board}`) /#{ban.board}/]
div Board: #[a(href=`/${ban.board}/`) /#{ban.board}/]
else
div Global ban.
div Reason: #{ban.reason}

@ -23,8 +23,10 @@ mixin post(post, truncate, manage=false, globalmanage=false)
span.post-name #{post.name}
else
span.post-name #{post.name}
|
if post.tripcode
span.post-tripcode #{post.tripcode}
|
if post.capcode
span.post-capcode #{post.capcode}
|
@ -57,19 +59,17 @@ mixin post(post, truncate, manage=false, globalmanage=false)
-
const splitPost = post.message.split('\n');
const messageLines = splitPost.length;
let truncatedMessage = post.mesage;
let truncated = false;
let truncatedMessage = post.message;
if (messageLines > 10 || post.message.length > 1000) {
truncatedMessage = splitPost.slice(0, 10).join('\n');
truncated = true;
}
blockquote.post-message !{truncatedMessage}
if truncated
blockquote.post-message !{truncatedMessage}
blockquote.left.clear-both Message too long. #[a(href=postURL) View the full text]
else
blockquote.post-message !{post.message}
else
blockquote.post-message !{post.message}
if post.banmessage
blockquote.left.clear-both.banmessage (USER WAS BANNED FOR THIS POST #{post.banmessage})
if post.omittedposts || post.omittedimages
blockquote.left.clear-both #{post.omittedposts} post(s)#{post.omittedimages > 0 ? ' and '+post.omittedimages+' image(s)' : ''} omitted. #[a(href=postURL) View the full thread]

@ -8,7 +8,10 @@ block content
include ../includes/boardheader.pug
include ../includes/postform.pug
.mode Posting mode: Thread
include ../includes/pages.pug
nav.pages#top
include ../includes/pages.pug
a(href='#bottom') [Bottom]
a(href=`/${board._id}/catalog`) [Catalog]
hr(size=1)
form(action='/forms/board/'+board._id+'/actions' method='POST' enctype='application/x-www-form-urlencoded')
input(type='hidden' name='_csrf' value=csrf)
@ -21,4 +24,7 @@ block content
for post in thread.replies
+post(post, true)
hr(size=1)
nav.pages#bottom
a(href='#top') [Top]
a(href=`/${board._id}/catalog`) [Catalog]
include ../includes/actionfooter.pug

@ -6,8 +6,9 @@ block head
block content
include ../includes/boardheader.pug
hr(size=1)
.mode Catalog View [#[a.no-decoration(href=`/${board._id}`) Go Back]]
nav.pages#top
a(href='#bottom') [Bottom]
a(href=`/${board._id}/`) [Return]
hr(size=1)
if threads.length === 0
p No posts.
@ -15,4 +16,7 @@ block content
section.catalog
for thread in threads
+catalogtile(board, thread)
hr(size=1)
nav.pages#bottom
a(href='#top') [Top]
a(href=`/${board._id}/`) [Return]

@ -7,16 +7,16 @@ block content
section.form-wrapper
form.form-post(action='/forms/changepassword' method='POST')
input(type='hidden' name='_csrf' value=csrf)
section.postform-section
section.postform-row
.postform-label Username
input#username(type='text', name='username', placeholder='username' maxlength='50')
section.postform-section
input#username(type='text', name='username', maxlength='50')
section.postform-row
.postform-label Existing Password
input#password(type='password', name='password', maxlength='100')
section.postform-section
section.postform-row
.postform-label New Password
input#password(type='password', name='newpassword', maxlength='100')
section.postform-section
section.postform-row
.postform-label Confirm New Password
input#password(type='password', name='newpasswordconfirm', maxlength='100')
input(type='submit', value='submit')

@ -8,12 +8,12 @@ block content
form.form-post(action='/forms/login' method='POST')
input(type='hidden' name='_csrf' value=csrf)
input(type='hidden' name='redirect' value=redirect)
section.postform-section
section.postform-row
.postform-label Username
input#username(type='text', name='username', placeholder='username' maxlength='50')
section.postform-section
input#username(type='text', name='username', maxlength='50')
section.postform-row
.postform-label Password
input#password(type='password', name='password', placeholder='password' maxlength='100')
input#password(type='password', name='password', maxlength='100')
input(type='submit', value='submit')
p No account? #[a(href='/register') Register]

@ -7,18 +7,18 @@ block content
section.form-wrapper
form.form-post(action='/forms/register' method='POST')
input(type='hidden' name='_csrf' value=csrf)
section.postform-section
section.postform-row
.postform-label Username
input#username(type='text', name='username', placeholder='username' maxlength='50')
section.postform-section
input#username(type='text', name='username', maxlength='50')
section.postform-row
.postform-label Password
input#password(type='password', name='password', placeholder='password' maxlength='100')
section.postform-section
input#password(type='password', name='password', maxlength='100')
section.postform-row
.postform-label Confirm Password
input#password(type='password', name='passwordconfirm', placeholder='confirm password' maxlength='100')
section.postform-section
input#password(type='password', name='passwordconfirm', maxlength='100')
section.postform-row
.postform-label Captcha
span.postform-data
span.postform-col
img.captcha(src='/captcha' width=200 height=80)
input#captcha(type='text', name='captcha', autocomplete='off' placeholder='captcha text' maxlength='6')
input(type='submit', value='submit')

@ -2,7 +2,7 @@ extends ../layout.pug
include ../mixins/post.pug
block head
title /#{board._id}/ #{thread.subject||thread.postId}
title /#{board._id}/ - #{thread.subject||thread.postId}
meta(property='og:site_name', value='fatchan')
meta(property='og:title', content=thread.subject)
meta(property='og:url', content='https://fatpeople.lol')
@ -12,7 +12,11 @@ block head
block content
include ../includes/boardheader.pug
include ../includes/postform.pug
.mode Posting mode: Reply [#[a.no-decoration(href=`/${board._id}`) Go Back]]
.mode Posting mode: Reply
nav.pages#top
a(href='#bottom') [Bottom]
a(href=`/${board._id}/`) [Return]
a(href=`/${board._id}/catalog`) [Catalog]
hr(size=1)
form(action=`/forms/board/${board._id}/actions` method='POST' enctype='application/x-www-form-urlencoded')
input(type='hidden' name='_csrf' value=csrf)
@ -21,4 +25,8 @@ block content
for post in thread.replies
+post(post)
hr(size=1)
nav.pages#bottom
a(href='#top') [Top]
a(href=`/${board._id}/`) [Return]
a(href=`/${board._id}/catalog`) [Catalog]
include ../includes/actionfooter.pug

Loading…
Cancel
Save