social_stream 0.28.4 → 0.29.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. data/.gitignore +6 -1
  2. data/.travis.yml +0 -2
  3. data/Gemfile +3 -0
  4. data/base/app/controllers/activities_controller.rb +14 -12
  5. data/base/app/controllers/api_controller.rb +0 -13
  6. data/base/app/controllers/frontpage_controller.rb +0 -6
  7. data/base/app/models/activity.rb +21 -61
  8. data/base/app/models/actor.rb +4 -8
  9. data/base/app/models/audience.rb +2 -0
  10. data/base/app/models/comment.rb +2 -1
  11. data/base/app/models/group.rb +0 -2
  12. data/base/app/models/relation/custom.rb +17 -4
  13. data/base/app/models/relation.rb +5 -1
  14. data/base/app/models/tie.rb +0 -2
  15. data/base/app/models/user.rb +0 -2
  16. data/base/app/views/activities/_options.html.erb +1 -1
  17. data/base/app/views/activities/index.atom.builder +48 -0
  18. data/base/app/views/activity_objects/_activity_object.atom.erb +1 -0
  19. data/base/config/locales/en.yml +8 -0
  20. data/base/config/locales/es.yml +8 -0
  21. data/base/config/routes.rb +0 -8
  22. data/base/lib/rails/social_stream.rb +1 -1
  23. data/base/lib/social_stream/ability/base.rb +4 -16
  24. data/base/lib/social_stream/activity_streams/subtype.rb +11 -0
  25. data/base/lib/social_stream/activity_streams/supertype.rb +12 -0
  26. data/base/lib/social_stream/activity_streams.rb +39 -0
  27. data/base/lib/social_stream/base/dependencies.rb +2 -0
  28. data/base/lib/social_stream/base/engine.rb +6 -0
  29. data/base/lib/social_stream/base/version.rb +1 -1
  30. data/base/lib/social_stream/models/object.rb +5 -0
  31. data/base/lib/social_stream/models/subject.rb +1 -1
  32. data/base/lib/social_stream/models/subtype.rb +2 -0
  33. data/base/lib/social_stream/models/supertype.rb +2 -0
  34. data/base/lib/social_stream-base.rb +5 -0
  35. data/base/social_stream-base.gemspec +2 -0
  36. data/base/spec/controllers/activities_controller_spec.rb +18 -0
  37. data/base/spec/controllers/frontpage_controller_spec.rb +0 -5
  38. data/base/spec/models/activity_wall_spec.rb +96 -0
  39. data/base/spec/models/post_authorization_spec.rb +370 -0
  40. data/base/spec/models/post_spec.rb +0 -2
  41. data/base/spec/models/relation_spec.rb +22 -0
  42. data/base/spec/social_stream_activity_streams_spec.rb +16 -0
  43. data/base/spec/social_stream_spec.rb +1 -1
  44. data/documents/app/views/common_documents/_document_info.html.erb +2 -2
  45. data/documents/app/views/common_documents/_index.html.erb +2 -2
  46. data/documents/lib/social_stream/documents/engine.rb +7 -0
  47. data/documents/lib/social_stream/documents/version.rb +1 -1
  48. data/documents/social_stream-documents.gemspec +1 -1
  49. data/events/app/decorators/social_stream/base/actor_decorator.rb +3 -0
  50. data/events/app/decorators/social_stream/base/document_decorator.rb +3 -0
  51. data/events/lib/social_stream/events/engine.rb +2 -10
  52. data/events/lib/social_stream/events/version.rb +1 -1
  53. data/events/social_stream-events.gemspec +1 -1
  54. data/lib/generators/social_stream/install_generator.rb +1 -0
  55. data/lib/social_stream/version.rb +1 -1
  56. data/lib/social_stream.rb +7 -6
  57. data/linkser/lib/social_stream/linkser/engine.rb +3 -0
  58. data/linkser/lib/social_stream/linkser/version.rb +1 -1
  59. data/linkser/social_stream-linkser.gemspec +1 -1
  60. data/ostatus/Gemfile +3 -0
  61. data/ostatus/MIT-LICENSE +20 -0
  62. data/ostatus/README.rdoc +26 -0
  63. data/ostatus/Rakefile +26 -0
  64. data/{base → ostatus}/app/assets/images/logos/actor/remote_subject.png +0 -0
  65. data/ostatus/app/assets/images/logos/contact/remote_subject.png +0 -0
  66. data/ostatus/app/assets/images/logos/original/remote_subject.png +0 -0
  67. data/ostatus/app/assets/images/logos/profile/remote_subject.png +0 -0
  68. data/ostatus/app/controllers/host_meta_controller.rb +9 -0
  69. data/ostatus/app/controllers/pshb_controller.rb +26 -0
  70. data/ostatus/app/controllers/remote_subjects_controller.rb +19 -0
  71. data/ostatus/app/controllers/salmon_controller.rb +15 -0
  72. data/ostatus/app/controllers/subjects_controller.rb +5 -0
  73. data/ostatus/app/controllers/webfinger_controller.rb +24 -0
  74. data/ostatus/app/decorators/social_stream/base/activity_decorator.rb +3 -0
  75. data/ostatus/app/decorators/social_stream/base/actor_decorator.rb +3 -0
  76. data/ostatus/app/decorators/social_stream/base/audience_decorator.rb +3 -0
  77. data/ostatus/app/decorators/social_stream/base/relation/custom_decorator.rb +3 -0
  78. data/ostatus/app/decorators/social_stream/base/tie_decorator.rb +3 -0
  79. data/ostatus/app/models/actor_key.rb +30 -0
  80. data/ostatus/app/models/remote_subject.rb +139 -0
  81. data/ostatus/app/views/remote_subjects/_show.html.erb +6 -0
  82. data/ostatus/app/views/remote_subjects/show.html.erb +5 -0
  83. data/ostatus/config/locales/en.yml +34 -0
  84. data/ostatus/config/routes.rb +13 -0
  85. data/ostatus/db/migrate/20120905145030_create_social_stream_ostatus.rb +20 -0
  86. data/ostatus/db/migrate/20120918194708_create_actor_keys.rb +18 -0
  87. data/ostatus/lib/generators/social_stream/ostatus/install_generator.rb +16 -0
  88. data/ostatus/lib/generators/social_stream/ostatus/templates/initializer.rb +18 -0
  89. data/ostatus/lib/social_stream/migrations/ostatus.rb +9 -0
  90. data/ostatus/lib/social_stream/ostatus/activity_streams.rb +79 -0
  91. data/ostatus/lib/social_stream/ostatus/controllers/debug_requests.rb +24 -0
  92. data/ostatus/lib/social_stream/ostatus/engine.rb +21 -0
  93. data/ostatus/lib/social_stream/ostatus/models/activity.rb +41 -0
  94. data/ostatus/lib/social_stream/ostatus/models/actor.rb +89 -0
  95. data/ostatus/lib/social_stream/ostatus/models/audience.rb +19 -0
  96. data/ostatus/lib/social_stream/ostatus/models/object.rb +28 -0
  97. data/ostatus/lib/social_stream/ostatus/models/relation/custom.rb +22 -0
  98. data/ostatus/lib/social_stream/ostatus/models/tie.rb +24 -0
  99. data/ostatus/lib/social_stream/ostatus/version.rb +5 -0
  100. data/ostatus/lib/social_stream-ostatus.rb +54 -0
  101. data/ostatus/social_stream-ostatus.gemspec +28 -0
  102. data/ostatus/spec/controllers/host_meta_controller_spec.rb +10 -0
  103. data/ostatus/spec/controllers/remote_subjects_controller_spec.rb +37 -0
  104. data/ostatus/spec/controllers/webfinger_controller_spec.rb +13 -0
  105. data/ostatus/spec/dummy/Rakefile +7 -0
  106. data/ostatus/spec/dummy/app/controllers/application_controller.rb +3 -0
  107. data/ostatus/spec/dummy/app/helpers/application_helper.rb +2 -0
  108. data/ostatus/spec/dummy/app/views/layouts/application.html.erb +14 -0
  109. data/ostatus/spec/dummy/config/application.rb +45 -0
  110. data/ostatus/spec/dummy/config/boot.rb +10 -0
  111. data/ostatus/spec/dummy/config/database.yml +22 -0
  112. data/ostatus/spec/dummy/config/environment.rb +5 -0
  113. data/ostatus/spec/dummy/config/environments/development.rb +26 -0
  114. data/ostatus/spec/dummy/config/environments/production.rb +49 -0
  115. data/ostatus/spec/dummy/config/environments/test.rb +35 -0
  116. data/ostatus/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  117. data/ostatus/spec/dummy/config/initializers/inflections.rb +10 -0
  118. data/ostatus/spec/dummy/config/initializers/mime_types.rb +5 -0
  119. data/ostatus/spec/dummy/config/initializers/secret_token.rb +7 -0
  120. data/ostatus/spec/dummy/config/initializers/session_store.rb +8 -0
  121. data/ostatus/spec/dummy/config/locales/en.yml +5 -0
  122. data/ostatus/spec/dummy/config/routes.rb +58 -0
  123. data/ostatus/spec/dummy/config.ru +4 -0
  124. data/ostatus/spec/dummy/public/404.html +26 -0
  125. data/ostatus/spec/dummy/public/422.html +26 -0
  126. data/ostatus/spec/dummy/public/500.html +26 -0
  127. data/ostatus/spec/dummy/public/favicon.ico +0 -0
  128. data/ostatus/spec/dummy/public/javascripts/application.js +2 -0
  129. data/ostatus/spec/dummy/public/javascripts/controls.js +965 -0
  130. data/ostatus/spec/dummy/public/javascripts/dragdrop.js +974 -0
  131. data/ostatus/spec/dummy/public/javascripts/effects.js +1123 -0
  132. data/ostatus/spec/dummy/public/javascripts/prototype.js +6001 -0
  133. data/ostatus/spec/dummy/public/javascripts/rails.js +191 -0
  134. data/ostatus/spec/dummy/public/stylesheets/.gitkeep +0 -0
  135. data/ostatus/spec/dummy/script/rails +6 -0
  136. data/ostatus/spec/factories/remote_subject.rb +39 -0
  137. data/ostatus/spec/integration/navigation_spec.rb +9 -0
  138. data/ostatus/spec/models/actor_key_spec.rb +9 -0
  139. data/ostatus/spec/models/post_spec.rb +25 -0
  140. data/ostatus/spec/models/remote_subject_spec.rb +24 -0
  141. data/ostatus/spec/social_stream_ostatus.spec.rb +9 -0
  142. data/ostatus/spec/social_stream_ostatus_activity_streams.spec.rb +31 -0
  143. data/ostatus/spec/spec_helper.rb +33 -0
  144. data/presence/app/decorators/social_stream/base/models/group_decorator.rb +3 -0
  145. data/presence/app/decorators/social_stream/base/models/tie_decorator.rb +3 -0
  146. data/presence/lib/generators/social_stream/presence/install_generator.rb +1 -1
  147. data/presence/lib/social_stream/presence/engine.rb +0 -12
  148. data/presence/lib/social_stream/presence/version.rb +1 -1
  149. data/presence/social_stream-presence.gemspec +1 -1
  150. data/social_stream.gemspec +6 -5
  151. data/spec/support/db.rb +1 -1
  152. metadata +125 -18
  153. data/base/app/assets/images/logos/actor/remote_user.png +0 -0
  154. data/base/app/controllers/subjects_controller.rb +0 -7
  155. data/base/app/views/api/activity_atom_feed.atom.builder +0 -40
  156. data/base/app/views/frontpage/host_meta.xml.builder +0 -11
  157. data/base/spec/models/activity_authorization_spec.rb +0 -354
@@ -0,0 +1,3 @@
1
+ Actor.class_eval do
2
+ include SocialStream::Ostatus::Models::Actor
3
+ end
@@ -0,0 +1,3 @@
1
+ Audience.class_eval do
2
+ include SocialStream::Ostatus::Models::Audience
3
+ end
@@ -0,0 +1,3 @@
1
+ Relation::Custom.class_eval do
2
+ include SocialStream::Ostatus::Models::Relation::Custom
3
+ end
@@ -0,0 +1,3 @@
1
+ Tie.class_eval do
2
+ include SocialStream::Ostatus::Models::Tie
3
+ end
@@ -0,0 +1,30 @@
1
+ require 'openssl'
2
+
3
+ # Store OStatus private and public key
4
+ class ActorKey < ActiveRecord::Base
5
+ KEY_SIZE = 1024
6
+
7
+ belongs_to :actor
8
+
9
+ validates_presence_of :key_der
10
+
11
+ before_validation :generate_key, on: :create
12
+
13
+ def key
14
+ @key ||=
15
+ OpenSSL::PKey::RSA.new(key_der)
16
+ end
17
+
18
+ def key= new_key
19
+ @key = new_key
20
+ self.key_der = new_key.to_der
21
+ end
22
+
23
+ private
24
+
25
+ def generate_key
26
+ return if key_der.present?
27
+
28
+ self.key = OpenSSL::PKey::RSA.generate(KEY_SIZE)
29
+ end
30
+ end
@@ -0,0 +1,139 @@
1
+ class RemoteSubject < ActiveRecord::Base
2
+ include SocialStream::Models::Subject
3
+ # Create absolute routes
4
+ include Rails.application.routes.url_helpers
5
+
6
+ attr_reader :url_helper
7
+ attr_accessible :webfinger_id
8
+
9
+ # Save webfinger_info hash into the database
10
+ serialize :webfinger_info
11
+
12
+ validates_uniqueness_of :webfinger_id
13
+
14
+ before_validation :fill_information,
15
+ :on => :create
16
+
17
+ after_create :subscribe_to_public_feed
18
+ after_destroy :unsubscribe_to_public_feed
19
+
20
+ scope :webfinger_alias, lambda { |uri|
21
+ where('webfinger_info LIKE ?', "%aliases%#{ uri }%")
22
+ }
23
+
24
+ #validates_format_of :webfinger_slug, :with => Devise.email_regexp, :allow_blank => true
25
+
26
+ class << self
27
+ def find_or_create_by_webfinger_uri!(uri)
28
+ if uri =~ /^https?:\/\//
29
+ records = webfinger_alias(uri)
30
+
31
+ # SQL scope is not reliable
32
+ if records.present?
33
+ return records.find{ |r| r.webfinger_aliases.include?(uri) }
34
+ end
35
+
36
+ # TODO: create by http uri?
37
+
38
+ raise ::ActiveRecord::RecordNotFound
39
+ end
40
+
41
+ id = uri.dup
42
+
43
+ if id =~ /^acct:/
44
+ id.gsub!('acct:', '')
45
+ end
46
+
47
+ find_or_create_by_webfinger_id!(id)
48
+ end
49
+ end
50
+
51
+ # Return the slug in the webfinger_id
52
+ def webfinger_slug
53
+ splitted_webfinger_id.first
54
+ end
55
+
56
+ # Return the origin url in the webfinger_id
57
+ def webfinger_url
58
+ splitted_webfinger_id.last
59
+ end
60
+
61
+ # URL of the activity feed from this {RemoteSubject}
62
+ def public_feed_url
63
+ webfinger_info[:updates_from]
64
+ end
65
+
66
+ # URL of the Salmon endpoint for this {RemoteSubject}
67
+ def salmon_url
68
+ webfinger_info[:salmon]
69
+ end
70
+
71
+ # Webfinger Alias
72
+ def webfinger_aliases
73
+ webfinger_info[:aliases]
74
+ end
75
+
76
+ # Fetch the webfinger again
77
+ def refresh_webfinger!
78
+ fill_webfinger_info
79
+
80
+ save!
81
+ end
82
+
83
+ private
84
+
85
+ def splitted_webfinger_id
86
+ @splitted_webfinger_id ||=
87
+ webfinger_id.split('@')
88
+ end
89
+
90
+ def fill_information
91
+ fill_webfinger_info
92
+
93
+ self.name = webfinger_id
94
+ end
95
+
96
+ def fill_webfinger_info
97
+ self.webfinger_info = build_webfinger_info
98
+ self.rsa_key = finger.magic_key
99
+ end
100
+
101
+ def build_webfinger_info
102
+ {
103
+ updates_from: finger.links[:updates_from],
104
+ salmon: finger.links[:salmon],
105
+ aliases: finger.alias
106
+ }
107
+ end
108
+
109
+ def finger
110
+ @finger ||=
111
+ fetch_finger
112
+ end
113
+
114
+ def fetch_finger
115
+ finger =
116
+ Proudhon::Finger.fetch webfinger_id
117
+
118
+ # FIXME custom error
119
+ raise ::ActiveRecord::RecordNotFound if finger.blank?
120
+
121
+ finger
122
+ end
123
+
124
+ def subscribe_to_public_feed
125
+ return if public_feed_url.blank?
126
+
127
+ atom = Proudhon::Atom.from_uri(public_feed_url)
128
+
129
+ atom.subscribe(pshb_url(:host => SocialStream::Ostatus.pshb_host))
130
+ end
131
+
132
+ def unsubscribe_to_public_feed
133
+ return if public_feed_url.blank?
134
+
135
+ atom = Proudhon::Atom.from_uri(public_feed_url)
136
+
137
+ atom.unsubscribe(pshb_url(:host => SocialStream::Ostatus.pshb_host))
138
+ end
139
+ end
@@ -0,0 +1,6 @@
1
+ <% toolbar :profile, subject: @remote_subject %>
2
+
3
+ <%= render partial: "activities/index",
4
+ locals: { activities: @remote_subject.wall(:profile, for: current_subject).
5
+ page(params[:page]),
6
+ owner: @remote_subject } %>
@@ -0,0 +1,5 @@
1
+ <% content_for :title do %>
2
+ <%= @remote_subject.name+" | "+t('site.name') %>
3
+ <% end %>
4
+
5
+ <%= render :partial => 'show' %>
@@ -0,0 +1,34 @@
1
+ en:
2
+ activity:
3
+ verb:
4
+ follow:
5
+ RemoteSubject:
6
+ title: "%{subject} added %{contact} as contact."
7
+ message: "%{name} added you as contact."
8
+ notification:
9
+ subject: "%{name} added you as contact."
10
+ body: "%{name} added you as contact."
11
+ like:
12
+ RemoteSubject:
13
+ title: "%{subject} is a fan of %{contact}."
14
+ message: "%{name} is now your fan."
15
+ notification:
16
+ subject: "%{name} is now your fan."
17
+ body: "%{name} is now your fan."
18
+ make-friend:
19
+ RemoteSubject:
20
+ title: "%{subject} and %{contact} are now connected."
21
+ message: "%{name} also added you as contact."
22
+ notification:
23
+ subject: "%{name} also added you as contact."
24
+ body: "%{name} also added you as contact."
25
+ post:
26
+ RemoteSubject:
27
+ notification:
28
+ subject: "%{name} has posted something(%{direct_object}) in your wall"
29
+ body: "%{name} has posted something(%{direct_object}) in your wall"
30
+ update:
31
+ RemoteSubject:
32
+ notification:
33
+ subject: "%{name} has updated %{direct_object} in your wall"
34
+ body: "%{name} has updated something(%{direct_object}) in your wall"
@@ -0,0 +1,13 @@
1
+ Rails.application.routes.draw do
2
+ # Host Meta
3
+ match '/.well-known/host-meta', :to => HostMetaController.action(:index)
4
+
5
+ # Webfinger
6
+ match '/webfinger' => 'webfinger#index', :as => 'webfinger'
7
+
8
+ # PushSubHubBub callback
9
+ match 'pshb' => 'pshb#index', as: :pshb
10
+
11
+ # Salmon callback
12
+ match 'salmon/:slug' => 'salmon#index', as: :salmon
13
+ end
@@ -0,0 +1,20 @@
1
+ class CreateSocialStreamOstatus < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ create_table :remote_subjects, :force => true do |t|
5
+ t.integer :actor_id
6
+ t.string :webfinger_id
7
+ t.text :webfinger_info
8
+ t.timestamps
9
+ end
10
+
11
+ add_index "remote_subjects", "actor_id"
12
+ add_foreign_key "remote_subjects", "actors", :name => "remote_subjects_on_actor_id"
13
+ end
14
+
15
+ def self.down
16
+ remove_foreign_key "remote_subjects", :name => "remote_subjects_on_actor_id"
17
+ drop_table :remote_subjects
18
+ end
19
+
20
+ end
@@ -0,0 +1,18 @@
1
+ class CreateActorKeys < ActiveRecord::Migration
2
+ def up
3
+ create_table :actor_keys do |t|
4
+ t.integer :actor_id
5
+ t.binary :key_der
6
+
7
+ t.timestamps
8
+ end
9
+
10
+ add_index "actor_keys", "actor_id"
11
+ add_foreign_key "actor_keys", "actors", :name => "actor_keys_on_actor_id"
12
+ end
13
+
14
+ def down
15
+ remove_foreign_key "actor_keys", :name => "actor_keys_on_actor_id"
16
+ drop_table :actor_keys
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ class SocialStream::Ostatus::InstallGenerator < Rails::Generators::Base
2
+ include Rails::Generators::Migration
3
+
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ def create_migration_file
7
+ require 'rake'
8
+ Rails.application.load_tasks
9
+ Rake::Task['railties:install:migrations'].reenable
10
+ Rake::Task['social_stream_ostatus_engine:install:migrations'].invoke
11
+ end
12
+
13
+ def config_initializer
14
+ copy_file 'initializer.rb', 'config/initializers/social_stream-ostatus.rb'
15
+ end
16
+ end
@@ -0,0 +1,18 @@
1
+ SocialStream::Ostatus.setup do |config|
2
+ # Default to the PuSH reference Hub server
3
+ #
4
+ # config.hub = 'http://pubsubhubbub.appspot.com'
5
+
6
+ # The host where the hub should take the activity feed from
7
+ #
8
+ # Local subjects will publish their public activities there
9
+ config.activity_feed_host = 'localhost:3000'
10
+
11
+ # The host where the PuSH should send the callbacks to
12
+ #
13
+ # Remote subjects get their local activities updates with the PuSH callback
14
+ config.pshb_host = 'localhost:3000'
15
+
16
+ # Debug OStatus requests
17
+ # config.debug_requests = true
18
+ end
@@ -0,0 +1,9 @@
1
+ require 'social_stream/migrations/components'
2
+
3
+ module SocialStream
4
+ module Migrations
5
+ # Migrate Ostatus
6
+ class Ostatus < Components
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,79 @@
1
+ module SocialStream
2
+ module Ostatus
3
+ module ActivityStreams
4
+ # Parses the body from a {PshbController#index} and dispatches
5
+ # entries for parsing to {#record_from_entry!}
6
+ def from_pshb_callback(body)
7
+ atom = Proudhon::Atom.parse body
8
+
9
+ atom.entries.each do |entry|
10
+ # FIXME: get author from feed
11
+ # https://github.com/shf/proudhon/issues/8
12
+ entry.author.uri ||= feed.author.uri
13
+
14
+ activity_from_entry! entry
15
+ end
16
+ end
17
+
18
+ # Parses an activity form a PuSH or Salmon notification
19
+ # Decides what action should be taken from an ActivityStreams entry
20
+ def activity_from_entry! entry, receiver = nil
21
+ # FIXME: should not use to_sym
22
+ # https://github.com/shf/proudhon/issues/7
23
+ case entry.verb.to_sym
24
+ when :follow
25
+ Tie.from_entry! entry, receiver
26
+ else
27
+ # :post is the default verb
28
+ r = record_from_entry! entry, receiver
29
+ r.post_activity
30
+ end
31
+ end
32
+
33
+ # Redirects parsing to the suitable SocialStream's model
34
+ def record_from_entry! entry, receiver
35
+ model!(entry.objtype).from_entry! entry, receiver
36
+ end
37
+
38
+ # Finds or creates a {RemoteSubject} from an ActivityStreams entry
39
+ #
40
+ def actor_from_entry! entry
41
+ webfinger_id = entry.author.uri
42
+
43
+ if webfinger_id.blank?
44
+ raise "Entry author without uri: #{ entry.to_xml }"
45
+ end
46
+
47
+ RemoteSubject.find_or_create_by_webfinger_uri! webfinger_id
48
+ end
49
+
50
+ # Parses the body from a {Salmon#index} and receiving actor
51
+ def from_salmon_callback(body, receiver)
52
+ salmon = Proudhon::Salmon.new body
53
+
54
+ validate_salmon salmon
55
+
56
+ activity_from_entry! salmon.to_entry, receiver
57
+ end
58
+
59
+ def validate_salmon salmon
60
+ remote_subject = RemoteSubject.find_or_create_by_webfinger_uri!(salmon.to_entry.author.uri)
61
+ key = remote_subject.rsa_key
62
+
63
+ unless salmon.verify(key)
64
+ raise "Invalid salmon: #{ salmon }"
65
+ end
66
+ end
67
+
68
+ # Translate SocialStream activity verb to Proudhon verb
69
+ def verb orig
70
+ case orig
71
+ when 'make-friend'
72
+ :follow
73
+ else
74
+ orig.to_sym
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,24 @@
1
+ module SocialStream
2
+ module Ostatus
3
+ module Controllers
4
+ module DebugRequests
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ before_filter :debug_request
9
+ end
10
+
11
+ private
12
+
13
+ def debug_request
14
+ return unless SocialStream::Ostatus.debug_requests
15
+
16
+ logger.info request.body.read
17
+
18
+ # Set StringIO to initial state for the action to get the content
19
+ request.body.rewind
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end