mirror of
https://github.com/neocities/neocities.git
synced 2025-07-24 11:28:29 +02:00
mechanism to report spam ips to stopforumspam
This commit is contained in:
parent
7be37ce595
commit
bedc08cb58
10 changed files with 38 additions and 25 deletions
12
app/admin.rb
12
app/admin.rb
|
@ -236,7 +236,7 @@ post '/admin/banhammer' do
|
|||
site.ban!
|
||||
deleted_count += 1
|
||||
|
||||
if !params[:ban_using_ips].empty? && !site.ip.empty?
|
||||
if !params[:ban_using_ips].empty? && IPAddress.valid?(site.ip)
|
||||
sites = Site.filter(ip: site.ip, is_banned: false).all
|
||||
sites.each do |s|
|
||||
next if usernames.include?(s.username)
|
||||
|
@ -244,6 +244,16 @@ post '/admin/banhammer' do
|
|||
end
|
||||
ip_deleted_count += 1
|
||||
end
|
||||
|
||||
if params[:classifier] == 'spam' || params[:classifier] == 'phishing'
|
||||
next unless IPAddress.valid?(site.ip)
|
||||
StopForumSpamWorker.perform_async(
|
||||
username: site.username,
|
||||
email: site.email,
|
||||
ip: site.ip,
|
||||
evidence: "#{params[:classifier]}\n#{site.screenshot_url(Site::SCREENSHOT_RESOLUTIONS.first)}"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
flash[:success] = "#{ip_deleted_count + deleted_count} sites have been banned, including #{ip_deleted_count} matching IPs."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue