facebookcl 0.2.3 → 0.2.4
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.
- data/VERSION +1 -1
- data/facebookcl.gemspec +1 -1
- data/lib/facebookcl.rb +15 -8
- metadata +3 -3
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.4
|
data/facebookcl.gemspec
CHANGED
data/lib/facebookcl.rb
CHANGED
|
@@ -13,7 +13,7 @@ module FacebookCL; class << self
|
|
|
13
13
|
APP_ID = 119412046078
|
|
14
14
|
SERVER_PORT = 6682
|
|
15
15
|
GRAPH_URL = 'graph.facebook.com'
|
|
16
|
-
NEXT_URL = 'http://
|
|
16
|
+
NEXT_URL = 'http://127.0.0.1:6682'
|
|
17
17
|
|
|
18
18
|
attr_accessor :uid
|
|
19
19
|
|
|
@@ -24,8 +24,7 @@ module FacebookCL; class << self
|
|
|
24
24
|
self.access_token = data['access_token']
|
|
25
25
|
self.uid = data['uid']
|
|
26
26
|
else
|
|
27
|
-
auth_url = "https://#{GRAPH_URL}/oauth/authorize?client_id=#{APP_ID}&redirect_uri=#{NEXT_URL}&scope=publish_stream,create_event,offline_access,email,read_stream,read_mailbox"
|
|
28
|
-
|
|
27
|
+
auth_url = "https://#{GRAPH_URL}/oauth/authorize?client_id=#{APP_ID}&redirect_uri=#{NEXT_URL}&type=user_agent&display=page&scope=publish_stream,create_event,offline_access,email,read_stream,read_mailbox"
|
|
29
28
|
if (RUBY_PLATFORM.downcase.include?("darwin"))
|
|
30
29
|
`open '#{auth_url}'`
|
|
31
30
|
else
|
|
@@ -35,18 +34,26 @@ Welcome New User! You need to auth this application. So please visit here in y
|
|
|
35
34
|
#{auth_url}}
|
|
36
35
|
end
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
server = TCPServer.new('127.0.0.1', SERVER_PORT)
|
|
38
|
+
session = server.accept
|
|
39
39
|
session.print "HTTP/1.1 200/OK\r\nContent-type:text/html\r\n\r\n"
|
|
40
|
-
|
|
40
|
+
session.gets
|
|
41
|
+
session.print "<script>
|
|
42
|
+
window.location.replace(window.location.toString().replace('#', '?'))
|
|
43
|
+
</script>"
|
|
44
|
+
session.close
|
|
41
45
|
|
|
42
|
-
session
|
|
43
|
-
|
|
46
|
+
session = server.accept
|
|
47
|
+
session.print "HTTP/1.1 200/OK\r\nContent-type:text/html\r\n\r\n"
|
|
48
|
+
request = session.gets.strip
|
|
49
|
+
session.print "Success! " +
|
|
50
|
+
"You can now close this window and return to FacebookCL."
|
|
44
51
|
session.close
|
|
52
|
+
server.close
|
|
45
53
|
|
|
46
54
|
self.access_token = request.
|
|
47
55
|
gsub(/^GET \/\?access_token=/, '').
|
|
48
56
|
gsub(/ HTTP.*$/, '')
|
|
49
|
-
|
|
50
57
|
self.uid = get('me')['id']
|
|
51
58
|
|
|
52
59
|
puts "Saving authentication data to #{config_filename}"
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: facebookcl
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 31
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 2
|
|
9
|
-
-
|
|
10
|
-
version: 0.2.
|
|
9
|
+
- 4
|
|
10
|
+
version: 0.2.4
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Justin Bishop
|