superfeedr_engine 0.1.3 → 0.1.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bee7e6e4273eb2466ef9a69825b211bc2617811d
|
4
|
+
data.tar.gz: c4419381bc2e2fd73d54b3ebb6b963d2f698b47a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f7ae5a487f7f240957dfd37c26da685a713d8a9e0c75b4a11f726e0bcfae7f3d4d083a60d850d2e68bd65c394f0b02dcfa3011c4dca7a47c68c590cb1d1ac61
|
7
|
+
data.tar.gz: 4345fcaa94300d9f5fdfc719e796a986c8eecc53561b9865021e6225eb12359680e66aa956b5e69bd2cd03914970be7442e4ecb5d2e372e3288f19af361c9817
|
@@ -4,37 +4,45 @@ require_dependency "superfeedr_engine/application_controller"
|
|
4
4
|
module SuperfeedrEngine
|
5
5
|
class PubsubhubbubController < ApplicationController
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
7
|
+
def notify
|
8
|
+
signature = request.headers['HTTP_X_HUB_SIGNATURE']
|
9
|
+
if !signature
|
10
|
+
Rails.logger.error("Missing signature. Ignored payload for #{params[:feed_id]}. Use retrieve if missing.")
|
11
|
+
else
|
12
|
+
algo, hash = signature.split('=')
|
13
|
+
if algo != "sha1"
|
14
|
+
Rails.logger.error("Unknown signature mechanism #{algo}. Ignored paylod for #{params[:feed_id]}. Use retrieve if missing.")
|
15
|
+
else
|
16
|
+
feed = feed_klass.find(params[:feed_id])
|
17
|
+
if !feed
|
18
|
+
Rails.logger.error("Unknown notification for #{params[:feed_id]}.")
|
19
|
+
else
|
20
20
|
digest = OpenSSL::Digest.new(algo)
|
21
21
|
computed = OpenSSL::HMAC.hexdigest(digest, feed.secret, request.raw_post)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
if computed == hash
|
23
|
+
params.delete("pubsubhubbub")
|
24
|
+
params.delete("feed_id")
|
25
|
+
if !feed_klass.method_defined?(:notified)
|
26
|
+
Rails.logger.error("Please make sure your #{feed_klass} intances have a 'notified' method.")
|
27
|
+
elsif feed.method(:notified).arity == 2
|
28
|
+
feed.notified(params, request.raw_post)
|
29
|
+
elsif feed.method(:notified).arity == 1
|
30
|
+
feed.notified(params)
|
31
|
+
end
|
32
|
+
else
|
33
|
+
Rails.logger.error("Non matching signature. Ignored paylod for #{params[:feed_id]}. Use retrieve if missing.")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
29
37
|
end
|
30
38
|
render :text => "Thanks"
|
31
|
-
|
39
|
+
end
|
32
40
|
|
33
|
-
|
41
|
+
protected
|
34
42
|
|
35
|
-
|
36
|
-
|
37
|
-
|
43
|
+
def feed_klass
|
44
|
+
SuperfeedrEngine::Engine.feed_class.constantize
|
45
|
+
end
|
38
46
|
|
39
47
|
end
|
40
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: superfeedr_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- superfeedr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|