mirror of
https://github.com/neocities/neocities.git
synced 2025-07-23 02:56:05 +02:00
block ips rake task
This commit is contained in:
parent
3095185121
commit
7445f8006b
6 changed files with 60 additions and 6 deletions
3
models/blocked_ip.rb
Normal file
3
models/blocked_ip.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class BlockedIp < Sequel::Model
|
||||
|
||||
end
|
|
@ -117,10 +117,14 @@ class Site < Sequel::Model
|
|||
end
|
||||
|
||||
def self.banned_ip?(ip)
|
||||
!Site.where(is_banned: true).
|
||||
where(ip: ip).
|
||||
where(['updated_at > ?', Time.now-BANNED_TIME]).
|
||||
first.nil?
|
||||
return true if Site.where(is_banned: true).
|
||||
where(ip: ip).
|
||||
where(['updated_at > ?', Time.now-BANNED_TIME]).
|
||||
first
|
||||
|
||||
return true if BlockedIp[ip]
|
||||
|
||||
false
|
||||
end
|
||||
|
||||
def is_following?(site)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue