jschan - Anonymous imageboard software. Classic look, modern features and feel. Works without JavaScript and supports Tor, I2P, Lokinet, etc.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.3 KiB

'use strict';
const { Boards } = require(__dirname+'/../../db/');
module.exports = async (req, res, next) => {
const { name, description } = req.body
, uri = req.body.uri.toLowerCase();
const board = await Boards.findOne(uri);
// if board exists reject
if (board != null) {
return res.status(409).render('message', {
'title': 'Conflict',
'message': 'Board with this URI already exists',
'redirect': '/create.html'
});
}
//todo: add a settings for defaults
const newBoard = {
'_id': uri,
'owner': req.session.user.username,
'banners': [],
'sequence_value': 1,
'pph': 0,
'settings': {
name,
description,
'moderators': [],
'locked': false,
'captchaMode': 0,
'tphTrigger': 0,
'tphTriggerAction': 0,
'forceAnon': false,
'early404': true,
'ids': false,
'userPostDelete': true,
'userPostSpoiler': true,
'userPostUnlink': true,
'threadLimit': 200,
'replyLimit': 500,
'maxFiles': 3,
'forceReplyMessage': false,
'forceReplyFile': false,
'forceThreadMessage': false,
'forceThreadFile': false,
'forceThreadSubject': false,
'minThreadMessageLength': 0,
'minReplyMessageLength': 0,
'defaultName': 'Anonymous',
'announcement': {
'raw':null,
'markdown':null
},
'filters':[]
}
}
await Boards.insertOne(newBoard);
return res.redirect(`/${uri}/index.html`);
}