27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/omniauth/strategies/blockstack.rb', line 27
def request_phase
app_manifest = {
:name => options.app_name,
:short_name => (options.app_short_name ? options.app_short_name : options.app_name),
:start_url => callback_url,
:display => "standalone",
:background_color => "#fff",
:description => options.app_description,
:icons => options.app_icons
}
if request.params["manifest"]
return Rack::Response.new(app_manifest.to_json,
200,
'content-type' => 'text/json',
'Access-Control-Allow-Origin' => '*').finish
end
blockstack_js = File.open(File.join(File.dirname(__FILE__), "blockstack.js"), "rb").read
auth_request_js = File.open(File.join(File.dirname(__FILE__), "auth-request.js"), "rb").read
= "<script>#{blockstack_js}</script>"
app_data_js = " var manifestURI = \"\#{callback_url.chomp(\"/callback\") + \"?manifest=true\"}\"\n var redirectURI = \"\#{callback_url}\"\n\n JAVASCRIPT\n\n header_info << \"<script>\#{app_data_js}</script>\"\n header_info << \"<script>\#{auth_request_js}</script>\"\n\n title = \"Redirecting to Blockstack\"\n html << <<-HTML\n <!DOCTYPE html>\n <html>\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n <title>\#{title}</title>\n \#{header_info}\n </head>\n <body>Redirecting to blockstack</body>\n </html>\n HTML\n Rack::Response.new(html, 200, 'content-type' => 'text/html').finish\nend\n"
|