sf-gdrive 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1af454780cbf5115041e33273ff51e72b5c84e6b
4
- data.tar.gz: d1d98e944b9bbcafb87dd13ab937007af106a8d0
3
+ metadata.gz: c1621f24a75c22f6bab7ad05adb924df7fb64904
4
+ data.tar.gz: b96f1a3b2918b368e7ee33a09c9195df09c1bb00
5
5
  SHA512:
6
- metadata.gz: cedf5f283aaea3c77b82decd7141f5cc18def7be76a8ba46a55fcc2ef0ad9fab9bba1ea424775d39dc512da9171fad2df4e9fd08bf84adf2dd4ecf5ac9987b06
7
- data.tar.gz: 0b678b751dc78bfee914c89f8f224f8b1c7718a8cf5af6f8359feafaf00e2e620b1389ad6d479ffb75643bbaaf7bea0bc0ab27f9c42c4c6941aec968349d457b
6
+ metadata.gz: e0bf3abe215b0a6cc22ecef889a0913a7db5e1a36dc5fdb8df810482febf05bcecbe4a8c088c46e617d82827c094f6be5d471e4fc603a7dd20951f5c3cc93c40
7
+ data.tar.gz: 00c28b4714c9e186a7d1995ac4e2eac2035b7e3ac349226b9e573ec305947ea0df460311fc48d89c3909064220651481f196804e9be999a56f80fddc85377558
@@ -18,11 +18,19 @@ module Gdrive
18
18
  else
19
19
  auth_code = params[:code]
20
20
  auth_client.code = auth_code
21
- auth_client.fetch_access_token!
22
- secret_hash = auth_client.as_json.slice("expiry", "refresh_token", "access_token")
23
- secret_hash[:expires_at] = auth_client.expires_at
24
- secret = Base64.encode64(secret_hash.to_json)
25
- @secret_url = "#{Gdrive.mount_url}/sync?key=#{secret}"
21
+ begin
22
+ auth_client.fetch_access_token!
23
+ secret_hash = auth_client.as_json.slice("expiry", "refresh_token", "access_token")
24
+ if secret_hash[:refresh_token] == nil
25
+ @error = 'You have already authorized this application. In order to re-configure, go to https://myaccount.google.com/permissions and revoke access to "Standard File".'
26
+ else
27
+ secret_hash[:expires_at] = auth_client.expires_at
28
+ secret = Base64.encode64(secret_hash.to_json)
29
+ @secret_url = "#{Gdrive.mount_url}/sync?key=#{secret}"
30
+ end
31
+ rescue
32
+ redirect_to(Gdrive.mount_url)
33
+ end
26
34
  end
27
35
  end
28
36
 
@@ -18,6 +18,8 @@
18
18
 
19
19
  <p>That's it! Now, whenever you make changes to a note or tag, it will automatically be synced to your Drive.<p>
20
20
 
21
+ <% elsif @error %>
22
+ <strong style="color: red;">Error:</strong> <%= @error %>
21
23
  <% else %>
22
24
  <a href="<%= @auth_uri %>">Link Google Drive</a>
23
25
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module Gdrive
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sf-gdrive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - "@StandardNotes"
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-01 00:00:00.000000000 Z
11
+ date: 2017-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails