Merge branch 'master' of github.com:diaspora/diaspora

This commit is contained in:
maxwell 2010-10-05 17:51:10 -07:00
commit ec4c63ada7
46 changed files with 185 additions and 83 deletions

1
.gitignore vendored
View file

@ -19,3 +19,4 @@ bin/*
nbproject nbproject
config/initializers/secret_token.rb config/initializers/secret_token.rb
public/source.tar public/source.tar
config/fb_config.yml

View file

@ -18,13 +18,11 @@ instructions.
You are welcome to contribute, add to and extend Diaspora however you see fit. We You are welcome to contribute, add to and extend Diaspora however you see fit. We
will do our best to incorporate everything that meets our guidelines. will do our best to incorporate everything that meets our guidelines.
We need you to fill out a Please do not rebase our tree into yours.
[contributor agreement form](https://spreadsheets.google.com/a/joindiaspora.com/viewform?formkey=dGI2cHA3ZnNHLTJvbm10LUhXRTJjR0E6MQ&theme=0AX42CRMsmRFbUy1iOGYwN2U2Mi1hNWU0LTRlNjEtYWMyOC1lZmU4ODg1ODc1ODI&ifq) See [here](http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg39091.html)
before we can accept your patches. The agreement gives Diaspora joint for when to rebase.
ownership of the patch so the copyright isn't scattered. You can find it
[here](https://spreadsheets.google.com/a/joindiaspora.com/viewform?formkey=dGI2cHA3ZnNHLTJvbm10LUhXRTJjR0E6MQ&theme=0AX42CRMsmRFbUy1iOGYwN2U2Mi1hNWU0LTRlNjEtYWMyOC1lZmU4ODg1ODc1ODI&ifq).
All commits must be tested, and after each commit, all tests should be green All commits must be tested, and all your tests should be green
before a pull request is sent. Please write your tests in Rspec. before a pull request is sent. Please write your tests in Rspec.
GEMS: We would like to keep external dependencies unduplicated. We're using GEMS: We would like to keep external dependencies unduplicated. We're using
@ -32,6 +30,12 @@ Nokogiri, Mongomapper, and EM::HttpRequest as much as possible. We have a few
gems in the project we'd rather not use, but if you can, use dependencies we gems in the project we'd rather not use, but if you can, use dependencies we
already have. already have.
We need you to fill out a
[contributor agreement form](https://spreadsheets.google.com/a/joindiaspora.com/viewform?formkey=dGI2cHA3ZnNHLTJvbm10LUhXRTJjR0E6MQ&theme=0AX42CRMsmRFbUy1iOGYwN2U2Mi1hNWU0LTRlNjEtYWMyOC1lZmU4ODg1ODc1ODI&ifq)
before we can accept your patches. The agreement gives Diaspora joint
ownership of the patch so the copyright isn't scattered. You can find it
[here](https://spreadsheets.google.com/a/joindiaspora.com/viewform?formkey=dGI2cHA3ZnNHLTJvbm10LUhXRTJjR0E6MQ&theme=0AX42CRMsmRFbUy1iOGYwN2U2Mi1hNWU0LTRlNjEtYWMyOC1lZmU4ODg1ODc1ODI&ifq).
## Resources ## Resources
We are maintaining a We are maintaining a

View file

@ -52,7 +52,7 @@ class AspectsController < ApplicationController
@fb_access_url = MiniFB.oauth_url(FB_APP_ID, APP_CONFIG[:pod_url] + "services/create", @fb_access_url = MiniFB.oauth_url(FB_APP_ID, APP_CONFIG[:pod_url] + "services/create",
:scope=>MiniFB.scopes.join(",")) :scope=>MiniFB.scopes.join(","))
@posts = current_user.visible_posts(:public => true).paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC' @posts = current_user.visible_posts(:person_id => current_user.person.id, :public => true).paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC'
respond_with @aspect respond_with @aspect
end end

View file

@ -9,7 +9,8 @@ class PhotosController < ApplicationController
respond_to :json, :only => :show respond_to :json, :only => :show
def create def create
album = Album.find_by_id params[:album_id] album = current_user.find_visible_post_by_id( params[:album_id] )
begin begin
######################## dealing with local files ############# ######################## dealing with local files #############

View file

@ -28,6 +28,12 @@ class PublicsController < ApplicationController
end end
end end
def hub
if params['hub.mode'] == 'subscribe' || params['hub.mode'] == 'unsubscribe'
render :text => params['hub.challenge'], :status => 202, :layout => false
end
end
def receive def receive
render :nothing => true render :nothing => true
return unless params[:xml] return unless params[:xml]

View file

@ -13,7 +13,7 @@ class UsersController < ApplicationController
@user = current_user @user = current_user
@person = @user.person @person = @user.person
@profile = @user.person.profile @profile = @user.person.profile
@photos = Photo.find_all_by_person_id(@person.id).paginate :page => params[:page], :order => 'created_at DESC' @photos = current_user.visible_posts(:person_id => current_user.person.id, :_type => 'Photo').paginate :page => params[:page], :order => 'created_at DESC'
@fb_access_url = MiniFB.oauth_url(FB_APP_ID, APP_CONFIG[:pod_url] + "services/create", @fb_access_url = MiniFB.oauth_url(FB_APP_ID, APP_CONFIG[:pod_url] + "services/create",
:scope=>MiniFB.scopes.join(",")) :scope=>MiniFB.scopes.join(","))
@ -49,7 +49,7 @@ class UsersController < ApplicationController
director = Diaspora::Director.new director = Diaspora::Director.new
ostatus_builder = Diaspora::OstatusBuilder.new(user) ostatus_builder = Diaspora::OstatusBuilder.new(user)
render :xml => director.build(ostatus_builder) render :xml => director.build(ostatus_builder), :content_type => 'application/atom+xml'
else else
flash[:error] = "User #{params[:username]} does not exist!" flash[:error] = "User #{params[:username]} does not exist!"
redirect_to root_url redirect_to root_url

View file

@ -110,7 +110,7 @@ class Person
hcard = HCard.find profile.hcard.first[:href] hcard = HCard.find profile.hcard.first[:href]
new_person.url = hcard[:url] new_person.url = hcard[:url]
new_person.profile = Profile.new(:first_name => hcard[:given_name], :last_name => hcard[:family_name]) new_person.profile = Profile.new(:first_name => hcard[:given_name], :last_name => hcard[:family_name], :image_url => hcard[:photo])
if new_person.save if new_person.save
new_person new_person
else else

View file

@ -13,12 +13,13 @@ class StatusMessage < Post
def to_activity def to_activity
<<-XML <<-XML
<entry> <entry>
<activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
<title>#{self.message}</title> <title>#{self.message}</title>
<link rel="alternate" type="text/html" href="#{person.url}status_messages/#{self.id}"/> <link rel="alternate" type="text/html" href="#{person.url}status_messages/#{self.id}"/>
<id>#{person.url}status_messages/#{self.id}</id> <id>#{person.url}status_messages/#{self.id}</id>
<published>#{self.created_at.xmlschema}</published> <published>#{self.created_at.xmlschema}</published>
<updated>#{self.updated_at.xmlschema}</updated> <updated>#{self.updated_at.xmlschema}</updated>
<activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
<activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
</entry> </entry>
XML XML
end end

View file

@ -167,6 +167,8 @@ class User
target_people = target_people | aspect.people target_people = target_people | aspect.people
} }
push_to_hub(post) if post.respond_to?(:public) && post.public
push_to_people(post, target_people) push_to_people(post, target_people)
end end
@ -179,10 +181,14 @@ class User
end end
def push_to_person( person, xml ) def push_to_person( person, xml )
Rails.logger.debug("Adding xml for #{self} to message queue to #{url}") Rails.logger.debug("Adding xml for #{self} to message queue to #{self.url}")
QUEUE.add_post_request( person.receive_url, xml ) QUEUE.add_post_request( person.receive_url, xml )
QUEUE.process QUEUE.process
end
def push_to_hub(post)
Rails.logger.debug("Pushing update to pubsub server #{APP_CONFIG[:pubsub_server]} with url #{self.public_url}")
QUEUE.add_hub_notification(APP_CONFIG[:pubsub_server], self.public_url)
end end
def salmon( post ) def salmon( post )

View file

@ -33,6 +33,12 @@
<a href="<%= @person.url%>" rel="me" id="pod_location" class="url"><%= @person.url%></a> <a href="<%= @person.url%>" rel="me" id="pod_location" class="url"><%= @person.url%></a>
</dd> </dd>
</dl> </dl>
<dl class="entity_photo">
<dt>Photo</dt>
<dd>
<span class="photo"><%= @person.profile.image_url%></span>
</dd>
</dl>
<dl class="entity_note"> <dl class="entity_note">
<dt>Note</dt> <dt>Note</dt>
<dd class="note">Diaspora is awesome! vi is better than emacs!</dd> <dd class="note">Diaspora is awesome! vi is better than emacs!</dd>

View file

@ -5,5 +5,8 @@
<Link rel="http://microformats.org/profile/hcard" type="text/html" href="<%=@person.url%>hcard/users/<%=@person.id%>"/> <Link rel="http://microformats.org/profile/hcard" type="text/html" href="<%=@person.url%>hcard/users/<%=@person.id%>"/>
<Link rel="http://joindiaspora.com/seed_location" type = 'text/html' href="<%=@person.url%>"/> <Link rel="http://joindiaspora.com/seed_location" type = 'text/html' href="<%=@person.url%>"/>
<Link rel="http://joindiaspora.com/guid" type = 'text/html' href="<%=@person.id%>"/> <Link rel="http://joindiaspora.com/guid" type = 'text/html' href="<%=@person.id%>"/>
<Link rel="http://schemas.google.com/g/2010#updates-from" type="application/atom+xml" href="<%=@person.public_url%>"/>
<Link rel="diaspora-public-key" type = 'RSA' href="<%=Base64.encode64(@person.exported_key)%>"/> <Link rel="diaspora-public-key" type = 'RSA' href="<%=Base64.encode64(@person.exported_key)%>"/>
</XRD> </XRD>

View file

@ -57,7 +57,7 @@
#submit_block #submit_block
= link_to t('.cancel'), root_path = link_to t('.cancel'), root_path
or = t('.or')
= f.submit t('.update_profile') = f.submit t('.update_profile')
#content_bottom #content_bottom

View file

@ -5,8 +5,9 @@
%h2 Services %h2 Services
%h3 Facebook - if FACEBOOK
%p %h3 Facebook
%p
- if @logged_in - if @logged_in
= connected_fb_as(@access_token) = connected_fb_as(@access_token)

View file

@ -56,6 +56,11 @@ namespace :deploy do
run "ln -s -f #{shared_path}/app_config.yml #{current_path}/config/app_config.yml" run "ln -s -f #{shared_path}/app_config.yml #{current_path}/config/app_config.yml"
end end
task :symlink_fb_config do
run "touch #{shared_path}/fb_config.yml"
run "ln -s -f #{shared_path}/fb_config.yml #{current_path}/config/fb_config.yml"
end
task :start do task :start do
start_mongo start_mongo
start_thin start_thin
@ -152,4 +157,4 @@ namespace :db do
end end
after "deploy:symlink", "deploy:symlink_images", "deploy:symlink_bundle", 'deploy:symlink_config' after "deploy:symlink", "deploy:symlink_images", "deploy:symlink_bundle", 'deploy:symlink_config', 'deploy:symlink_fb_config'

View file

@ -6,7 +6,7 @@ cross_server:
deploy_to: '/usr/local/app/diaspora' deploy_to: '/usr/local/app/diaspora'
user: 'root' user: 'root'
repo: 'git://github.com/diaspora/diaspora.git' repo: 'git://github.com/diaspora/diaspora.git'
branch: 'salmon_refactor' branch: 'master'
default_env: 'development' default_env: 'development'
servers: servers:
tom: tom:

View file

@ -7,13 +7,17 @@ require File.expand_path('../application', __FILE__)
Haml::Template.options[:format] = :html5 Haml::Template.options[:format] = :html5
Haml::Template.options[:escape_html] = true Haml::Template.options[:escape_html] = true
# Load facebook connection application credentials if File.exists?(File.expand_path("./config/fb_config.yml"))
fb_config = YAML::load(File.open(File.expand_path("./config/fb_config.yml"))) # Load facebook connection application credentials
FB_API_KEY = fb_config['fb_api_key'] fb_config = YAML::load(File.open(File.expand_path("./config/fb_config.yml")))
FB_SECRET = fb_config['fb_secret'] FB_API_KEY = fb_config['fb_api_key']
FB_APP_ID = fb_config['fb_app_id'] FB_SECRET = fb_config['fb_secret']
HOST = fb_config['host'] FB_APP_ID = fb_config['fb_app_id']
HOST = fb_config['host']
FACEBOOK = true
else
FACEBOOK = false
end
# Initialize the rails application # Initialize the rails application
Diaspora::Application.initialize! Diaspora::Application.initialize!

View file

@ -0,0 +1,4 @@
fb_api_key: {key}
fb_secret: {secret}
fb_app_id: {app_id}
host: http://localhost:3000/

View file

@ -18,7 +18,7 @@ he:
invalid: "הססמה או הדוא״ל שגויים." invalid: "הססמה או הדוא״ל שגויים."
invalid_token: "אסימון האימות שגוי." invalid_token: "אסימון האימות שגוי."
timeout: "ההפעלה שלך פגה, נא להיכנס שוב כדי להמשיך." timeout: "ההפעלה שלך פגה, נא להיכנס שוב כדי להמשיך."
inactive: "חשבונך לא הופעל עדין." inactive: "חשבונך לא הופעל עדיין."
sessions: sessions:
signed_in: "נכנסת בהצלחה." signed_in: "נכנסת בהצלחה."
signed_out: "יצאת בהצלחה." signed_out: "יצאת בהצלחה."

View file

@ -113,6 +113,7 @@ en:
albums: "Albums" albums: "Albums"
you_dont_have_any_photos: "You don't have any photos! Go to the" you_dont_have_any_photos: "You don't have any photos! Go to the"
page_to_upload_some: "page to upload some." page_to_upload_some: "page to upload some."
or: "or"
comments: comments:
comment: comment:
ago: "ago" ago: "ago"

View file

@ -86,7 +86,7 @@ he:
add_a_new_aspect: "הוספת היבט חדש" add_a_new_aspect: "הוספת היבט חדש"
create: "יציאה" create: "יציאה"
create: create:
success: "יש ללחוץ על סמל הפלוס שמימין כדי לומר לדיאספורה מי יעול לצפות בהיבט החדש שלך." success: "יש ללחוץ על סמל הפלוס שמימין כדי לומר לדיאספורה מי יכול לצפות בהיבט החדש שלך."
destroy: destroy:
success: "%{name} הוסר בהצלחה." success: "%{name} הוסר בהצלחה."
update: update:
@ -99,7 +99,7 @@ he:
success: "כעת יופיע בפני החברים שלך היבט אחר שלך." success: "כעת יופיע בפני החברים שלך היבט אחר שלך."
helper: helper:
remove: "הסרה" remove: "הסרה"
aspect_not_empty: "ההיסט אינו ריק" aspect_not_empty: "ההיבט אינו ריק"
users: users:
edit: edit:
editing_profile: "עריכת הפרופיל" editing_profile: "עריכת הפרופיל"
@ -134,13 +134,13 @@ he:
delete_photo: "מחיקת תמונה" delete_photo: "מחיקת תמונה"
photo: photo:
show_comments: "הצגת הערות" show_comments: "הצגת הערות"
posted_a_new_photo_to: "פורסמה תמונה חדשה אל" posted_a_new_photo_to: "פורסמה תמונה חדשה באלבום"
new: new:
new_photo: "תמונה חדשה" new_photo: "תמונה חדשה"
back_to_list: "חזרה לרשימה" back_to_list: "חזרה לרשימה"
post_it: "פרסום!" post_it: "פרסום!"
create: create:
runtime_error: "העלאת התמונה נכשלה. האם החגורה שלך מהודקת?" runtime_error: "העלאת התמונה נכשלה. הידקת את החגורה?"
integrity_error: "העלאת התמונה נכשלה. האם זו באמת הייתה תמונה?" integrity_error: "העלאת התמונה נכשלה. האם זו באמת הייתה תמונה?"
type_error: "העלאת התמונה נכשלה. האם באמת נוספה תמונה?" type_error: "העלאת התמונה נכשלה. האם באמת נוספה תמונה?"
update: update:
@ -155,7 +155,7 @@ he:
success: "הצטרפת לדיאספורה!" success: "הצטרפת לדיאספורה!"
status_messages: status_messages:
new_status_message: new_status_message:
tell_me_something_good: "בא לי לשמוע סיפור טוב" tell_me_something_good: "בא לי לשמוע סיפור נחמד"
oh_yeah: "אחלה!" oh_yeah: "אחלה!"
status_message: status_message:
show_comments: "הצגת הערות" show_comments: "הצגת הערות"
@ -165,7 +165,7 @@ he:
status_message: "הודעת מצב" status_message: "הודעת מצב"
comments: "הערות" comments: "הערות"
are_you_sure: "בבטחה?" are_you_sure: "בבטחה?"
destroy: "הריבה" destroy: "הריסה"
view_all: "צפייה בכול" view_all: "צפייה בכול"
message: "הודעה" message: "הודעה"
owner: "בעלים" owner: "בעלים"

View file

@ -85,6 +85,7 @@ it:
create: "Crea" create: "Crea"
create: create:
success: "Clicca sul segno più nella parte sinistra per dire a Diaspora chi può vedere il tuo nuovo aspetto." success: "Clicca sul segno più nella parte sinistra per dire a Diaspora chi può vedere il tuo nuovo aspetto."
failure: "Creazione dell'aspetto fallita."
destroy: destroy:
success: "%{name} è stato rimosso con successo." success: "%{name} è stato rimosso con successo."
update: update:

View file

@ -66,7 +66,10 @@ ru:
add_a_new_aspect: "Добавить аспект" add_a_new_aspect: "Добавить аспект"
create: "Создать" create: "Создать"
create: create:
success:"Нажмите на плюс слева, для того, что-бы указать Diaspora тех, кто может видеть ваш новый аспект." success:"Нажмите на плюс слева, для того, что-бы указать Diaspora тех, кто может видеть ваш новый аспект
helper:
remove: "Удалить"
aspect_not_empty: "Аспект не пуст"
users: users:
edit: edit:
editing_profile: "Редактирование профиля" editing_profile: "Редактирование профиля"
@ -79,8 +82,9 @@ ru:
picture: "Аватар" picture: "Аватар"
editing_profile: "Редактирование профиля" editing_profile: "Редактирование профиля"
albums: "Альбомы" albums: "Альбомы"
you_dont_have_any_photos: "У вас нет ни одной фотографии! Перейдите на " you_dont_have_any_photos: "У вас нет ни одной фотографии! Перейдите в"
page_to_upload_some: "страницу для загрузки." page_to_upload_some: "для загрузки."
or: "или"
comments: comments:
comment: comment:
ago: "ранее" ago: "ранее"
@ -142,3 +146,18 @@ ru:
save: "сохранить" save: "сохранить"
are_you_sure: "Вы уверены?" are_you_sure: "Вы уверены?"
remove_friend: "удалить друга" remove_friend: "удалить друга"
requests:
new_request:
add_a_new_friend_to: "добавить нового друга к"
enter_a_diaspora_username: "Введите имя пользователя Diaspora:"
your_diaspora_username_is: "Ваше имя пользователя Diaspora: %{diaspora_handle}"
friends_username: "Имя пользователя друга"
destroy:
success: "Теперь вы друзья."
error: "Выберите аспект!"
ignore: "Игнорированные запросы дружбы."
create:
error: "Для этого адреса не найдено семя Diaspora!"
already_friends: "Вы уже друзья с %{destination_url}!"
success: "Запрос на дружбу выслан к %{destination_url}."
horribly_wrong: "Что-то пошло совсем не так."

View file

@ -43,6 +43,8 @@ Diaspora::Application.routes.draw do
match 'webfinger', :to => 'publics#webfinger' match 'webfinger', :to => 'publics#webfinger'
match 'hcard/users/:id', :to => 'publics#hcard' match 'hcard/users/:id', :to => 'publics#hcard'
match 'hub', :to => 'publics#hub'
match '.well-known/host-meta',:to => 'publics#host_meta' match '.well-known/host-meta',:to => 'publics#host_meta'
match 'receive/users/:id', :to => 'publics#receive' match 'receive/users/:id', :to => 'publics#receive'
match 'log', :to => "dev_utilities#log" match 'log', :to => "dev_utilities#log"

View file

@ -24,40 +24,41 @@ module Diaspora
end end
def create_headers def create_headers
<<-XML.strip <<-XML
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:georss="http://www.georss.org/georss" xmlns:activity="http://activitystrea.ms/spec/1.0/" xmlns:media="http://purl.org/syndication/atommedia" xmlns:poco="http://portablecontacts.net/spec/1.0" xmlns:ostatus="http://ostatus.org/schema/1.0" xmlns:statusnet="http://status.net/schema/api/1/"> <feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:georss="http://www.georss.org/georss" xmlns:activity="http://activitystrea.ms/spec/1.0/" xmlns:media="http://purl.org/syndication/atommedia" xmlns:poco="http://portablecontacts.net/spec/1.0" xmlns:ostatus="http://ostatus.org/schema/1.0" xmlns:statusnet="http://status.net/schema/api/1/">
<generator uri="http://joindiaspora.com/">Diaspora</generator> <generator uri="http://joindiaspora.com/">Diaspora</generator>
<id>#{@user.username}/public</id> <id>#{@user.public_url}.atom</id>
<title>Stream</title> <title>#{@user.real_name}'s Public Feed</title>
<subtitle>its a stream</subtitle> <subtitle>its a stream</subtitle>
<updated>#{Time.now.xmlschema}</updated> <updated>#{Time.now.xmlschema}</updated>
<author> <author>
<name>#{@user.real_name}</name> <name>#{@user.real_name}</name>
<uri>#{@user.public_url}</uri> <uri>#{@user.public_url}</uri>
</author> </author>
XML XML
end end
def create_endpoints def create_endpoints
<<-XML <<-XML
<link href="#{APP_CONFIG[:pubsub_server]}" rel="hub"/> <link href="#{APP_CONFIG[:pubsub_server]}" rel="hub"/>
<link href="#{@user.public_url}.atom" rel="self" type="application/atom+xml"/>
XML XML
end end
def create_subject def create_subject
<<-XML <<-XML
<activity:subject> <activity:subject>
<activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type>
<id>#{@user.public_url}</id> <id>#{@user.public_url}</id>
<title>#{@user.real_name}</title> <title>#{@user.real_name}</title>
<link rel="alternative" type="text/html" href="#{@user.public_url}"/> <link rel="alternative" type="text/html" href="#{@user.public_url}"/>
</activity:subject> </activity:subject>
XML XML
end end
def create_body def create_body
@user.visible_posts(:public=>true).inject("") do |xml,curr| @user.visible_posts(:person_id => @user.person.id, :public=>true).inject("") do |xml,curr|
if curr.respond_to?(:to_activity) if curr.respond_to?(:to_activity)
unless xml unless xml
curr.to_activity curr.to_activity
@ -70,7 +71,7 @@ module Diaspora
def create_footer def create_footer
<<-XML <<-XML
</feed> </feed>
XML XML
end end
end end

View file

@ -7,6 +7,7 @@ module HCard
doc = Nokogiri::HTML(Net::HTTP.get URI.parse(url)) doc = Nokogiri::HTML(Net::HTTP.get URI.parse(url))
{:given_name => doc.css(".given_name").text, {:given_name => doc.css(".given_name").text,
:family_name => doc.css(".family_name").text, :family_name => doc.css(".family_name").text,
:url => doc.css("#pod_location").text} :url => doc.css("#pod_location").text,
:photo => doc.css(".photo")}
end end
end end

View file

@ -20,6 +20,10 @@ class MessageHandler
[*destinations].each{|dest| @queue.push(Message.new(:post, dest, :body => b))} [*destinations].each{|dest| @queue.push(Message.new(:post, dest, :body => b))}
end end
def add_hub_notification(hub_url, feed_url)
@queue.push(Message.new(:hub_publish, hub_url, :body => feed_url))
end
def process def process
@queue.pop{ |query| @queue.pop{ |query|
case query.type case query.type
@ -29,6 +33,9 @@ class MessageHandler
when :get when :get
http = EventMachine::HttpRequest.new(query.destination).get :timeout => TIMEOUT http = EventMachine::HttpRequest.new(query.destination).get :timeout => TIMEOUT
http.callback {process} http.callback {process}
when :hub_publish
http = EventMachine::PubSubHubbub.new(query.destination).publish :timeout => TIMEOUT
http.callback {process; Rails.logger.debug(http.response)}
else else
raise "message is not a type I know!" raise "message is not a type I know!"
end end

0
public/javascripts/fancybox/jquery.easing-1.3.pack.js Executable file → Normal file
View file

0
public/javascripts/fancybox/jquery.fancybox-1.3.1.css Executable file → Normal file
View file

0
public/javascripts/fancybox/jquery.fancybox-1.3.1.js Executable file → Normal file
View file

View file

View file

0
public/javascripts/fileuploader.js Executable file → Normal file
View file

0
public/javascripts/jquery.cycle/jquery.cycle.lite.min.js vendored Executable file → Normal file
View file

0
public/javascripts/jquery.infieldlabel.js Executable file → Normal file
View file

0
public/javascripts/web_socket.js Executable file → Normal file
View file

0
public/stylesheets/blueprint/src/grid.css Executable file → Normal file
View file

0
public/stylesheets/blueprint/src/print.css Executable file → Normal file
View file

0
public/stylesheets/blueprint/src/reset.css Executable file → Normal file
View file

View file

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

0
public/stylesheets/brandongrotesque_light/demo.html Executable file → Normal file
View file

View file

0
public/stylesheets/fileuploader.css Executable file → Normal file
View file

View file

@ -8,8 +8,12 @@ then
else else
mkdir -p -v log/thin/ mkdir -p -v log/thin/
#force AGPL #force AGPL
tar cf ../_source.tar -X .gitignore * test -w public -a ! -e public/source.tar &&
mv ../_source.tar public/source.tar tar cf public/source.tar --exclude='source.tar' -X .gitignore *
test -e public/source.tar || {
echo "Can't find, or even create, public/source.tar. Giving up"
exit 2
}
bundle exec ruby ./script/websocket_server.rb& bundle exec ruby ./script/websocket_server.rb&
bundle exec thin start $@ bundle exec thin start $@
fi fi

View file

@ -94,6 +94,26 @@ describe MessageHandler do
end end
end end
describe "Hub publish" do
it 'should correctly queue up a pubsubhubbub publish request' do
destination = "http://identi.ca/hub/"
feed_location = "http://google.com/"
EventMachine.run {
@handler.add_hub_notification(destination, feed_location)
q = @handler.instance_variable_get(:@queue)
message = ""
q.pop{|m| message = m}
message.destination.should == destination
message.body.should == feed_location
EventMachine.stop
}
end
end
describe "Mixed Queries" do describe "Mixed Queries" do
it 'should process both POST and GET requests in the same queue' do it 'should process both POST and GET requests in the same queue' do

View file

@ -12,12 +12,16 @@ describe User do
user = Factory.build(:user, :username => "ALLUPPERCASE") user = Factory.build(:user, :username => "ALLUPPERCASE")
user.valid? user.valid?
user.username.should == "alluppercase" user.username.should == "alluppercase"
user = Factory.build(:user, :username => "someUPPERCASE")
user.valid?
user.username.should == "someuppercase"
end end
end end
describe '#diaspora_handle' do describe '#diaspora_handle' do
it 'uses the pod config url to set the diaspora_handle' do it 'uses the pod config url to set the diaspora_handle' do
user.diaspora_handle.should == user.username + "@example.org" user.diaspora_handle.should == user.username + "@" + APP_CONFIG[:terse_pod_url]
end end
end end