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.
- data/.gitignore +6 -1
- data/.travis.yml +0 -2
- data/Gemfile +3 -0
- data/base/app/controllers/activities_controller.rb +14 -12
- data/base/app/controllers/api_controller.rb +0 -13
- data/base/app/controllers/frontpage_controller.rb +0 -6
- data/base/app/models/activity.rb +21 -61
- data/base/app/models/actor.rb +4 -8
- data/base/app/models/audience.rb +2 -0
- data/base/app/models/comment.rb +2 -1
- data/base/app/models/group.rb +0 -2
- data/base/app/models/relation/custom.rb +17 -4
- data/base/app/models/relation.rb +5 -1
- data/base/app/models/tie.rb +0 -2
- data/base/app/models/user.rb +0 -2
- data/base/app/views/activities/_options.html.erb +1 -1
- data/base/app/views/activities/index.atom.builder +48 -0
- data/base/app/views/activity_objects/_activity_object.atom.erb +1 -0
- data/base/config/locales/en.yml +8 -0
- data/base/config/locales/es.yml +8 -0
- data/base/config/routes.rb +0 -8
- data/base/lib/rails/social_stream.rb +1 -1
- data/base/lib/social_stream/ability/base.rb +4 -16
- data/base/lib/social_stream/activity_streams/subtype.rb +11 -0
- data/base/lib/social_stream/activity_streams/supertype.rb +12 -0
- data/base/lib/social_stream/activity_streams.rb +39 -0
- data/base/lib/social_stream/base/dependencies.rb +2 -0
- data/base/lib/social_stream/base/engine.rb +6 -0
- data/base/lib/social_stream/base/version.rb +1 -1
- data/base/lib/social_stream/models/object.rb +5 -0
- data/base/lib/social_stream/models/subject.rb +1 -1
- data/base/lib/social_stream/models/subtype.rb +2 -0
- data/base/lib/social_stream/models/supertype.rb +2 -0
- data/base/lib/social_stream-base.rb +5 -0
- data/base/social_stream-base.gemspec +2 -0
- data/base/spec/controllers/activities_controller_spec.rb +18 -0
- data/base/spec/controllers/frontpage_controller_spec.rb +0 -5
- data/base/spec/models/activity_wall_spec.rb +96 -0
- data/base/spec/models/post_authorization_spec.rb +370 -0
- data/base/spec/models/post_spec.rb +0 -2
- data/base/spec/models/relation_spec.rb +22 -0
- data/base/spec/social_stream_activity_streams_spec.rb +16 -0
- data/base/spec/social_stream_spec.rb +1 -1
- data/documents/app/views/common_documents/_document_info.html.erb +2 -2
- data/documents/app/views/common_documents/_index.html.erb +2 -2
- data/documents/lib/social_stream/documents/engine.rb +7 -0
- data/documents/lib/social_stream/documents/version.rb +1 -1
- data/documents/social_stream-documents.gemspec +1 -1
- data/events/app/decorators/social_stream/base/actor_decorator.rb +3 -0
- data/events/app/decorators/social_stream/base/document_decorator.rb +3 -0
- data/events/lib/social_stream/events/engine.rb +2 -10
- data/events/lib/social_stream/events/version.rb +1 -1
- data/events/social_stream-events.gemspec +1 -1
- data/lib/generators/social_stream/install_generator.rb +1 -0
- data/lib/social_stream/version.rb +1 -1
- data/lib/social_stream.rb +7 -6
- data/linkser/lib/social_stream/linkser/engine.rb +3 -0
- data/linkser/lib/social_stream/linkser/version.rb +1 -1
- data/linkser/social_stream-linkser.gemspec +1 -1
- data/ostatus/Gemfile +3 -0
- data/ostatus/MIT-LICENSE +20 -0
- data/ostatus/README.rdoc +26 -0
- data/ostatus/Rakefile +26 -0
- data/{base → ostatus}/app/assets/images/logos/actor/remote_subject.png +0 -0
- data/ostatus/app/assets/images/logos/contact/remote_subject.png +0 -0
- data/ostatus/app/assets/images/logos/original/remote_subject.png +0 -0
- data/ostatus/app/assets/images/logos/profile/remote_subject.png +0 -0
- data/ostatus/app/controllers/host_meta_controller.rb +9 -0
- data/ostatus/app/controllers/pshb_controller.rb +26 -0
- data/ostatus/app/controllers/remote_subjects_controller.rb +19 -0
- data/ostatus/app/controllers/salmon_controller.rb +15 -0
- data/ostatus/app/controllers/subjects_controller.rb +5 -0
- data/ostatus/app/controllers/webfinger_controller.rb +24 -0
- data/ostatus/app/decorators/social_stream/base/activity_decorator.rb +3 -0
- data/ostatus/app/decorators/social_stream/base/actor_decorator.rb +3 -0
- data/ostatus/app/decorators/social_stream/base/audience_decorator.rb +3 -0
- data/ostatus/app/decorators/social_stream/base/relation/custom_decorator.rb +3 -0
- data/ostatus/app/decorators/social_stream/base/tie_decorator.rb +3 -0
- data/ostatus/app/models/actor_key.rb +30 -0
- data/ostatus/app/models/remote_subject.rb +139 -0
- data/ostatus/app/views/remote_subjects/_show.html.erb +6 -0
- data/ostatus/app/views/remote_subjects/show.html.erb +5 -0
- data/ostatus/config/locales/en.yml +34 -0
- data/ostatus/config/routes.rb +13 -0
- data/ostatus/db/migrate/20120905145030_create_social_stream_ostatus.rb +20 -0
- data/ostatus/db/migrate/20120918194708_create_actor_keys.rb +18 -0
- data/ostatus/lib/generators/social_stream/ostatus/install_generator.rb +16 -0
- data/ostatus/lib/generators/social_stream/ostatus/templates/initializer.rb +18 -0
- data/ostatus/lib/social_stream/migrations/ostatus.rb +9 -0
- data/ostatus/lib/social_stream/ostatus/activity_streams.rb +79 -0
- data/ostatus/lib/social_stream/ostatus/controllers/debug_requests.rb +24 -0
- data/ostatus/lib/social_stream/ostatus/engine.rb +21 -0
- data/ostatus/lib/social_stream/ostatus/models/activity.rb +41 -0
- data/ostatus/lib/social_stream/ostatus/models/actor.rb +89 -0
- data/ostatus/lib/social_stream/ostatus/models/audience.rb +19 -0
- data/ostatus/lib/social_stream/ostatus/models/object.rb +28 -0
- data/ostatus/lib/social_stream/ostatus/models/relation/custom.rb +22 -0
- data/ostatus/lib/social_stream/ostatus/models/tie.rb +24 -0
- data/ostatus/lib/social_stream/ostatus/version.rb +5 -0
- data/ostatus/lib/social_stream-ostatus.rb +54 -0
- data/ostatus/social_stream-ostatus.gemspec +28 -0
- data/ostatus/spec/controllers/host_meta_controller_spec.rb +10 -0
- data/ostatus/spec/controllers/remote_subjects_controller_spec.rb +37 -0
- data/ostatus/spec/controllers/webfinger_controller_spec.rb +13 -0
- data/ostatus/spec/dummy/Rakefile +7 -0
- data/ostatus/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/ostatus/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/ostatus/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/ostatus/spec/dummy/config/application.rb +45 -0
- data/ostatus/spec/dummy/config/boot.rb +10 -0
- data/ostatus/spec/dummy/config/database.yml +22 -0
- data/ostatus/spec/dummy/config/environment.rb +5 -0
- data/ostatus/spec/dummy/config/environments/development.rb +26 -0
- data/ostatus/spec/dummy/config/environments/production.rb +49 -0
- data/ostatus/spec/dummy/config/environments/test.rb +35 -0
- data/ostatus/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/ostatus/spec/dummy/config/initializers/inflections.rb +10 -0
- data/ostatus/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/ostatus/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/ostatus/spec/dummy/config/initializers/session_store.rb +8 -0
- data/ostatus/spec/dummy/config/locales/en.yml +5 -0
- data/ostatus/spec/dummy/config/routes.rb +58 -0
- data/ostatus/spec/dummy/config.ru +4 -0
- data/ostatus/spec/dummy/public/404.html +26 -0
- data/ostatus/spec/dummy/public/422.html +26 -0
- data/ostatus/spec/dummy/public/500.html +26 -0
- data/ostatus/spec/dummy/public/favicon.ico +0 -0
- data/ostatus/spec/dummy/public/javascripts/application.js +2 -0
- data/ostatus/spec/dummy/public/javascripts/controls.js +965 -0
- data/ostatus/spec/dummy/public/javascripts/dragdrop.js +974 -0
- data/ostatus/spec/dummy/public/javascripts/effects.js +1123 -0
- data/ostatus/spec/dummy/public/javascripts/prototype.js +6001 -0
- data/ostatus/spec/dummy/public/javascripts/rails.js +191 -0
- data/ostatus/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/ostatus/spec/dummy/script/rails +6 -0
- data/ostatus/spec/factories/remote_subject.rb +39 -0
- data/ostatus/spec/integration/navigation_spec.rb +9 -0
- data/ostatus/spec/models/actor_key_spec.rb +9 -0
- data/ostatus/spec/models/post_spec.rb +25 -0
- data/ostatus/spec/models/remote_subject_spec.rb +24 -0
- data/ostatus/spec/social_stream_ostatus.spec.rb +9 -0
- data/ostatus/spec/social_stream_ostatus_activity_streams.spec.rb +31 -0
- data/ostatus/spec/spec_helper.rb +33 -0
- data/presence/app/decorators/social_stream/base/models/group_decorator.rb +3 -0
- data/presence/app/decorators/social_stream/base/models/tie_decorator.rb +3 -0
- data/presence/lib/generators/social_stream/presence/install_generator.rb +1 -1
- data/presence/lib/social_stream/presence/engine.rb +0 -12
- data/presence/lib/social_stream/presence/version.rb +1 -1
- data/presence/social_stream-presence.gemspec +1 -1
- data/social_stream.gemspec +6 -5
- data/spec/support/db.rb +1 -1
- metadata +125 -18
- data/base/app/assets/images/logos/actor/remote_user.png +0 -0
- data/base/app/controllers/subjects_controller.rb +0 -7
- data/base/app/views/api/activity_atom_feed.atom.builder +0 -40
- data/base/app/views/frontpage/host_meta.xml.builder +0 -11
- data/base/spec/models/activity_authorization_spec.rb +0 -354
@@ -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
|
+
|
@@ -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
|
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
|
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
|
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
|
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
|
@@ -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.
|
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')
|
@@ -7,16 +7,8 @@ module SocialStream
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
initializer "social_stream-events.
|
11
|
-
|
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
|
@@ -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.
|
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
|
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
|
6
|
-
config.app_generators.documents
|
7
|
-
config.app_generators.events
|
8
|
-
config.app_generators.linkser
|
9
|
-
config.app_generators.chat
|
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
|
|
@@ -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.
|
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
data/ostatus/MIT-LICENSE
ADDED
@@ -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.
|
data/ostatus/README.rdoc
ADDED
@@ -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
|
File without changes
|
Binary file
|
Binary file
|
Binary file
|
@@ -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,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
|