torblocker 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2f5d5281567232c628edebeb550ea42ef9e371a
4
- data.tar.gz: ff4b07338d41a87a3d2db5c660030b215d44fa1a
3
+ metadata.gz: 27f6b795c965ace98b8efdf8d0105396745e38ca
4
+ data.tar.gz: 81b69b5e0c919cab91da1d706a47be205155d619
5
5
  SHA512:
6
- metadata.gz: cdd43283c1ef22c618d927b3a14ddc6d737e6b0de126a6b7a933517669a5223281e1a6cbd29fd3f2fe899d3b2e3d0985c3344e4f5e2efa2c0e5ccff9e4fa003e
7
- data.tar.gz: a439f9a21ff8af0f91e7331c8bf9fc162ed1b98035a7712abf65121d165d92ecd68441360f8b5a21f86c1d4061311971478394226e0aca9ebbf7f17418f8cd55
6
+ metadata.gz: 2cb4b7b7280aba4c01d2a3fc929477872a1f3802c45e09ebd4766aafed587506be8859c323550747427c8be2b76aac214a9d2354f0b9b7d9a91d799855108830
7
+ data.tar.gz: 94fb34a9fe15dbf767255324f2b58aad5b662270faed62560c97b7212fe735eb16b254689393349ea3694ae78a92276154912789797935c462f559c7f3587915
@@ -2,19 +2,23 @@ require "torblocker/version"
2
2
 
3
3
  module Torblocker
4
4
  def self.untrusted?(ip,token)
5
- uri = URI.parse('https://torblocker.com/v1?ip=<%= ip %>')
5
+ uri = URI.parse('https://torblocker.com/v1?ip=' + ip.to_s)
6
6
  http = Net::HTTP.new(uri.host, uri.port)
7
+ http.use_ssl = true
8
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
7
9
  request = Net::HTTP::Get.new(uri)
8
- request['authorization'] = "Token token=<%=token%>"
10
+ request['authorization'] = "Token token=" + token.to_s
9
11
  response = http.request(request)
10
12
  response.body == 1 || response.body == "1"
11
13
  end
12
14
 
13
15
  def self.trusted?(ip,token)
14
- uri = URI.parse('https://torblocker.com/v1?ip=<%= ip %>')
16
+ uri = URI.parse('http://torblocker.com/v1?ip=' + ip.to_s)
15
17
  http = Net::HTTP.new(uri.host, uri.port)
18
+ http.use_ssl = true
19
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
16
20
  request = Net::HTTP::Get.new(uri)
17
- request['authorization'] = "Token token=<%=token%>"
21
+ request['authorization'] = "Token token=" + token.to_s
18
22
  response = http.request(request)
19
23
  response.body != 1 && response.body != "1"
20
24
  end
@@ -1,3 +1,3 @@
1
1
  module Torblocker
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torblocker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - chienomi