caboose-cms 0.9.94 → 0.9.95
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/caboose/sns_controller.rb +26 -25
- data/lib/caboose/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48d3ccbb53621efe566b03eed61919faeb957615
|
4
|
+
data.tar.gz: 54d28c881b9c08d143d9819cd2c04355047f3ee1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af02565698684f101906a9f652933b8fd532aa62d6fbf2ff0354ed09a727b26e7b1fd459e615ddad66a535953b12002355b2f4cbc7b760dec4676aa0275771ce
|
7
|
+
data.tar.gz: 0a00afaa195d2c0dc383e6de747f5d436dff3ddd7e5b93bcc7f47580861c709b4f6314b02a6e53cfc7f70d01f5675036aa49e9ec0a6afc4967c6db9287bf2bcc
|
@@ -4,7 +4,7 @@ module Caboose
|
|
4
4
|
skip_before_filter :verify_authenticity_token
|
5
5
|
|
6
6
|
# @route GET /admin/sns
|
7
|
-
def admin_index
|
7
|
+
def admin_index
|
8
8
|
render :json => true
|
9
9
|
end
|
10
10
|
|
@@ -12,32 +12,33 @@ module Caboose
|
|
12
12
|
def admin_add
|
13
13
|
body = JSON.parse(request.raw_post, {symbolize_names: true})
|
14
14
|
Caboose.log(body)
|
15
|
-
if body[:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
15
|
+
# if body[:Records]
|
16
|
+
# records = body[:Records]
|
17
|
+
# # if body[:Type] && body[:Type] == "SubscriptionConfirmation"
|
18
|
+
# # Caboose.log("SNS Subscription SubscribeURL\n#{body[:SubscribeURL]}")
|
19
|
+
# if records['eventSource'] == "aws:s3"
|
20
|
+
# msg = JSON.parse(body[:Message])
|
21
|
+
# if msg['Records']
|
22
|
+
if body && body['Records']
|
23
|
+
body['Records'].each do |r|
|
24
|
+
if r['eventName'] && r['eventName'].starts_with?('ObjectCreated')
|
25
|
+
if r['s3'] && r['s3']['object'] && r['s3']['object']['key']
|
26
|
+
key = URI.decode(r['s3']['object']['key']).gsub('+', ' ')
|
27
|
+
Caboose.log("Processing #{key}")
|
28
|
+
arr = key.split('_')
|
29
|
+
media_category_id = arr.shift
|
30
|
+
original_name = arr.join('_')
|
31
|
+
name = Caboose::Media.upload_name(original_name)
|
32
|
+
m = Media.where(:media_category_id => media_category_id, :original_name => original_name, :name => name).first
|
33
|
+
m = Media.create(:media_category_id => media_category_id, :original_name => original_name, :name => name, :processed => false) if m.nil?
|
34
|
+
m.delay(:queue => 'caboose_media').process
|
35
|
+
end
|
36
|
+
end
|
39
37
|
end
|
40
38
|
end
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
# end
|
41
42
|
render :json => true
|
42
43
|
end
|
43
44
|
|
data/lib/caboose/version.rb
CHANGED