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
@@ -125,6 +125,4 @@ describe Post do
125
125
  Post.authored_by(post.author).should include(post)
126
126
  end
127
127
  end
128
-
129
-
130
128
  end
@@ -74,5 +74,27 @@ describe Relation do
74
74
  end
75
75
  end
76
76
  end
77
+
78
+ describe 'with follow permission' do
79
+ before do
80
+ @relation = Relation.create!
81
+ @relation.permissions << Permission.find_or_create_by_action('follow')
82
+ end
83
+
84
+ it 'should follow?' do
85
+ @relation.follow?.should be_true
86
+ end
87
+ end
88
+
89
+ describe 'without follow permission' do
90
+ before do
91
+ @relation = Relation.create!
92
+ end
93
+
94
+ it 'should follow?' do
95
+ @relation.follow?.should be_false
96
+ end
97
+ end
98
+
77
99
  end
78
100
 
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe SocialStream::ActivityStreams do
4
+ it "should find by type" do
5
+ SocialStream::ActivityStreams.model(:person).should == User
6
+ end
7
+
8
+ it "should return Post as default model" do
9
+ SocialStream::ActivityStreams.model!(:_test).should == Post
10
+ end
11
+
12
+ it "should find by model" do
13
+ SocialStream::ActivityStreams.type(User).should == :person
14
+ end
15
+ end
16
+
@@ -4,4 +4,4 @@ describe SocialStream do
4
4
  it "should be valid" do
5
5
  SocialStream.should be_a(Module)
6
6
  end
7
- end
7
+ end
@@ -7,10 +7,10 @@
7
7
  <div id="actions">
8
8
  <%= link_to content_tag(:span,image_tag("btn/btn_write.png") + t('document.actions.details'), :class => :action, :id => :document_details_action), "javascript:SocialStream.Repository.toggleDocumentMenu('details');" %>
9
9
  <%= link_to content_tag(:span,image_tag("btn/download.png") + t('document.actions.download'), :class => :action), download_document_path(document) %>
10
- <% if document.post_activity.edit_object_by?(current_subject) %>
10
+ <% if can? :update, document %>
11
11
  <%= link_to content_tag(:span,image_tag("btn/edit.png") + t('document.actions.edit'), :class => :action, :id => :document_edit_action), "javascript:SocialStream.Repository.toggleDocumentMenu('edit');" %>
12
12
  <% end %>
13
- <% if document.post_activity.delete_object_by?(current_subject) %>
13
+ <% if can? :destroy, document %>
14
14
  <%= link_to content_tag(:span,image_tag("btn/error.png") + t('document.actions.delete'), :class => :action), document.post_activity.direct_object , :confirm => t('confirm_delete',
15
15
  :scope => document.post_activity.direct_object.class.to_s.underscore), :method => :delete %>
16
16
  <% end %>
@@ -18,10 +18,10 @@
18
18
  <div class="tipsy_content" style="display:none;">
19
19
  <div class="actions">
20
20
  <%= link_to content_tag(:div,image_tag("btn/download.png") + t('document.actions.download'), :class => :action), download_document_path(document) %>
21
- <% if document.post_activity.edit_object_by?(current_subject) %>
21
+ <% if can? :update, document %>
22
22
  <%= link_to content_tag(:div,image_tag("btn/edit.png") + t('document.actions.edit'), :class => :action, :id => :document_edit_action), document_path(document, :editing => true) %>
23
23
  <% end %>
24
- <% if document.post_activity.delete_object_by?(current_subject) %>
24
+ <% if can? :destroy, document %>
25
25
  <%= link_to content_tag(:div,image_tag("btn/error.png") + t('document.actions.delete'), :class => :action), document.post_activity.direct_object , :confirm => t('confirm_delete',
26
26
  :scope => document.post_activity.direct_object.class.to_s.underscore), :method => :delete %>
27
27
  <% end %>
@@ -54,6 +54,13 @@ module SocialStream
54
54
  Mime::Type.register "video/mp4", :mp4
55
55
  end
56
56
 
57
+ initializer "social_stream-documents.model.register_activity_streams" do
58
+ SocialStream::ActivityStreams.register :file, :document
59
+ SocialStream::ActivityStreams.register :image, :picture
60
+ SocialStream::ActivityStreams.register :audio
61
+ SocialStream::ActivityStreams.register :video
62
+ end
63
+
57
64
  initializer "social_stream-documents.views.toolbar" do
58
65
  SocialStream::Views::Toolbar.module_eval do
59
66
  include SocialStream::Views::Toolbar::Documents
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Documents
3
- VERSION = "0.16.1".freeze
3
+ VERSION = "0.17.0".freeze
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files`.split("\n")
13
13
 
14
14
  # Gem dependencies
15
- s.add_runtime_dependency('social_stream-base', '~> 0.22.3')
15
+ s.add_runtime_dependency('social_stream-base', '~> 0.23.0')
16
16
  s.add_runtime_dependency('paperclip-ffmpeg', '~> 0.7.0')
17
17
  s.add_runtime_dependency('paperclip','= 2.4.5')
18
18
  s.add_runtime_dependency('delayed_paperclip','2.4.5.1')
@@ -0,0 +1,3 @@
1
+ Actor.class_eval do
2
+ include SocialStream::Events::Models::Actor
3
+ end
@@ -0,0 +1,3 @@
1
+ Document.class_eval do
2
+ include SocialStream::Events::Models::Document
3
+ end
@@ -7,16 +7,8 @@ module SocialStream
7
7
  end
8
8
  end
9
9
 
10
- initializer "social_stream-events.actor" do
11
- ActiveSupport.on_load(:actor) do
12
- include SocialStream::Events::Models::Actor
13
- end
14
- end
15
-
16
- initializer "social_stream-events.document" do
17
- ActiveSupport.on_load(:document) do
18
- include SocialStream::Events::Models::Document
19
- end
10
+ initializer "social_stream-events.models.register_activity_streams" do
11
+ SocialStream::ActivityStreams.register :event
20
12
  end
21
13
 
22
14
  initializer "social_stream-events.views.settings" do
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Events
3
- VERSION = "0.14.2".freeze
3
+ VERSION = "0.15.0".freeze
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files`.split("\n")
13
13
 
14
14
  # Gem dependencies
15
- s.add_runtime_dependency('social_stream-base', '~> 0.22.4')
15
+ s.add_runtime_dependency('social_stream-base', '~> 0.23.0')
16
16
  s.add_runtime_dependency('rails-scheduler', '~> 0.0.8')
17
17
 
18
18
  # Development Gem dependencies
@@ -4,4 +4,5 @@ class SocialStream::InstallGenerator < Rails::Generators::Base #:nodoc:
4
4
  hook_for :events
5
5
  hook_for :linkser
6
6
  hook_for :chat
7
+ hook_for :federation
7
8
  end
@@ -1,3 +1,3 @@
1
1
  module SocialStream
2
- VERSION = "0.28.4".freeze
2
+ VERSION = "0.29.0".freeze
3
3
  end
data/lib/social_stream.rb CHANGED
@@ -1,12 +1,13 @@
1
1
  module SocialStream
2
- Components = %w{ base documents events linkser presence }
2
+ Components = %w{ base documents events linkser presence ostatus }
3
3
 
4
4
  class Engine < ::Rails::Engine #:nodoc:
5
- config.app_generators.base 'social_stream:base'
6
- config.app_generators.documents 'social_stream:documents'
7
- config.app_generators.events 'social_stream:events'
8
- config.app_generators.linkser 'social_stream:linkser'
9
- config.app_generators.chat 'social_stream:presence'
5
+ config.app_generators.base 'social_stream:base'
6
+ config.app_generators.documents 'social_stream:documents'
7
+ config.app_generators.events 'social_stream:events'
8
+ config.app_generators.linkser 'social_stream:linkser'
9
+ config.app_generators.chat 'social_stream:presence'
10
+ config.app_generators.federation 'social_stream:ostatus'
10
11
  end
11
12
  end
12
13
 
@@ -2,6 +2,9 @@ module SocialStream
2
2
  module Linkser
3
3
  class Engine < Rails::Engine
4
4
 
5
+ initializer 'social_stream-linkser.models.register_activity_streams' do
6
+ SocialStream::ActivityStreams.register :bookmark, :link
7
+ end
5
8
  end
6
9
  end
7
10
  end
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Linkser
3
- VERSION = "0.13.0".freeze
3
+ VERSION = "0.14.0".freeze
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files`.split("\n")
13
13
 
14
14
  # Gem dependencies
15
- s.add_runtime_dependency('social_stream-base', '~> 0.22.0')
15
+ s.add_runtime_dependency('social_stream-base', '~> 0.23.0')
16
16
  s.add_runtime_dependency('linkser', '~> 0.0.12')
17
17
  # Development Gem dependencies
18
18
  s.add_development_dependency('sqlite3-ruby')
data/ostatus/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,20 @@
1
+ Copyright 2011 VÍCTOR SÁNCHEZ BELMAR
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,26 @@
1
+ = SocialStream OStatus
2
+
3
+ Provides a SocialStream powered node with social network federation support
4
+ using OStatus
5
+
6
+ = Installation
7
+
8
+ Add to your Gemfile:
9
+
10
+ gem 'social_stream-ostatus'
11
+
12
+ and run:
13
+
14
+ bundle update
15
+
16
+ Then:
17
+
18
+ rails generate social_stream:ostatus:install
19
+
20
+ You're almost there, now run:
21
+
22
+ rake db:migrate
23
+
24
+ And finally:
25
+
26
+ rails server
data/ostatus/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ require 'rdoc/task'
4
+
5
+ require 'rspec/core'
6
+ require 'rspec/core/rake_task'
7
+
8
+ RSpec::Core::RakeTask.new(:spec)
9
+
10
+ task :default => :spec
11
+
12
+ Rake::RDocTask.new(:rdoc) do |rdoc|
13
+ rdoc.rdoc_dir = 'rdoc'
14
+ rdoc.title = 'SocialStream::Ostatus'
15
+ rdoc.rdoc_files.include('README*')
16
+ rdoc.rdoc_files.include('lib/**/*.rb')
17
+ end
18
+
19
+ Bundler::GemHelper.install_tasks
20
+
21
+ # Modify this gem's tags
22
+ class Bundler::GemHelper
23
+ def version_tag
24
+ "ostatus#{version}"
25
+ end
26
+ end
@@ -0,0 +1,9 @@
1
+ class HostMetaController < ActionController::Metal
2
+ include ActionController::Redirecting
3
+ include Rails.application.routes.url_helpers
4
+
5
+ def index
6
+ self.response_body = Proudhon::HostMeta.to_xml("#{ webfinger_url }?q={uri}")
7
+ self.content_type = Mime::XML
8
+ end
9
+ end
@@ -0,0 +1,26 @@
1
+ class PshbController < ApplicationController
2
+ include SocialStream::Ostatus::Controllers::DebugRequests
3
+
4
+ skip_before_filter :verify_authenticity_token
5
+
6
+ def index
7
+ case params['hub.mode']
8
+ #TODO check PuSH specification about subscribe or async
9
+ when 'subscribe', 'async'
10
+ render :text => params['hub.challenge'], :status => 200
11
+ # TODO: confirm that params['hub.topic'] is a real
12
+ # requested subscription by someone in this node
13
+ return
14
+ when 'unsubscribe'
15
+ render :text => params['hub.challenge'], :status => 200
16
+ # TODO: confirm that params['hub.topic'] is a real
17
+ # requested unsubscription by someone in this node
18
+ # and delete permissions/remote actor if necessary
19
+ return
20
+ end
21
+
22
+ SocialStream::ActivityStreams.from_pshb_callback(request.body.read)
23
+
24
+ render text: "Success!"
25
+ end
26
+ end
@@ -0,0 +1,19 @@
1
+ class RemoteSubjectsController < ApplicationController
2
+ def index
3
+ raise ActiveRecord::NotFound if params[:q].blank?
4
+
5
+ @remote_subject =
6
+ RemoteSubject.find_or_create_by_webfinger_uri!(params[:q])
7
+
8
+ redirect_to @remote_subject
9
+ end
10
+
11
+ def show
12
+ @remote_subject =
13
+ RemoteSubject.find_by_slug!(params[:id])
14
+
15
+ if params[:refresh]
16
+ @remote_subject.refresh_webfinger!
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ class SalmonController < ApplicationController
2
+ include SocialStream::Ostatus::Controllers::DebugRequests
3
+
4
+ skip_before_filter :verify_authenticity_token
5
+
6
+ def index
7
+ actor = Actor.find_by_slug! params[:slug]
8
+
9
+ SocialStream::ActivityStreams.from_salmon_callback request.body.read, actor
10
+
11
+ # TODO handle errors
12
+
13
+ render text: "Success!"
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ class SubjectsController < ApplicationController
2
+ def lrdd
3
+
4
+ end
5
+ end
@@ -0,0 +1,24 @@
1
+ class WebfingerController < ActionController::Metal
2
+ include ActionController::Redirecting
3
+ include Rails.application.routes.url_helpers
4
+
5
+ def index
6
+ actor = Actor.find_by_webfinger!(params[:q])
7
+
8
+ finger = Proudhon::Finger.new(
9
+ :subject => actor.webfinger_uri,
10
+ :alias => [polymorphic_url(actor.subject)],
11
+ :links => {
12
+ avatar: root_url + actor.logo.url(:original),
13
+ profile: polymorphic_url([actor.subject, :profile]),
14
+ updates_from: polymorphic_url([actor.subject, :activities], :format => :atom),
15
+ salmon: salmon_url(actor.slug),
16
+ replies: salmon_url(actor.slug),
17
+ mention: salmon_url(actor.slug),
18
+ magic_key: actor.magic_public_key
19
+ })
20
+
21
+ self.response_body = finger.to_xml
22
+ self.content_type = Mime::XML
23
+ end
24
+ end
@@ -0,0 +1,3 @@
1
+ Activity.class_eval do
2
+ include SocialStream::Ostatus::Models::Activity
3
+ end