quick way to make bypasses in a frame

merge-requests/208/head
fatchan 4 years ago
parent 8b5c88332c
commit 1d1f42f94d
  1. 2
      controllers/pages.js
  2. 9
      gulp/res/css/style.css
  3. 2
      helpers/checks/blockbypass.js
  4. 3
      helpers/dynamic.js
  5. 6
      helpers/setminimal.js
  6. 6
      helpers/tasks.js
  7. 1
      models/forms/blockbypass.js
  8. 2
      models/pages/blockbypass.js
  9. 17
      views/includes/footer.pug
  10. 17
      views/includes/navbar.pug
  11. 2
      views/layout.pug
  12. 5
      views/mixins/modal.pug
  13. 2
      views/pages/bypass.pug

@ -11,6 +11,7 @@ const express = require('express')
, paramConverter = require(__dirname+'/../helpers/paramconverter.js')
, sessionRefresh = require(__dirname+'/../helpers/sessionrefresh.js')
, csrf = require(__dirname+'/../helpers/checks/csrfmiddleware.js')
, setMinimal = require(__dirname+'/../helpers/setminimal.js')
//page models
, { manageReports, manageBanners, manageSettings, manageBans, manageBoard, manageThread } = require(__dirname+'/../models/pages/manage/')
, { globalManageSettings, globalManageReports, globalManageBans,
@ -60,6 +61,7 @@ router.get('/globalmanage/settings.html', sessionRefresh, isLoggedIn, calcPerms,
router.get('/captcha', captcha); //get captcha image and cookie
router.get('/captcha.html', captchaPage); //iframed for noscript users
router.get('/bypass.html', blockBypass); //block bypass page
router.get('/bypass_minimal.html', setMinimal, blockBypass); //block bypass page
//accounts
router.get('/account.html', sessionRefresh, isLoggedIn, account); //page showing boards you are mod/owner of, links to password rese, logout, etc

@ -13,6 +13,9 @@ body {
main {
margin: 3em 0 0 0;
}
main.minimal {
margin: 0;
}
.row {
display: flex;
@ -884,11 +887,15 @@ input[type="file"] {
box-sizing: border-box;
}
iframe.captcha {
iframe.captcha, iframe.bypass {
/*dumb hack cos of noscript wrapping in unstyleable span*/
margin-bottom: -2px;
}
iframe.bypass {
height: 215px;
}
.captcha {
border: 1px solid var(--input-borders);
background: white;

@ -18,6 +18,7 @@ module.exports = async (req, res, next) => {
return dynamicResponse(req, res, 403, 'message', {
'title': 'Forbidden',
'message': 'Missing or invalid block bypass',
'frame': '/bypass_minimal.html',
'link': {
'href': '/bypass.html',
'text': 'Get block bypass',
@ -57,6 +58,7 @@ module.exports = async (req, res, next) => {
return dynamicResponse(req, res, 403, 'message', {
'title': 'Forbidden',
'message': 'Block bypass expired or exceeded max uses',
'frame': '/bypass_minimal.html',
'link': {
'href': '/bypass.html',
'text': 'Get block bypass',

@ -1,6 +1,9 @@
'use strict';
module.exports = (req, res, code, page, data) => {
if (req.body.minimal) {
data.minimal = true;
}
res.status(code);
if (req.headers['x-using-xhr'] != null) {
return res.json(data);

@ -0,0 +1,6 @@
'use strict';
module.exports = (req, res, next) => {
res.locals.minimal = true;
next();
}

@ -230,8 +230,10 @@ module.exports = {
return render('register.html', 'register.pug');
},
buildBypass: () => {
return render('bypass.html', 'bypass.pug');
buildBypass: (minimal=false) => {
return render(`bypass${minimal ? '_minimal' : ''}.html`, 'bypass.pug', {
minimal,
});
},
buildCreate: () => {

@ -17,6 +17,7 @@ module.exports = async (req, res, next) => {
'sameSite': 'strict'
})
.render('message', {
'minimal': req.body.minimal, //todo: make use x- header for ajax once implm.
'title': 'Success',
'message': 'Completed block bypass, you may go back and make your post.',
});

@ -6,7 +6,7 @@ module.exports = async (req, res, next) => {
let html;
try {
html = await buildBypass();
html = await buildBypass(res.locals.minimal);
} catch (err) {
return next(err);
}

@ -1,9 +1,10 @@
small.footer#bottom
| -
a(href='/rules.html') rules
| -
a(href='/faq.html') faq
| -
a(href='https://github.com/fatchan/jschan/') source code
| -
unless minimal
small.footer#bottom
| -
a(href='/rules.html') rules
| -
a(href='/faq.html') faq
| -
a(href='https://github.com/fatchan/jschan/') source code
| -
script(src='/js/render.js')

@ -1,8 +1,9 @@
nav.navbar
a.nav-item(href='/index.html') Home
a.nav-item(href='/news.html') News
a.nav-item(href='/boards.html') Boards
a.nav-item(href='/account.html') Account
if board
a.nav-item(href=`/${board._id}/manage/reports.html`) Manage
a.jsonly.nav-item.right#settings
unless minimal
nav.navbar
a.nav-item(href='/index.html') Home
a.nav-item(href='/news.html') News
a.nav-item(href='/boards.html') Boards
a.nav-item(href='/account.html') Account
if board
a.nav-item(href=`/${board._id}/manage/reports.html`) Manage
a.jsonly.nav-item.right#settings

@ -5,7 +5,7 @@ html
block head
body#top
include includes/navbar.pug
main
main(class=(minimal?'minimal':''))
.container
block content
include includes/footer.pug

@ -17,7 +17,10 @@ mixin modal(data)
if data.errors
each error in data.errors
li #{error}
if data.link
if data.frame
.row
iframe.bypass(src=data.frame frameborder='0' scrolling='no')
else if data.link
.row
a.button.mv-0(href=data.link.href target='_blank') #{data.link.text}
else if data.settings

@ -12,4 +12,6 @@ block content
.label Captcha
span.col
include ../includes/captcha.pug
if minimal
input(type='hidden' name='minimal' value='1')
input(type='submit', value='Submit')

Loading…
Cancel
Save