|
|
@ -6,6 +6,7 @@ const changeGlobalSettings = require(__dirname+'/../../models/forms/changeglobal |
|
|
|
, config = require(__dirname+'/../../lib/misc/config.js') |
|
|
|
, config = require(__dirname+'/../../lib/misc/config.js') |
|
|
|
, { fontPaths } = require(__dirname+'/../../lib/misc/fonts.js') |
|
|
|
, { fontPaths } = require(__dirname+'/../../lib/misc/fonts.js') |
|
|
|
, paramConverter = require(__dirname+'/../../lib/middleware/input/paramconverter.js') |
|
|
|
, paramConverter = require(__dirname+'/../../lib/middleware/input/paramconverter.js') |
|
|
|
|
|
|
|
, i18n = require(__dirname+'/../../lib/locale/locale.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'); |
|
|
|
|
|
|
|
|
|
|
@ -14,7 +15,7 @@ module.exports = { |
|
|
|
paramConverter: paramConverter({ |
|
|
|
paramConverter: paramConverter({ |
|
|
|
timeFields: ['hot_threads_max_age', 'inactive_account_time', 'ban_duration', 'board_defaults_filter_ban_duration', 'default_ban_duration', 'block_bypass_expire_after_time', 'dnsbl_cache_time', 'board_defaults_delete_protection_age'], |
|
|
|
timeFields: ['hot_threads_max_age', 'inactive_account_time', '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', 'captcha_options_font', 'allowed_hosts', 'dnsbl_blacklists', 'other_mime_types', |
|
|
|
trimFields: ['captcha_options_grid_question', 'captcha_options_grid_trues', 'captcha_options_grid_falses', 'captcha_options_font', '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', 'language'], |
|
|
|
numberFields: ['inactive_account_action', 'abandoned_board_action', 'filter_mode', 'auth_level', 'captcha_options_text_wave', 'captcha_options_text_paint', 'captcha_options_text_noise', |
|
|
|
numberFields: ['inactive_account_action', 'abandoned_board_action', 'filter_mode', 'auth_level', 'captcha_options_text_wave', 'captcha_options_text_paint', 'captcha_options_text_noise', |
|
|
|
'captcha_options_grid_noise', 'captcha_options_grid_edge', 'captcha_options_generate_limit', 'captcha_options_grid_size', 'captcha_options_grid_image_size', |
|
|
|
'captcha_options_grid_noise', 'captcha_options_grid_edge', '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', |
|
|
|
'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', |
|
|
@ -82,6 +83,7 @@ module.exports = { |
|
|
|
{ result: lengthBody(req.body.ip_header, 0, 100), expected: false, error: 'IP header length must not exceed 100 characters' }, |
|
|
|
{ result: lengthBody(req.body.ip_header, 0, 100), expected: false, error: 'IP header length must not exceed 100 characters' }, |
|
|
|
{ result: lengthBody(req.body.meta_site_name, 0, 100), expected: false, error: 'Meta site name must not exceed 100 characters' }, |
|
|
|
{ result: lengthBody(req.body.meta_site_name, 0, 100), expected: false, error: 'Meta site name must not exceed 100 characters' }, |
|
|
|
{ result: lengthBody(req.body.meta_url, 0, 100), expected: false, error: 'Meta url must not exceed 100 characters' }, |
|
|
|
{ result: lengthBody(req.body.meta_url, 0, 100), expected: false, error: 'Meta url must not exceed 100 characters' }, |
|
|
|
|
|
|
|
{ result: inArrayBody(req.body.language, i18n.getLocales()), expected: true, error: 'Invalid language' }, |
|
|
|
{ result: inArrayBody(req.body.captcha_options_type, ['grid', 'grid2', 'text', 'google', 'hcaptcha']), expected: true, error: 'Invalid captcha options type' }, |
|
|
|
{ result: inArrayBody(req.body.captcha_options_type, ['grid', 'grid2', 'text', 'google', 'hcaptcha']), expected: true, error: 'Invalid captcha options type' }, |
|
|
|
{ result: numberBody(req.body.captcha_options_generate_limit, 1), expected: true, error: 'Captcha options generate limit must be a number > 0' }, |
|
|
|
{ result: numberBody(req.body.captcha_options_generate_limit, 1), expected: true, error: 'Captcha options generate limit must be a number > 0' }, |
|
|
|
{ result: numberBody(req.body.captcha_options_grid_size, 2, 6), expected: true, error: 'Captcha options grid size must be a number from 2-6' }, |
|
|
|
{ result: numberBody(req.body.captcha_options_grid_size, 2, 6), expected: true, error: 'Captcha options grid size must be a number from 2-6' }, |
|
|
|