More lenient parsing of blocked_ips.txt and spam_patterns.txt
This commit is contained in:
parent
7ab0f052f3
commit
634bc67342
1 changed files with 7 additions and 3 deletions
|
@ -5,11 +5,15 @@ ActionController::Base.perform_caching = false
|
|||
|
||||
spam_patterns_filename = RAILS_ROOT + '/config/spam_patterns.txt'
|
||||
if File.exists? spam_patterns_filename
|
||||
SPAM_PATTERNS = File.readlines(spam_patterns_filename).select { |line| line != '' }.map {
|
||||
|line| Regexp.new(line) }
|
||||
SPAM_PATTERNS = File.readlines(spam_patterns_filename).delete_if { |line| line.strip.empty? }.map {
|
||||
|line| Regexp.new(line.strip) }
|
||||
end
|
||||
|
||||
blocked_ips_filename = RAILS_ROOT + '/config/blocked_ips.txt'
|
||||
if File.exists? blocked_ips_filename
|
||||
BLOCKED_IPS = File.readlines(blocked_ips_filename).select { |line| line != '' }
|
||||
BLOCKED_IPS = File.readlines(blocked_ips_filename).delete_if { |line| line.strip.empty? }.map {
|
||||
|line| line.strip }
|
||||
end
|
||||
|
||||
require 'breakpoint'
|
||||
breakpoint
|
Loading…
Reference in a new issue