0.8.3: Fix the broken tor exit node blocker.

This commit is contained in:
Fijxu 2024-08-10 21:48:45 -04:00
parent 9cd9bc689a
commit ede4cb896c
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4

View file

@ -17,7 +17,10 @@ module Routing
end end
before_post do |env| before_post do |env|
ip_address = env.request.headers.try &.["X-Forwarded-For"]? ? env.request.headers.["X-Forwarded-For"] : env.request.remote_address.to_s.split(":").first ip_address = env.request.headers.try &.["X-Forwarded-For"]? ? env.request.headers.["X-Forwarded-For"] : env.request.remote_address.to_s.split(":").first
error401 CONFIG.torMessage if ip_address.includes?(ip_address) if ip_address.includes?(ip_address)
# TODO: Custom halt function to return a JSON
halt env, status_code: 401, response: CONFIG.torMessage
end
end end
end end