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.
 
 
 
 
 

50 lines
1.5 KiB

'use strict';
const actions = [
{name:'unlink_file', global:true, auth:false, passwords:true},
{name:'delete_file', global:true, auth:true, passwords:false},
{name:'spoiler', global:true, auth:false, passwords:true},
{name:'delete', global:true, auth:false, passwords:true},
{name:'lock', global:false, auth:true, passwords:false},
{name:'sticky', global:false, auth:true, passwords:false},
{name:'sage', global:false, auth:true, passwords:false},
{name:'report', global:false, auth:false, passwords:false},
{name:'global_report', global:false, auth:false, passwords:false},
{name:'delete_ip_board', global:false, auth:true, passwords:false},
{name:'delete_ip_global', global:true, auth:true, passwords:false},
{name:'dismiss', global:false, auth:true, passwords:false},
{name:'global_dismiss', global:true, auth:true, passwords:false},
{name:'ban', global:false, auth:true, passwords:false},
{name:'global_ban', global:true, auth:true, passwords:false},
];
module.exports = (req, res) => {
let anyGlobal = 0
, anyAuthed = 0
, anyPasswords = 0
, anyValid = 0;
for (let i = 0; i < actions.length; i++) {
const action = actions[i];
const bodyHasAction = req.body[action.name];
if (bodyHasAction) {
anyValid++;
if (action.global) {
anyGlobal++;
}
if (action.auth) {
anyAuthed++;
}
if (action.passwords) {
anyPasswords++;
}
}
if (anyGlobal && anyAuthed && anyValid) {
break;
}
}
return { anyGlobal, anyAuthed, anyValid, anyPasswords };
}