mirror of https://gitgud.io/fatchan/jschan.git
merge-requests/208/head
parent
e823cad14e
commit
db963d4607
32 changed files with 247 additions and 160 deletions
@ -1,9 +0,0 @@ |
|||||||
'use strict'; |
|
||||||
|
|
||||||
module.exports = (req, res) => { |
|
||||||
return req.session.authenticated //if the user is authed
|
|
||||||
&& req.session.user //if the user is logged in
|
|
||||||
&& (req.session.user.authLevel > 1 //and is not a regular user
|
|
||||||
|| res.locals.board.owner == req.session.user.username //or us board owner
|
|
||||||
|| res.locals.board.moderators.includes(req.session.user.username)); //or is board moderator
|
|
||||||
} |
|
@ -0,0 +1,16 @@ |
|||||||
|
'use strict'; |
||||||
|
|
||||||
|
module.exports = (req, res) => { |
||||||
|
return req.session.authenticated //if the user is authed
|
||||||
|
&& req.session.user //if the user is logged in
|
||||||
|
&& ( |
||||||
|
req.session.user.authLevel > 1 //and is not a regular user
|
||||||
|
|| ( |
||||||
|
res.locals.board |
||||||
|
&& ( |
||||||
|
res.locals.board.owner == req.session.user.username //and board owner
|
||||||
|
|| res.locals.board.moderators.includes(req.session.user.username) //or board mod
|
||||||
|
) |
||||||
|
) |
||||||
|
) |
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
'use strict'; |
||||||
|
|
||||||
|
const hasPerms = require(__dirname+'/hasperms.js'); |
||||||
|
|
||||||
|
module.exports = async (req, res, next) => { |
||||||
|
|
||||||
|
if (!hasPerms(req, res)) { |
||||||
|
return res.status(403).render('message', { |
||||||
|
'title': 'Forbidden', |
||||||
|
'message': 'You do not have permission to access this page', |
||||||
|
'redirect': '/' |
||||||
|
}); |
||||||
|
} |
||||||
|
next(); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
'use strict'; |
||||||
|
|
||||||
|
const Posts = require(__dirname+'/../../db-models/posts.js'); |
||||||
|
|
||||||
|
module.exports = async (req, res, next) => { |
||||||
|
|
||||||
|
let posts; |
||||||
|
try { |
||||||
|
posts = await Posts.getAllReports(); |
||||||
|
} catch (err) { |
||||||
|
return next(err); |
||||||
|
} |
||||||
|
|
||||||
|
//render the page
|
||||||
|
res.render('globalmanage', { |
||||||
|
csrf: req.csrfToken(), |
||||||
|
posts: posts |
||||||
|
}); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
extends ../layout.pug |
||||||
|
include ../mixins/post.pug |
||||||
|
|
||||||
|
block head |
||||||
|
title Banned! |
||||||
|
|
||||||
|
block content |
||||||
|
h1.board-title Banned! |
||||||
|
hr(size=1) |
||||||
|
Bans currently in place against your IP: |
||||||
|
hr(size=1) |
||||||
|
for ban in bans |
||||||
|
if ban.board |
||||||
|
div Board: #[a(href=`/${ban.board}`) /#{ban.board}/] |
||||||
|
else |
||||||
|
div Global ban. |
||||||
|
div Reason: #{ban.reason} |
||||||
|
div Issuer: #{ban.issuer} |
||||||
|
div Date: #{ban.date} |
||||||
|
div Expiry: #{ban.expireAt} |
||||||
|
if ban.post |
||||||
|
span Post: |
||||||
|
section.thread |
||||||
|
+post(ban.post.board, ban.post, false) |
||||||
|
hr(size=1) |
@ -0,0 +1,11 @@ |
|||||||
|
extends ../layout.pug |
||||||
|
include ../mixins/post.pug |
||||||
|
|
||||||
|
block head |
||||||
|
title Manage |
||||||
|
|
||||||
|
block content |
||||||
|
h1.board-title Global Management |
||||||
|
hr(size=1) |
||||||
|
p under construction |
||||||
|
|
Loading…
Reference in new issue