Merge branch 'new-dev' of ssh.gitgud.io:fatchan/jschan into new-dev

jschan
Thomas Lynch 2 years ago
commit 40e3eea934
No known key found for this signature in database
GPG Key ID: 36A72F7C62CF8480
  1. 4
      controllers/forms.js
  2. 6
      db/bypass.js
  3. 4
      helpers/checks/blockbypass.js
  4. 2
      helpers/checks/torprebypass.js
  5. 2
      models/forms/blockbypass.js
  6. 8
      views/custompages/faq.pug

@ -51,14 +51,12 @@ router.post('/board/:board/transfer', useSession, sessionRefresh, csrf, Boards.e
router.post('/board/:board/settings', geoAndTor, torPreBypassCheck, processIp, useSession, sessionRefresh, csrf, Boards.exists, calcPerms, isLoggedIn, hasPerms(2), boardSettingsController.paramConverter, boardSettingsController.controller);
router.post('/board/:board/editbans', useSession, sessionRefresh, csrf, Boards.exists, calcPerms, isLoggedIn, hasPerms(3), editBansController.paramConverter, editBansController.controller); //edit bans
router.post('/board/:board/deleteboard', useSession, sessionRefresh, csrf, Boards.exists, calcPerms, isLoggedIn, hasPerms(config.get.deleteBoardPermLevel), deleteBoardController.controller); //delete board
//board crud banners, flags, assets, custompages
router.post('/board/:board/addbanners', useSession, sessionRefresh, fileMiddlewares.banner, csrf, Boards.exists, calcPerms, isLoggedIn, hasPerms(2), numFiles, uploadBannersController.controller); //add banners
router.post('/board/:board/deletebanners', useSession, sessionRefresh, csrf, Boards.exists, calcPerms, isLoggedIn, hasPerms(2), deleteBannersController.paramConverter, deleteBannersController.controller); //delete banners
///--- wip
router.post('/board/:board/addassets', useSession, sessionRefresh, fileMiddlewares.asset, csrf, Boards.exists, calcPerms, isLoggedIn, hasPerms(2), numFiles, addAssetsController.controller); //add assets
router.post('/board/:board/deleteassets', useSession, sessionRefresh, csrf, Boards.exists, calcPerms, isLoggedIn, hasPerms(2), deleteAssetsController.paramConverter, deleteAssetsController.controller); //delete assets
router.post('/board/:board/addflags', useSession, sessionRefresh, fileMiddlewares.flag, csrf, Boards.exists, calcPerms, isLoggedIn, hasPerms(2), numFiles, addFlagsController.controller); //add flags
router.post('/board/:board/deleteflags', useSession, sessionRefresh, csrf, Boards.exists, calcPerms, isLoggedIn, hasPerms(2), deleteFlagsController.paramConverter, deleteFlagsController.controller); //delete flags
router.post('/board/:board/addcustompages', useSession, sessionRefresh, csrf, Boards.exists, calcPerms, isLoggedIn, hasPerms(2), addCustomPageController.paramConverter, addCustomPageController.controller); //add custom pages

@ -8,10 +8,11 @@ module.exports = {
db,
checkBypass: (id) => {
checkBypass: (id, anonymizer=false) => {
const { blockBypass } = config.get;
return db.findOneAndUpdate({
'_id': id,
'anonymizer': anonymizer,
'uses': {
'$lte': blockBypass.expireAfterUses
}
@ -22,10 +23,11 @@ module.exports = {
}).then(r => r.value);
},
getBypass: () => {
getBypass: (anonymizer=false) => {
const { blockBypass } = config.get;
return db.insertOne({
'uses': 0,
'anonymizer': anonymizer,
'expireAt': new Date(Date.now() + blockBypass.expireAfterTime)
});
},

@ -37,7 +37,7 @@ module.exports = async (req, res, next) => {
if (bypassId && bypassId.length === 24) {
try {
const bypassMongoId = ObjectId(bypassId);
bypass = await Bypass.checkBypass(bypassMongoId);
bypass = await Bypass.checkBypass(bypassMongoId, res.locals.anonymizer);
res.locals.blockBypass = true;
} catch (err) {
return next(err);
@ -53,7 +53,7 @@ module.exports = async (req, res, next) => {
if (res.locals.solvedCaptcha) {
//they dont have a valid bypass, but just solved board captcha, so give them a new one
const newBypass = await Bypass.getBypass();
const newBypass = await Bypass.getBypass(res.locals.anonymizer);
const newBypassId = newBypass.insertedId;
res.locals.blockBypass = true;
res.cookie('bypassid', newBypassId.toString(), {

@ -50,7 +50,7 @@ module.exports = async (req, res, next) => {
&& !blockBypass.forceAnonymizers //AND its not forced for anonymizers
&& !bypassId)) { //AND they dont already have one,
//then give the user a bypass id
const newBypass = await Bypass.getBypass();
const newBypass = await Bypass.getBypass(res.locals.anonymizer);
const newBypassId = newBypass.insertedId;
bypassId = newBypassId.toString();
res.locals.preFetchedBypassId = bypassId;

@ -8,7 +8,7 @@ const { Bypass } = require(__dirname+'/../../db/')
module.exports = async (req, res, next) => {
const { secureCookies, blockBypass } = config.get;
const bypass = await Bypass.getBypass();
const bypass = await Bypass.getBypass(res.locals.anonymizer);
const bypassId = bypass.insertedId;
res.locals.blockBypass = true;

@ -11,7 +11,7 @@ block content
.anchor
table
tr
th Frequently Asked Questions
th Frequently Asked Questions
tr
td.post-message
b General
@ -21,7 +21,7 @@ block content
li: a(href='#contact') How can I contact the administration?
b Making posts
ul.mv-0
li: a(href='#captcha') How do I solve CAPTCHA?
li: a(href='#captcha') How do I solve the CAPTCHA?
li: a(href='#name-formatting') How do names, tripcodes and capcodes work?
li: a(href='#post-styling') What kind of styling options are available when making a post?
li: a(href='#post-info') What is the file size limit?
@ -48,10 +48,10 @@ block content
.anchor#captcha
table
tr
th: a(href='#captcha') How do I solve CAPTCHA?
th: a(href='#captcha') How do I solve the CAPTCHA?
tr
td.post-message
p Select the boxes that correspond to each solid/filled icon in the grid. The image is shuffled and distorted, so use your brain.
| See the #[a(rel='nofollow' referrerpolicy='same-origin' target='_blank' href='http://fatchan.gitgud.site/jschan-docs/#captcha-block-bypass') API docs] for example captchas and solutions.
.table-container.flex-center.mv-5
.anchor#name-formatting
table

Loading…
Cancel
Save