@ -4,6 +4,7 @@ const changeGlobalSettings = require(__dirname+'/../../models/forms/changeglobal
, dynamicResponse = require ( _ _dirname + '/../../lib/misc/dynamic.js' )
, dynamicResponse = require ( _ _dirname + '/../../lib/misc/dynamic.js' )
, themeHelper = require ( _ _dirname + '/../../lib/misc/themes.js' )
, themeHelper = require ( _ _dirname + '/../../lib/misc/themes.js' )
, config = require ( _ _dirname + '/../../lib/misc/config.js' )
, config = require ( _ _dirname + '/../../lib/misc/config.js' )
, { fontPaths } = require ( _ _dirname + '/../../lib/misc/fonts.js' )
, paramConverter = require ( _ _dirname + '/../../lib/middleware/input/paramconverter.js' )
, paramConverter = require ( _ _dirname + '/../../lib/middleware/input/paramconverter.js' )
, { checkSchema , lengthBody , numberBody , minmaxBody , numberBodyVariable ,
, { checkSchema , lengthBody , numberBody , minmaxBody , numberBodyVariable ,
inArrayBody } = require ( _ _dirname + '/../../lib/input/schema.js' ) ;
inArrayBody } = require ( _ _dirname + '/../../lib/input/schema.js' ) ;
@ -13,8 +14,8 @@ module.exports = {
paramConverter : paramConverter ( {
paramConverter : paramConverter ( {
timeFields : [ 'ban_duration' , 'board_defaults_filter_ban_duration' , 'default_ban_duration' , 'block_bypass_expire_after_time' , 'dnsbl_cache_time' , 'board_defaults_delete_protection_age' ] ,
timeFields : [ 'ban_duration' , 'board_defaults_filter_ban_duration' , 'default_ban_duration' , 'block_bypass_expire_after_time' , 'dnsbl_cache_time' , 'board_defaults_delete_protection_age' ] ,
trimFields : [ 'captcha_options_grid_question' , 'captcha_options_grid_trues' , 'captcha_options_grid_falses' , 'allowed_hosts' , 'dnsbl_blacklists' , 'other_mime_types' ,
trimFields : [ 'captcha_options_grid_question' , 'captcha_options_grid_trues' , 'captcha_options_grid_falses' , 'allowed_hosts' , 'dnsbl_blacklists' , 'other_mime_types' ,
'highlight_options_language_subset' , 'global_limits_custom_css_filters' , 'board_defaults_filters' , 'filters' , 'archive_links' , 'reverse_links' ] ,
'highlight_options_language_subset' , 'global_limits_custom_css_filters' , 'board_defaults_filters' , 'filters' , 'archive_links' , 'reverse_links' , 'captcha_options_text_font' ] ,
numberFields : [ 'filter_mode' , 'auth_level' ,
numberFields : [ 'filter_mode' , 'auth_level' , 'captcha_options_text_wave' , 'captcha_options_text_paint' , 'captcha_options_text_noise' ,
'captcha_options_generate_limit' , 'captcha_options_grid_size' , 'captcha_options_grid_image_size' , 'captcha_options_num_distorts_min' , 'captcha_options_num_distorts_max' ,
'captcha_options_generate_limit' , 'captcha_options_grid_size' , 'captcha_options_grid_image_size' , 'captcha_options_num_distorts_min' , 'captcha_options_num_distorts_max' ,
'captcha_options_distortion' , 'captcha_options_grid_icon_y_offset' , 'flood_timers_same_content_same_ip' , 'flood_timers_same_content_any_ip' , 'flood_timers_any_content_same_ip' ,
'captcha_options_distortion' , 'captcha_options_grid_icon_y_offset' , 'flood_timers_same_content_same_ip' , 'flood_timers_same_content_any_ip' , 'flood_timers_any_content_same_ip' ,
'block_bypass_expire_after_uses' , 'rate_limit_cost_captcha' , 'rate_limit_cost_board_settings' , 'rate_limit_cost_edit_post' ,
'block_bypass_expire_after_uses' , 'rate_limit_cost_captcha' , 'rate_limit_cost_board_settings' , 'rate_limit_cost_edit_post' ,
@ -58,7 +59,7 @@ module.exports = {
} , expected : false , error : 'Extra mime types must be like type/subtype' } ,
} , expected : false , error : 'Extra mime types must be like type/subtype' } ,
{ result : ( ) => {
{ result : ( ) => {
if ( req . body . archive _links ) {
if ( req . body . archive _links ) {
/* eslint-disable no-useless-escape */
/* eslint-disable no-useless-escape */
return /https?\:\/\/[^\s<>\[\]{}|\\^]+%s[^\s<>\[\]{}|\\^]*/i . test ( req . body . archive _links ) ;
return /https?\:\/\/[^\s<>\[\]{}|\\^]+%s[^\s<>\[\]{}|\\^]*/i . test ( req . body . archive _links ) ;
}
}
return false ;
return false ;
@ -87,6 +88,10 @@ module.exports = {
{ result : numberBody ( req . body . captcha _options _num _distorts _max , 0 , 10 ) , expected : true , error : 'Captcha options max distorts must be a number from 0-10' } ,
{ result : numberBody ( req . body . captcha _options _num _distorts _max , 0 , 10 ) , expected : true , error : 'Captcha options max distorts must be a number from 0-10' } ,
{ result : minmaxBody ( req . body . captcha _options _num _distorts _min , req . body . captcha _options _num _distorts _max ) , expected : true , error : 'Captcha options distorts min must be less than max' } ,
{ result : minmaxBody ( req . body . captcha _options _num _distorts _min , req . body . captcha _options _num _distorts _max ) , expected : true , error : 'Captcha options distorts min must be less than max' } ,
{ result : numberBody ( req . body . captcha _options _distortion , 0 , 50 ) , expected : true , error : 'Captcha options distortion must be a number from 0-50' } ,
{ result : numberBody ( req . body . captcha _options _distortion , 0 , 50 ) , expected : true , error : 'Captcha options distortion must be a number from 0-50' } ,
{ result : inArrayBody ( req . body . captcha _options _text _font , fontPaths ) , expected : true , error : 'Invalid captcha options text font' } ,
{ result : numberBody ( req . body . captcha _options _text _wave , 0 , 10 ) , expected : true , error : 'Captcha options text wave effect strength must be a number form 0-10' } ,
{ result : numberBody ( req . body . captcha _options _text _paint , 0 , 10 ) , expected : true , error : 'Captcha options text paint effect strength must be a number from 0-10' } ,
{ result : numberBody ( req . body . captcha _options _text _noise , 0 , 10 ) , expected : true , error : 'Captcha options text noise effect strength must be a number from 0-10' } ,
{ result : numberBody ( req . body . dnsbl _cache _time ) , expected : true , error : 'Invalid dnsbl cache time' } ,
{ result : numberBody ( req . body . dnsbl _cache _time ) , expected : true , error : 'Invalid dnsbl cache time' } ,
{ result : numberBody ( req . body . flood _timers _same _content _same _ip ) , expected : true , error : 'Invalid flood time same content same ip' } ,
{ result : numberBody ( req . body . flood _timers _same _content _same _ip ) , expected : true , error : 'Invalid flood time same content same ip' } ,
{ result : numberBody ( req . body . flood _timers _same _content _any _ip ) , expected : true , error : 'Invalid flood time same contenet any ip' } ,
{ result : numberBody ( req . body . flood _timers _same _content _any _ip ) , expected : true , error : 'Invalid flood time same contenet any ip' } ,