omniauth-pixiv-public 0.1.6 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0d16b85097d5d2f56a5edf0e82b63ba09f4905692f1d606c99df612b289ac5b2
|
4
|
+
data.tar.gz: 5d59780b1aa8ce0e92a63290dbe2a63436c4a22bb943f73e05576aed2f229259
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5693da04cf614a052b06b932439fa92dfdffe78ec13dec703bc5411a6bef531a28ae8cf61f260d5d4e70b858851795d4a6b873cbc1c579c9cffe827575186e2
|
7
|
+
data.tar.gz: 65cdf5008ba1fdaf2c71efb073a4187d24d2d8aca86be81989906b6e8ee1eaa5f49b357a2c4eb72d807e7c4c0006e8c0318cb05ebda1399decf5bbdfa4278675
|
data/lib/omniauth-pixiv.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative '../../version'
|
2
|
+
|
3
|
+
module Omniauth
|
4
|
+
module Pixiv
|
5
|
+
module Faraday
|
6
|
+
module Request
|
7
|
+
class UserAgent < ::Faraday::Middleware
|
8
|
+
DEFAULT_USER_AGENT = "omniauth-pixiv/#{Omniauth::Pixiv::VERSION}"
|
9
|
+
|
10
|
+
def initialize(app, user_agent)
|
11
|
+
@user_agent = user_agent
|
12
|
+
super(app)
|
13
|
+
end
|
14
|
+
|
15
|
+
def call(env)
|
16
|
+
env.request_headers['User-Agent'] = if env.request_headers['User-Agent']
|
17
|
+
@user_agent + " (#{env.request_headers['User-Agent']})"
|
18
|
+
else
|
19
|
+
@user_agent
|
20
|
+
end
|
21
|
+
@app.call(env)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -8,10 +8,11 @@ module OmniAuth
|
|
8
8
|
option :client_options, {
|
9
9
|
site: 'https://public-api.secure.pixiv.net',
|
10
10
|
authorize_url: 'https://oauth.secure.pixiv.net/v2/auth/authorize',
|
11
|
-
token_url: 'https://oauth.secure.pixiv.net/v2/auth/token'
|
11
|
+
token_url: 'https://oauth.secure.pixiv.net/v2/auth/token',
|
12
12
|
}
|
13
13
|
|
14
14
|
option :image_size, 'px_170x170'
|
15
|
+
option :user_agent, Omniauth::Pixiv::Faraday::Request::UserAgent::DEFAULT_USER_AGENT
|
15
16
|
|
16
17
|
uid { raw_info['id'] }
|
17
18
|
|
@@ -29,6 +30,18 @@ module OmniAuth
|
|
29
30
|
{ raw_info: raw_info }
|
30
31
|
end
|
31
32
|
|
33
|
+
def client
|
34
|
+
::OAuth2::Client.new(options.client_id, options.client_secret, deep_symbolize(options.client_options)) do |faraday|
|
35
|
+
faraday.request :url_encoded
|
36
|
+
faraday.request :user_agent, options[:user_agent]
|
37
|
+
faraday.adapter Faraday.default_adapter
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def callback_url
|
42
|
+
full_host + script_name + callback_path
|
43
|
+
end
|
44
|
+
|
32
45
|
def raw_info
|
33
46
|
@raw_info ||= access_token.get(RAW_INFO_URL).parsed['response'].first
|
34
47
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-pixiv-public
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edho Arief
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-03-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth-oauth2
|
@@ -67,6 +67,8 @@ files:
|
|
67
67
|
- README.md
|
68
68
|
- Rakefile
|
69
69
|
- lib/omniauth-pixiv.rb
|
70
|
+
- lib/omniauth-pixiv/faraday.rb
|
71
|
+
- lib/omniauth-pixiv/faraday/request/user_agent.rb
|
70
72
|
- lib/omniauth-pixiv/version.rb
|
71
73
|
- lib/omniauth/strategies/pixiv.rb
|
72
74
|
- omniauth-pixiv-public.gemspec
|
@@ -90,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
92
|
version: '0'
|
91
93
|
requirements: []
|
92
94
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.6
|
95
|
+
rubygems_version: 2.7.6
|
94
96
|
signing_key:
|
95
97
|
specification_version: 4
|
96
98
|
summary: OmniAuth strategy for pixiv.
|