dropbox-folder-sync 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/dropbox-folder +5 -1
- data/lib/dropbox-folder-sync/app.rb +29 -9
- data/lib/dropbox-folder-sync/version.rb +1 -1
- metadata +3 -3
data/bin/dropbox-folder
CHANGED
@@ -25,21 +25,39 @@ class DropboxFolderSync::App
|
|
25
25
|
return true if @session.authorized?
|
26
26
|
end
|
27
27
|
|
28
|
+
req_key = Keystorage.get("DROPBOX_APP_"+APP_KEY+"_REQ_KEY",name)
|
29
|
+
req_secret = Keystorage.get("DROPBOX_APP_"+APP_KEY+"_REQ_SECRET",name)
|
30
|
+
if req_key and req_secret
|
31
|
+
@session.set_request_token(req_key,req_secret)
|
32
|
+
@session.get_access_token rescue {}
|
33
|
+
if @session.authorized?
|
34
|
+
Keystorage.set("DROPBOX_APP_"+APP_KEY+"_USER_KEY",name,@session.access_token.key.to_s)
|
35
|
+
Keystorage.set("DROPBOX_APP_"+APP_KEY+"_USER_SECRET",name,@session.access_token.secret.to_s)
|
36
|
+
Keystorage.delete("DROPBOX_APP_"+APP_KEY+"_REQ_KEY",name)
|
37
|
+
Keystorage.delete("DROPBOX_APP_"+APP_KEY+"_REQ_SECRET",name)
|
38
|
+
return true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
28
43
|
@session.get_request_token
|
29
44
|
authorize_url = @session.get_authorize_url
|
30
|
-
|
45
|
+
log "Login: [#{name}] ---> #{authorize_url}"
|
31
46
|
Launchy.open authorize_url
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
47
|
+
Keystorage.set("DROPBOX_APP_"+APP_KEY+"_REQ_KEY",name,@session.request_token.key.to_s)
|
48
|
+
Keystorage.set("DROPBOX_APP_"+APP_KEY+"_REQ_SECRET",name,@session.request_token.secret.to_s)
|
49
|
+
|
50
|
+
#while 1
|
51
|
+
# @session.get_access_token rescue {}
|
52
|
+
# break if @session.authorized?
|
53
|
+
# sleep 1
|
54
|
+
#end
|
55
|
+
#true
|
40
56
|
end
|
41
57
|
|
42
58
|
def logout name
|
59
|
+
Keystorage.delete("DROPBOX_APP_"+APP_KEY+"_REQ_KEY",name)
|
60
|
+
Keystorage.delete("DROPBOX_APP_"+APP_KEY+"_REQ_SECRET",name)
|
43
61
|
Keystorage.delete("DROPBOX_APP_"+APP_KEY+"_USER_KEY",name)
|
44
62
|
Keystorage.delete("DROPBOX_APP_"+APP_KEY+"_USER_SECRET",name)
|
45
63
|
true
|
@@ -142,6 +160,8 @@ class DropboxFolderSync::App
|
|
142
160
|
name,@remote_root = parse_remote(remote)
|
143
161
|
@local_root = path_normalize(File.expand_path(local))
|
144
162
|
login(name) unless @session.authorized?
|
163
|
+
raise "login before sync" unless @session.authorized?
|
164
|
+
|
145
165
|
@client = DropboxClient.new(@session, :dropbox)
|
146
166
|
log "#{@remote_root} <---> #{@local_root}"
|
147
167
|
@local_files = {}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dropbox-folder-sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Yoshihiro TAKAHARA
|