omniauth-blockstack 0.9.3 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
1
  require 'omniauth'
2
2
  require 'blockstack'
3
+ require 'uri'
3
4
 
4
5
  module OmniAuth
5
6
  module Strategies
@@ -15,6 +16,7 @@ module OmniAuth
15
16
  option :valid_within, nil
16
17
  option :blockstack_api, nil
17
18
  option :app_name, nil
19
+ option :app_short_name, nil
18
20
  option :app_description, ""
19
21
  option :app_icons, [{}]
20
22
 
@@ -23,19 +25,33 @@ module OmniAuth
23
25
  end
24
26
 
25
27
  def request_phase
28
+ app_manifest = {
29
+ :name => options.app_name,
30
+ :short_name => (options.app_short_name ? options.app_short_name : options.app_name),
31
+ :start_url => callback_url,
32
+ :display => "standalone",
33
+ :background_color => "#fff",
34
+ :description => options.app_description,
35
+ :icons => options.app_icons.to_json
36
+ }
37
+
38
+ if request.params["manifest"]
39
+ return Rack::Response.new(app_manifest.to_json,
40
+ 200,
41
+ 'content-type' => 'text/json',
42
+ 'Access-Control-Allow-Origin' => '*').finish
43
+ end
44
+
26
45
  blockstack_js = File.open(File.join(File.dirname(__FILE__), "blockstack.js"), "rb").read
27
46
 
28
47
  auth_request_js = File.open(File.join(File.dirname(__FILE__), "auth-request.js"), "rb").read
29
48
 
30
49
  header_info = "<script>#{blockstack_js}</script>"
31
50
  app_data_js = <<~JAVASCRIPT
32
- var signingKey = null
33
- var appManifest = {
34
- name: "#{options.app_name}",
35
- start_url: "#{callback_url}",
36
- description: "#{options.app_description}",
37
- icons: #{options.app_icons.to_json}
38
- }
51
+ var manifestURI = "#{callback_url.chomp("/callback") + "?manifest=true"}"
52
+ var domainName = "#{URI::parse(callback_url).host}"
53
+ var redirectURI = "#{callback_url}"
54
+
39
55
  JAVASCRIPT
40
56
 
41
57
  header_info << "<script>#{app_data_js}</script>"
@@ -25,6 +25,6 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "guard-rspec"
26
26
  spec.add_development_dependency "rack-test"
27
27
 
28
- spec.add_dependency "blockstack", "0.5.7"
28
+ spec.add_dependency "blockstack", "0.5.8"
29
29
  spec.add_dependency "omniauth", "~> 1.1"
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-blockstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Larry Salibra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-17 00:00:00.000000000 Z
11
+ date: 2017-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 0.5.7
103
+ version: 0.5.8
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 0.5.7
110
+ version: 0.5.8
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: omniauth
113
113
  requirement: !ruby/object:Gem::Requirement