mirror of https://gitgud.io/fatchan/jschan.git
parent
830d0cc40e
commit
549313c49a
27 changed files with 273 additions and 154 deletions
@ -1,28 +0,0 @@ |
|||||||
'use strict'; |
|
||||||
|
|
||||||
const { Bans, News, Posts, Accounts } = require(__dirname+'/../../db/') |
|
||||||
|
|
||||||
module.exports = async (req, res, next) => { |
|
||||||
|
|
||||||
let reports, bans, news, accounts; |
|
||||||
try { |
|
||||||
[ reports, bans, news, accounts ] = await Promise.all([ |
|
||||||
Posts.getGlobalReports(), |
|
||||||
Bans.getGlobalBans(), |
|
||||||
News.find(), |
|
||||||
Accounts.find(), |
|
||||||
]); |
|
||||||
} catch (err) { |
|
||||||
return next(err) |
|
||||||
} |
|
||||||
|
|
||||||
//render the page
|
|
||||||
res.render('globalmanage', { |
|
||||||
csrf: req.csrfToken(), |
|
||||||
reports, |
|
||||||
bans, |
|
||||||
news, |
|
||||||
accounts, |
|
||||||
}); |
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,19 @@ |
|||||||
|
'use strict'; |
||||||
|
|
||||||
|
const { Accounts } = require(__dirname+'/../../../db/'); |
||||||
|
|
||||||
|
module.exports = async (req, res, next) => { |
||||||
|
|
||||||
|
let accounts; |
||||||
|
try { |
||||||
|
accounts = await Accounts.find(); |
||||||
|
} catch (err) { |
||||||
|
return next(err) |
||||||
|
} |
||||||
|
|
||||||
|
res.render('globalmanageaccounts', { |
||||||
|
csrf: req.csrfToken(), |
||||||
|
accounts, |
||||||
|
}); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
'use strict'; |
||||||
|
|
||||||
|
const { Bans } = require(__dirname+'/../../../db/'); |
||||||
|
|
||||||
|
module.exports = async (req, res, next) => { |
||||||
|
|
||||||
|
let bans; |
||||||
|
try { |
||||||
|
bans = await Bans.getGlobalBans(); |
||||||
|
} catch (err) { |
||||||
|
return next(err) |
||||||
|
} |
||||||
|
|
||||||
|
res.render('globalmanagebans', { |
||||||
|
csrf: req.csrfToken(), |
||||||
|
bans, |
||||||
|
}); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,9 @@ |
|||||||
|
'use strict'; |
||||||
|
|
||||||
|
module.exports = { |
||||||
|
globalManageReports: require(__dirname+'/reports.js'), |
||||||
|
globalManageBans: require(__dirname+'/bans.js'), |
||||||
|
globalManageBoards: require(__dirname+'/boards.js'), |
||||||
|
globalManageNews: require(__dirname+'/news.js'), |
||||||
|
globalManageAccounts: require(__dirname+'/accounts.js'), |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
'use strict'; |
||||||
|
|
||||||
|
const { News } = require(__dirname+'/../../../db/'); |
||||||
|
|
||||||
|
module.exports = async (req, res, next) => { |
||||||
|
|
||||||
|
let news; |
||||||
|
try { |
||||||
|
news = await News.find(); |
||||||
|
} catch (err) { |
||||||
|
return next(err) |
||||||
|
} |
||||||
|
|
||||||
|
res.render('globalmanagenews', { |
||||||
|
csrf: req.csrfToken(), |
||||||
|
news, |
||||||
|
}); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
'use strict'; |
||||||
|
|
||||||
|
const { Posts } = require(__dirname+'/../../../db/'); |
||||||
|
|
||||||
|
module.exports = async (req, res, next) => { |
||||||
|
|
||||||
|
let reports; |
||||||
|
try { |
||||||
|
reports = await Posts.getGlobalReports(); |
||||||
|
} catch (err) { |
||||||
|
return next(err) |
||||||
|
} |
||||||
|
|
||||||
|
res.render('globalmanagereports', { |
||||||
|
csrf: req.csrfToken(), |
||||||
|
reports, |
||||||
|
}); |
||||||
|
|
||||||
|
} |
@ -1,8 +1,8 @@ |
|||||||
'use strict'; |
'use strict'; |
||||||
|
|
||||||
module.exports = { |
module.exports = { |
||||||
managereports: require(__dirname+'/reports.js'), |
manageReports: require(__dirname+'/reports.js'), |
||||||
managesettings: require(__dirname+'/settings.js'), |
manageSettings: require(__dirname+'/settings.js'), |
||||||
managebans: require(__dirname+'/bans.js'), |
manageBans: require(__dirname+'/bans.js'), |
||||||
managebanners: require(__dirname+'/banners.js'), |
manageBanners: require(__dirname+'/banners.js'), |
||||||
} |
} |
||||||
|
@ -1,6 +1,6 @@ |
|||||||
nav.navbar#top |
nav.navbar#top |
||||||
a.nav-item(href='/') Home |
a.nav-item(href='/') Home |
||||||
a.nav-item(href='/news.html') News |
a.nav-item(href='/news.html') News |
||||||
a.nav-item(href=`/${board ? board._id+'/manage/reports' : 'globalmanage'}.html`) Manage |
a.nav-item(href=`/${board ? board._id+'/manage/reports' : 'globalmanage/reports'}.html`) Manage |
||||||
a.nav-item(href='/create.html') Create |
a.nav-item(href='/create.html') Create |
||||||
a.nav-item.right(href='/logout') Logout |
a.nav-item.right(href='/logout') Logout |
||||||
|
@ -0,0 +1,13 @@ |
|||||||
|
mixin globalmanagenav(selected) |
||||||
|
nav.pages |
||||||
|
a(href=`/globalmanage/reports.html` class=(selected === 'reports' ? 'bold' : '')) [Reports] |
||||||
|
| |
||||||
|
a(href=`/globalmanage/bans.html` class=(selected === 'bans' ? 'bold' : '')) [Bans] |
||||||
|
| |
||||||
|
a(href=`/globalmanage/boards.html` class=(selected === 'boards' ? 'bold' : '')) [Boards] |
||||||
|
if permLevel === 0 |
||||||
|
| |
||||||
|
a(href=`/globalmanage/accounts.html` class=(selected === 'accounts' ? 'bold' : '')) [Accounts] |
||||||
|
| |
||||||
|
a(href=`/globalmanage/news.html` class=(selected === 'news' ? 'bold' : '')) [News] |
||||||
|
|
@ -1,95 +0,0 @@ |
|||||||
extends ../layout.pug |
|
||||||
include ../mixins/post.pug |
|
||||||
include ../mixins/ban.pug |
|
||||||
include ../mixins/newspost.pug |
|
||||||
|
|
||||||
block head |
|
||||||
script(src='/js/all.js') |
|
||||||
title Manage |
|
||||||
|
|
||||||
block content |
|
||||||
h1.board-title Global Management |
|
||||||
hr(size=1) |
|
||||||
h4.no-m-p Add News: |
|
||||||
section.form-wrapper.flexleft.mt-10 |
|
||||||
form.form-post(action=`/forms/global/addnews`, enctype='application/x-www-form-urlencoded', method='POST') |
|
||||||
input(type='hidden' name='_csrf' value=csrf) |
|
||||||
section.row |
|
||||||
.label Title |
|
||||||
input(type='text' name='title' required) |
|
||||||
section.row |
|
||||||
.label Message |
|
||||||
textarea(name='message' placeholder='supports post styling' required) |
|
||||||
input(type='submit', value='submit') |
|
||||||
hr(size=1) |
|
||||||
if news.length > 0 |
|
||||||
h4.no-m-p Delete News: |
|
||||||
section.form-wrapper.flexleft.mt-10 |
|
||||||
form.form-post(action=`/forms/global/deletenews`, enctype='application/x-www-form-urlencoded', method='POST') |
|
||||||
input(type='hidden' name='_csrf' value=csrf) |
|
||||||
each post in news |
|
||||||
+newspost(post, true) |
|
||||||
if news.length === 1 |
|
||||||
.anchor |
|
||||||
input(type='submit', value='delete') |
|
||||||
hr(size=1) |
|
||||||
h4.no-m-p Delete board: |
|
||||||
section.form-wrapper.flexleft.mt-10 |
|
||||||
form.form-post(action=`/forms/global/deleteboard`, enctype='application/x-www-form-urlencoded', method='POST') |
|
||||||
input(type='hidden' name='_csrf' value=csrf) |
|
||||||
section.row |
|
||||||
.label I'm sure |
|
||||||
label.postform-style.ph-5 |
|
||||||
input(type='checkbox', name='confirm', value='true' required) |
|
||||||
section.row |
|
||||||
.label Board URI |
|
||||||
input(type='text' name='uri' required) |
|
||||||
input(type='submit', value='submit') |
|
||||||
hr(size=1) |
|
||||||
h4.no-m-p Accounts: |
|
||||||
section.form-wrapper.flexleft.mt-10 |
|
||||||
form.form-post(action=`/forms/global/editaccounts` method='POST' enctype='application/x-www-form-urlencoded') |
|
||||||
input(type='hidden' name='_csrf' value=csrf) |
|
||||||
.table-container.flex-left.mv-10 |
|
||||||
table |
|
||||||
tr |
|
||||||
th |
|
||||||
th Username |
|
||||||
th Auth Level |
|
||||||
for account in accounts |
|
||||||
tr |
|
||||||
td: input(type='checkbox', name='checkedaccounts[]' value=account._id) |
|
||||||
td #{account._id} |
|
||||||
td #{account.authLevel} |
|
||||||
section.row |
|
||||||
.label Delete Accounts |
|
||||||
label.postform-style.ph-5 |
|
||||||
input(type='checkbox', name='delete_account', value='true') |
|
||||||
section.row |
|
||||||
.label Auth Level |
|
||||||
input(type='number' name='auth_level') |
|
||||||
input(type='submit', value='apply') |
|
||||||
hr(size=1) |
|
||||||
h4.no-m-p Global Reports: |
|
||||||
form(action=`/forms/global/actions` method='POST' enctype='application/x-www-form-urlencoded') |
|
||||||
input(type='hidden' name='_csrf' value=csrf) |
|
||||||
if reports.length === 0 |
|
||||||
p No reports. |
|
||||||
else |
|
||||||
for report in reports |
|
||||||
section.thread |
|
||||||
+post(report, false, false, true) |
|
||||||
hr(size=1) |
|
||||||
include ../includes/actionfooter_globalmanage.pug |
|
||||||
hr(size=1) |
|
||||||
h4.no-m-p Global Bans & Appeals: |
|
||||||
form(action=`/forms/global/unban` method='POST' enctype='application/x-www-form-urlencoded') |
|
||||||
input(type='hidden' name='_csrf' value=csrf) |
|
||||||
if bans.length === 0 |
|
||||||
p No bans. |
|
||||||
else |
|
||||||
include ../includes/bantable.pug |
|
||||||
for ban in bans |
|
||||||
+ban(ban) |
|
||||||
section.action-wrapper |
|
||||||
input(type='submit', value='unban') |
|
@ -0,0 +1,35 @@ |
|||||||
|
extends ../layout.pug |
||||||
|
include ../mixins/globalmanagenav.pug |
||||||
|
|
||||||
|
block head |
||||||
|
script(src='/js/all.js') |
||||||
|
title Manage |
||||||
|
|
||||||
|
block content |
||||||
|
h1.board-title Global Management |
||||||
|
br |
||||||
|
+globalmanagenav('accounts') |
||||||
|
hr(size=1) |
||||||
|
h4.no-m-p Accounts: |
||||||
|
section.form-wrapper.flexleft.mt-10 |
||||||
|
form.form-post(action=`/forms/global/editaccounts` method='POST' enctype='application/x-www-form-urlencoded') |
||||||
|
input(type='hidden' name='_csrf' value=csrf) |
||||||
|
.table-container.flex-left.mv-10 |
||||||
|
table |
||||||
|
tr |
||||||
|
th |
||||||
|
th Username |
||||||
|
th Auth Level |
||||||
|
for account in accounts |
||||||
|
tr |
||||||
|
td: input(type='checkbox', name='checkedaccounts[]' value=account._id) |
||||||
|
td #{account._id} |
||||||
|
td #{account.authLevel} |
||||||
|
section.row |
||||||
|
.label Delete Accounts |
||||||
|
label.postform-style.ph-5 |
||||||
|
input(type='checkbox', name='delete_account', value='true') |
||||||
|
section.row |
||||||
|
.label Set Auth Level |
||||||
|
input(type='number' name='auth_level') |
||||||
|
input(type='submit', value='apply') |
@ -0,0 +1,24 @@ |
|||||||
|
extends ../layout.pug |
||||||
|
include ../mixins/ban.pug |
||||||
|
include ../mixins/globalmanagenav.pug |
||||||
|
|
||||||
|
block head |
||||||
|
script(src='/js/all.js') |
||||||
|
title Manage |
||||||
|
|
||||||
|
block content |
||||||
|
h1.board-title Global Management |
||||||
|
br |
||||||
|
+globalmanagenav('bans') |
||||||
|
hr(size=1) |
||||||
|
h4.no-m-p Global Bans & Appeals: |
||||||
|
form(action=`/forms/global/unban` method='POST' enctype='application/x-www-form-urlencoded') |
||||||
|
input(type='hidden' name='_csrf' value=csrf) |
||||||
|
if bans.length === 0 |
||||||
|
p No bans. |
||||||
|
else |
||||||
|
include ../includes/bantable.pug |
||||||
|
for ban in bans |
||||||
|
+ban(ban) |
||||||
|
section.action-wrapper |
||||||
|
input(type='submit', value='unban') |
@ -0,0 +1,24 @@ |
|||||||
|
extends ../layout.pug |
||||||
|
include ../mixins/globalmanagenav.pug |
||||||
|
|
||||||
|
block head |
||||||
|
script(src='/js/all.js') |
||||||
|
title Manage |
||||||
|
|
||||||
|
block content |
||||||
|
h1.board-title Global Management |
||||||
|
br |
||||||
|
+globalmanagenav('boards') |
||||||
|
hr(size=1) |
||||||
|
h4.no-m-p Delete board: |
||||||
|
section.form-wrapper.flexleft.mt-10 |
||||||
|
form.form-post(action=`/forms/global/deleteboard`, enctype='application/x-www-form-urlencoded', method='POST') |
||||||
|
input(type='hidden' name='_csrf' value=csrf) |
||||||
|
section.row |
||||||
|
.label I'm sure |
||||||
|
label.postform-style.ph-5 |
||||||
|
input(type='checkbox', name='confirm', value='true' required) |
||||||
|
section.row |
||||||
|
.label Board URI |
||||||
|
input(type='text' name='uri' required) |
||||||
|
input(type='submit', value='submit') |
@ -0,0 +1,35 @@ |
|||||||
|
extends ../layout.pug |
||||||
|
include ../mixins/newspost.pug |
||||||
|
include ../mixins/globalmanagenav.pug |
||||||
|
|
||||||
|
block head |
||||||
|
script(src='/js/all.js') |
||||||
|
title Manage |
||||||
|
|
||||||
|
block content |
||||||
|
h1.board-title Global Management |
||||||
|
br |
||||||
|
+globalmanagenav('news') |
||||||
|
hr(size=1) |
||||||
|
h4.no-m-p Add News: |
||||||
|
section.form-wrapper.flexleft.mt-10 |
||||||
|
form.form-post(action=`/forms/global/addnews`, enctype='application/x-www-form-urlencoded', method='POST') |
||||||
|
input(type='hidden' name='_csrf' value=csrf) |
||||||
|
section.row |
||||||
|
.label Title |
||||||
|
input(type='text' name='title' required) |
||||||
|
section.row |
||||||
|
.label Message |
||||||
|
textarea(name='message' placeholder='supports post styling' required) |
||||||
|
input(type='submit', value='submit') |
||||||
|
if news.length > 0 |
||||||
|
hr(size=1) |
||||||
|
h4.no-m-p Delete News: |
||||||
|
section.form-wrapper.flexleft.mt-10 |
||||||
|
form.form-post(action=`/forms/global/deletenews`, enctype='application/x-www-form-urlencoded', method='POST') |
||||||
|
input(type='hidden' name='_csrf' value=csrf) |
||||||
|
each post in news |
||||||
|
+newspost(post, true) |
||||||
|
if news.length === 1 |
||||||
|
.anchor |
||||||
|
input(type='submit', value='delete') |
@ -0,0 +1,24 @@ |
|||||||
|
extends ../layout.pug |
||||||
|
include ../mixins/post.pug |
||||||
|
include ../mixins/globalmanagenav.pug |
||||||
|
|
||||||
|
block head |
||||||
|
script(src='/js/all.js') |
||||||
|
title Manage |
||||||
|
|
||||||
|
block content |
||||||
|
h1.board-title Global Management |
||||||
|
br |
||||||
|
+globalmanagenav('reports') |
||||||
|
hr(size=1) |
||||||
|
h4.no-m-p Global Reports: |
||||||
|
form(action=`/forms/global/actions` method='POST' enctype='application/x-www-form-urlencoded') |
||||||
|
input(type='hidden' name='_csrf' value=csrf) |
||||||
|
if reports.length === 0 |
||||||
|
p No reports. |
||||||
|
else |
||||||
|
for report in reports |
||||||
|
section.thread |
||||||
|
+post(report, false, false, true) |
||||||
|
hr(size=1) |
||||||
|
include ../includes/actionfooter_globalmanage.pug |
Loading…
Reference in new issue