sf-dropbox-ext 0.2.0 → 0.2.5

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
- SHA1:
3
- metadata.gz: 47da2e56704809eaba5127a9ab4658d8cf1a7676
4
- data.tar.gz: 45241a94d3afbda62cdbf285e276f215952bd3c1
2
+ SHA256:
3
+ metadata.gz: '079d0163200683baaed4cf2ac3131092e737d6663c68d3b1ce7f8af984429571'
4
+ data.tar.gz: 9f8d650015d4f8dd5fabab25d2624041908e6345bc652195dc2146a6a442ba79
5
5
  SHA512:
6
- metadata.gz: eb74ec655b6c696c72f7f24b38a99705c018802c621f8ea34126cfc8603920e014d959c896561031dfcec766c12c4b5fe04ff608efa368bbe522ea0f4fc09cce
7
- data.tar.gz: b23906cd5624e163c62730ad5f73d945538a39e806f204bb3470c4a0b61b700226eb2e02c4313aaa46a646deba21b8f3239b566dda8642c3ff404b85ff0773f9
6
+ metadata.gz: 5e8d8eeedf57cc22480b332d49332397cc017cd831314aa585afff0edfb6d87239f8ad968f9f76e4379a9d95a65fa7bcd916a91f3c7d7add9c4f29783fbec439
7
+ data.tar.gz: 2c8cbb044e1ec4116a4063dce1843b1173f0b3271f78123af119fe8e96cfdc7f12aa069c74b8696b9a5e3d2cab4faec9179d08431916736c8f59680983d813e7
@@ -1,130 +1,131 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sf-dropbox-ext (0.1.3)
4
+ sf-dropbox-ext (0.2.5)
5
5
  dropbox-sdk-v2
6
6
  rails (~> 5.0.1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (5.0.1)
12
- actionpack (= 5.0.1)
13
- nio4r (~> 1.2)
11
+ actioncable (5.0.7.2)
12
+ actionpack (= 5.0.7.2)
13
+ nio4r (>= 1.2, < 3.0)
14
14
  websocket-driver (~> 0.6.1)
15
- actionmailer (5.0.1)
16
- actionpack (= 5.0.1)
17
- actionview (= 5.0.1)
18
- activejob (= 5.0.1)
15
+ actionmailer (5.0.7.2)
16
+ actionpack (= 5.0.7.2)
17
+ actionview (= 5.0.7.2)
18
+ activejob (= 5.0.7.2)
19
19
  mail (~> 2.5, >= 2.5.4)
20
20
  rails-dom-testing (~> 2.0)
21
- actionpack (5.0.1)
22
- actionview (= 5.0.1)
23
- activesupport (= 5.0.1)
21
+ actionpack (5.0.7.2)
22
+ actionview (= 5.0.7.2)
23
+ activesupport (= 5.0.7.2)
24
24
  rack (~> 2.0)
25
25
  rack-test (~> 0.6.3)
26
26
  rails-dom-testing (~> 2.0)
27
27
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
- actionview (5.0.1)
29
- activesupport (= 5.0.1)
28
+ actionview (5.0.7.2)
29
+ activesupport (= 5.0.7.2)
30
30
  builder (~> 3.1)
31
31
  erubis (~> 2.7.0)
32
32
  rails-dom-testing (~> 2.0)
33
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
34
- activejob (5.0.1)
35
- activesupport (= 5.0.1)
33
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
34
+ activejob (5.0.7.2)
35
+ activesupport (= 5.0.7.2)
36
36
  globalid (>= 0.3.6)
37
- activemodel (5.0.1)
38
- activesupport (= 5.0.1)
39
- activerecord (5.0.1)
40
- activemodel (= 5.0.1)
41
- activesupport (= 5.0.1)
37
+ activemodel (5.0.7.2)
38
+ activesupport (= 5.0.7.2)
39
+ activerecord (5.0.7.2)
40
+ activemodel (= 5.0.7.2)
41
+ activesupport (= 5.0.7.2)
42
42
  arel (~> 7.0)
43
- activesupport (5.0.1)
43
+ activesupport (5.0.7.2)
44
44
  concurrent-ruby (~> 1.0, >= 1.0.2)
45
- i18n (~> 0.7)
45
+ i18n (>= 0.7, < 2)
46
46
  minitest (~> 5.1)
47
47
  tzinfo (~> 1.1)
48
- addressable (2.5.0)
49
- public_suffix (~> 2.0, >= 2.0.2)
48
+ addressable (2.7.0)
49
+ public_suffix (>= 2.0.2, < 5.0)
50
50
  arel (7.1.4)
51
- builder (3.2.3)
52
- concurrent-ruby (1.0.4)
53
- domain_name (0.5.20161129)
51
+ builder (3.2.4)
52
+ concurrent-ruby (1.1.7)
53
+ crass (1.0.6)
54
+ domain_name (0.5.20190701)
54
55
  unf (>= 0.0.5, < 1.0.0)
55
56
  dropbox-sdk-v2 (0.0.3)
56
57
  http (~> 2.0)
57
58
  erubis (2.7.0)
58
- globalid (0.3.7)
59
- activesupport (>= 4.1.0)
60
- http (2.2.1)
59
+ globalid (0.4.2)
60
+ activesupport (>= 4.2.0)
61
+ http (2.2.2)
61
62
  addressable (~> 2.3)
62
63
  http-cookie (~> 1.0)
63
64
  http-form_data (~> 1.0.1)
64
65
  http_parser.rb (~> 0.6.0)
65
66
  http-cookie (1.0.3)
66
67
  domain_name (~> 0.5)
67
- http-form_data (1.0.1)
68
+ http-form_data (1.0.3)
68
69
  http_parser.rb (0.6.0)
69
- i18n (0.8.0)
70
- loofah (2.0.3)
70
+ i18n (1.8.5)
71
+ concurrent-ruby (~> 1.0)
72
+ loofah (2.6.0)
73
+ crass (~> 1.0.2)
71
74
  nokogiri (>= 1.5.9)
72
- mail (2.6.4)
73
- mime-types (>= 1.16, < 4)
74
- method_source (0.8.2)
75
- mime-types (3.1)
76
- mime-types-data (~> 3.2015)
77
- mime-types-data (3.2016.0521)
78
- mini_portile2 (2.1.0)
79
- minitest (5.10.1)
80
- nio4r (1.2.1)
81
- nokogiri (1.7.0.1)
82
- mini_portile2 (~> 2.1.0)
83
- public_suffix (2.0.5)
84
- rack (2.0.1)
75
+ mail (2.7.1)
76
+ mini_mime (>= 0.1.1)
77
+ method_source (1.0.0)
78
+ mini_mime (1.0.2)
79
+ mini_portile2 (2.4.0)
80
+ minitest (5.14.1)
81
+ nio4r (2.5.2)
82
+ nokogiri (1.10.10)
83
+ mini_portile2 (~> 2.4.0)
84
+ public_suffix (4.0.5)
85
+ rack (2.2.3)
85
86
  rack-test (0.6.3)
86
87
  rack (>= 1.0)
87
- rails (5.0.1)
88
- actioncable (= 5.0.1)
89
- actionmailer (= 5.0.1)
90
- actionpack (= 5.0.1)
91
- actionview (= 5.0.1)
92
- activejob (= 5.0.1)
93
- activemodel (= 5.0.1)
94
- activerecord (= 5.0.1)
95
- activesupport (= 5.0.1)
96
- bundler (>= 1.3.0, < 2.0)
97
- railties (= 5.0.1)
88
+ rails (5.0.7.2)
89
+ actioncable (= 5.0.7.2)
90
+ actionmailer (= 5.0.7.2)
91
+ actionpack (= 5.0.7.2)
92
+ actionview (= 5.0.7.2)
93
+ activejob (= 5.0.7.2)
94
+ activemodel (= 5.0.7.2)
95
+ activerecord (= 5.0.7.2)
96
+ activesupport (= 5.0.7.2)
97
+ bundler (>= 1.3.0)
98
+ railties (= 5.0.7.2)
98
99
  sprockets-rails (>= 2.0.0)
99
- rails-dom-testing (2.0.2)
100
- activesupport (>= 4.2.0, < 6.0)
101
- nokogiri (~> 1.6)
102
- rails-html-sanitizer (1.0.3)
103
- loofah (~> 2.0)
104
- railties (5.0.1)
105
- actionpack (= 5.0.1)
106
- activesupport (= 5.0.1)
100
+ rails-dom-testing (2.0.3)
101
+ activesupport (>= 4.2.0)
102
+ nokogiri (>= 1.6)
103
+ rails-html-sanitizer (1.3.0)
104
+ loofah (~> 2.3)
105
+ railties (5.0.7.2)
106
+ actionpack (= 5.0.7.2)
107
+ activesupport (= 5.0.7.2)
107
108
  method_source
108
109
  rake (>= 0.8.7)
109
110
  thor (>= 0.18.1, < 2.0)
110
- rake (12.0.0)
111
- sprockets (3.7.1)
111
+ rake (13.0.1)
112
+ sprockets (4.0.2)
112
113
  concurrent-ruby (~> 1.0)
113
114
  rack (> 1, < 3)
114
- sprockets-rails (3.2.0)
115
+ sprockets-rails (3.2.1)
115
116
  actionpack (>= 4.0)
116
117
  activesupport (>= 4.0)
117
118
  sprockets (>= 3.0.0)
118
- thor (0.19.4)
119
- thread_safe (0.3.5)
120
- tzinfo (1.2.2)
119
+ thor (1.0.1)
120
+ thread_safe (0.3.6)
121
+ tzinfo (1.2.7)
121
122
  thread_safe (~> 0.1)
122
123
  unf (0.1.4)
123
124
  unf_ext
124
- unf_ext (0.0.7.2)
125
+ unf_ext (0.0.7.7)
125
126
  websocket-driver (0.6.5)
126
127
  websocket-extensions (>= 0.1.0)
127
- websocket-extensions (0.1.2)
128
+ websocket-extensions (0.1.5)
128
129
 
129
130
  PLATFORMS
130
131
  ruby
@@ -133,4 +134,4 @@ DEPENDENCIES
133
134
  sf-dropbox-ext!
134
135
 
135
136
  BUNDLED WITH
136
- 1.13.6
137
+ 1.17.2
@@ -12,7 +12,9 @@ module DropboxExt
12
12
  end
13
13
 
14
14
  def index
15
+ session["redirect_url"] = params[:redirect_url]
15
16
  @dropbox_link = dropbox_link
17
+ redirect_to @dropbox_link
16
18
  end
17
19
 
18
20
  def auth_complete
@@ -23,7 +25,7 @@ module DropboxExt
23
25
  redirect_to "#{DropboxExt.mount_url}/?secret_url=error"
24
26
  else
25
27
  @secret_url = CGI.escape("#{DropboxExt.mount_url}/items/sync?dbt=#{result[:token]}&type=sf")
26
- redirect_to "#{DropboxExt.mount_url}/?secret_url=#{@secret_url}"
28
+ redirect_to "#{session["redirect_url"]}&dropbox_secret_url=#{@secret_url}"
27
29
  end
28
30
  end
29
31
 
@@ -13,19 +13,24 @@ module DropboxExt
13
13
  end
14
14
 
15
15
  def sync_decrypt_file
16
- existing = dropbox.search("", "decrypt")
17
-
18
- if existing.length > 0
19
- file = existing[0]
20
- days_old = (Time.now - file.client_modified).to_i / (24 * 60 * 60)
21
- if days_old < 14
22
- return
16
+ begin
17
+ existing = dropbox.search("", "decrypt")
18
+
19
+ if existing.length > 0
20
+ file = existing[0]
21
+ days_old = (Time.now - file.client_modified).to_i / (24 * 60 * 60)
22
+ if days_old < 14
23
+ return
24
+ end
23
25
  end
26
+
27
+ require 'open-uri'
28
+ content = open('https://raw.githubusercontent.com/standardfile/decrypt-html-page/master/decrypt.html').read
29
+ dropbox.upload("/decrypt.html", content, {:mode => "overwrite"})
30
+ rescue
31
+
24
32
  end
25
-
26
- require 'open-uri'
27
- content = open('https://raw.githubusercontent.com/standardfile/decrypt-html-page/master/decrypt.html').read
28
- dropbox.upload("/decrypt.html", content, {:mode => "overwrite"})
33
+
29
34
  end
30
35
 
31
36
  def sync
@@ -33,16 +38,25 @@ module DropboxExt
33
38
  auth_params = params[:auth_params]
34
39
 
35
40
  if items && items.length > 0
36
- items.each do |item|
37
- payload = { "items" => [item]}
38
- payload["auth_params"] = auth_params if auth_params != nil
39
- dropbox.upload("/data/#{item[:content_type]}-#{item[:uuid]}.txt", "#{JSON.pretty_generate(payload.as_json)}", {:mode => "overwrite"})
40
- end
41
+ payload = { "items" => items }
42
+ payload["auth_params"] = auth_params if auth_params != nil
43
+ folder = "/#{Time.current.year}/#{DateTime.now.strftime("%B")}"
44
+ filename = "#{DateTime.now.strftime("%B %d, %Y").sub(',', '')}.txt"
45
+ dropbox.upload("#{folder}/#{filename}", "#{JSON.pretty_generate(payload.as_json)}", {:mode => "overwrite"})
41
46
  end
42
47
 
43
48
  self.sync_decrypt_file()
44
49
 
45
50
  render :json => {:success => true}
51
+ rescue Dropbox::ApiError, Dropbox::ClientError => _e
52
+ render(
53
+ json: {
54
+ error: {
55
+ message: 'Could not sync item to Dropbox. Please verify your integration.'
56
+ }
57
+ },
58
+ status: :bad_request
59
+ )
46
60
  end
47
61
 
48
62
  end
@@ -1,3 +1,3 @@
1
1
  module DropboxExt
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sf-dropbox-ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Standard File
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-01 00:00:00.000000000 Z
11
+ date: 2020-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -91,8 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  requirements: []
94
- rubyforge_project:
95
- rubygems_version: 2.4.8
94
+ rubygems_version: 3.0.3
96
95
  signing_key:
97
96
  specification_version: 4
98
97
  summary: Summary of DropboxExt.