diff --git a/.gitignore b/.gitignore index bd8338dc55266b3febf5dc901181674e79061f21..1fbfd2e0431ec251a2e56b9bb876c7d83d7e7ff7 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ bin/* nbproject config/initializers/secret_token.rb public/source.tar +config/fb_config.yml diff --git a/README.md b/README.md index f21676bdd067076c8169c5b3684b94b8c60d57a6..57bb01c4e4aa330cbe728daad80375786e01a7ed 100644 --- a/README.md +++ b/README.md @@ -18,13 +18,11 @@ instructions. 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. -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). +Please do not rebase our tree into yours. +See [here](http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg39091.html) +for when to rebase. -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. 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 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 We are maintaining a diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index cf9cc1583c0a9df3f608d2f308eec3f5fa12abce..3b9180be83761031c92c2ceefdcd8c19745a36bd 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -52,7 +52,7 @@ class AspectsController < ApplicationController @fb_access_url = MiniFB.oauth_url(FB_APP_ID, APP_CONFIG[:pod_url] + "services/create", :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 end diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 4d865573c8c85ecd5e5ac96350403ad2aab131f5..dca510374151a5fa41f003e486464736e8f5bf9d 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -9,7 +9,8 @@ class PhotosController < ApplicationController respond_to :json, :only => :show def create - album = Album.find_by_id params[:album_id] + album = current_user.find_visible_post_by_id( params[:album_id] ) + begin ######################## dealing with local files ############# diff --git a/app/controllers/publics_controller.rb b/app/controllers/publics_controller.rb index e3c90fc16adfcdc2a7864f9d9da462f262cd9ff3..311fdf73f7b55f436f666ff6b82a4be2aba1a363 100644 --- a/app/controllers/publics_controller.rb +++ b/app/controllers/publics_controller.rb @@ -28,6 +28,12 @@ class PublicsController < ApplicationController 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 render :nothing => true return unless params[:xml] diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4a68d8bd2e66198e7a678a9f7b28d1cb534efff0..ab8939b87d7f4e224fbf75586d7903e5795e5289 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -13,7 +13,7 @@ class UsersController < ApplicationController @user = current_user @person = @user.person @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", :scope=>MiniFB.scopes.join(",")) @@ -49,7 +49,7 @@ class UsersController < ApplicationController director = Diaspora::Director.new ostatus_builder = Diaspora::OstatusBuilder.new(user) - render :xml => director.build(ostatus_builder) + render :xml => director.build(ostatus_builder), :content_type => 'application/atom+xml' else flash[:error] = "User #{params[:username]} does not exist!" redirect_to root_url diff --git a/app/models/person.rb b/app/models/person.rb index 28503e921f1591cd17e059c477480a74aca3fc38..a6d295529a5c1658b9b7166a3aa65eecbf1e7033 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -110,7 +110,7 @@ class Person hcard = HCard.find profile.hcard.first[:href] 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 new_person else diff --git a/app/models/status_message.rb b/app/models/status_message.rb index c616efc5e7fa11ddc17f2246c649a0bbba442851..b509bfe5a9f6ee6cc66210aba8c4d5cc1bb6df57 100644 --- a/app/models/status_message.rb +++ b/app/models/status_message.rb @@ -13,12 +13,13 @@ class StatusMessage < Post def to_activity <<-XML <entry> - <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb> - <title>#{self.message}</title> - <link rel="alternate" type="text/html" href="#{person.url}status_messages/#{self.id}"/> - <id>#{person.url}status_messages/#{self.id}</id> - <published>#{self.created_at.xmlschema}</published> - <updated>#{self.updated_at.xmlschema}</updated> + <title>#{self.message}</title> + <link rel="alternate" type="text/html" href="#{person.url}status_messages/#{self.id}"/> + <id>#{person.url}status_messages/#{self.id}</id> + <published>#{self.created_at.xmlschema}</published> + <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> XML end diff --git a/app/models/user.rb b/app/models/user.rb index 2f63f4b5f124195f52879f55257373b3449fe4d4..15c3515c2dd75b334ea580085958c5943a48da8a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -167,6 +167,8 @@ class User target_people = target_people | aspect.people } + push_to_hub(post) if post.respond_to?(:public) && post.public + push_to_people(post, target_people) end @@ -179,10 +181,14 @@ class User end def push_to_person( person, xml ) - Rails.logger.debug("Adding xml for #{self} to message queue to #{url}") - QUEUE.add_post_request( person.receive_url, xml ) - QUEUE.process + Rails.logger.debug("Adding xml for #{self} to message queue to #{self.url}") + QUEUE.add_post_request( person.receive_url, xml ) + 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 def salmon( post ) diff --git a/app/views/publics/hcard.erb b/app/views/publics/hcard.erb index 9e3f27796850f0c5f44c27038d1f274c8cdf8c6b..17b0ebdb740de725566012e698398acf66328207 100644 --- a/app/views/publics/hcard.erb +++ b/app/views/publics/hcard.erb @@ -33,6 +33,12 @@ <a href="<%= @person.url%>" rel="me" id="pod_location" class="url"><%= @person.url%></a> </dd> </dl> + <dl class="entity_photo"> + <dt>Photo</dt> + <dd> + <span class="photo"><%= @person.profile.image_url%></span> + </dd> + </dl> <dl class="entity_note"> <dt>Note</dt> <dd class="note">Diaspora is awesome! vi is better than emacs!</dd> diff --git a/app/views/publics/webfinger.erb b/app/views/publics/webfinger.erb index 47b76e6e60958c383551b6315ce10e492b1112ec..b689f2a541370b63221c0d710eeaa8d7c92582c9 100644 --- a/app/views/publics/webfinger.erb +++ b/app/views/publics/webfinger.erb @@ -5,5 +5,8 @@ <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/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)%>"/> </XRD> diff --git a/app/views/shared/_aspect_friends.haml b/app/views/shared/_aspect_friends.haml index f8e635f8d87e7ae3f8f1c16b8d13f7500eb7519d..e24dc5537082f566498eac870e299c92e23ab26d 100644 --- a/app/views/shared/_aspect_friends.haml +++ b/app/views/shared/_aspect_friends.haml @@ -6,11 +6,11 @@ = owner_image_link - for friend in @friends = person_image_link(friend) - - if @logged_in && (@aspect == :public) - %h3 Facebook Friends - - @fb_friends = MiniFB.get(@access_token, 'me', :type => "friends") - - @fb_friends[:data].each do |friend| - = image_tag( "http://graph.facebook.com/#{friend[:id]}/picture" ) + - if @logged_in && (@aspect == :public) + %h3 Facebook Friends + - @fb_friends = MiniFB.get(@access_token, 'me', :type => "friends") + - @fb_friends[:data].each do |friend| + = image_tag( "http://graph.facebook.com/#{friend[:id]}/picture" ) -unless (@aspect == :all) || (@aspect == :public) = link_to (image_tag('add_friend_button.png', :height => "50px", :width => "50px")), "#add_request_pane", :id => 'add_request_button' diff --git a/app/views/users/_profile.haml b/app/views/users/_profile.haml index 78304d183596f919087eba46be709960daf5cfe1..8cffa53cb096357262fce193ac79fc9f79bad909 100644 --- a/app/views/users/_profile.haml +++ b/app/views/users/_profile.haml @@ -57,7 +57,7 @@ #submit_block = link_to t('.cancel'), root_path - or + = t('.or') = f.submit t('.update_profile') #content_bottom diff --git a/app/views/users/_services.haml b/app/views/users/_services.haml index f2d976a79a2b44584ce6fd8c74ff87f4e2d11a29..fd1894d117d622a3f05dc16f167f222c2feb667a 100644 --- a/app/views/users/_services.haml +++ b/app/views/users/_services.haml @@ -5,19 +5,20 @@ %h2 Services -%h3 Facebook -%p - - if @logged_in - = connected_fb_as(@access_token) - - %p - - @fb_friends = MiniFB.get(@access_token, 'me', :type => "friends") - - @fb_friends[:data].each do |friend| - = image_tag( "http://graph.facebook.com/#{friend[:id]}/picture" ) +- if FACEBOOK + %h3 Facebook + %p + - if @logged_in + = connected_fb_as(@access_token) + + %p + - @fb_friends = MiniFB.get(@access_token, 'me', :type => "friends") + - @fb_friends[:data].each do |friend| + = image_tag( "http://graph.facebook.com/#{friend[:id]}/picture" ) - = link_to "Disconnect from Facebook", services_destroy_path - - else - = link_to "Connect to Facebook (DO NOT USE WITH A REAL ACCOUNT)", @fb_access_url + = link_to "Disconnect from Facebook", services_destroy_path + - else + = link_to "Connect to Facebook (DO NOT USE WITH A REAL ACCOUNT)", @fb_access_url #content_bottom .back diff --git a/config/deploy.rb b/config/deploy.rb index 98d8971f71a8531371c94ffcc6fa5b434f482775..66c642885a4f4b2d3f4777636dd1e8aeb1cdc8ef 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -56,6 +56,11 @@ namespace :deploy do run "ln -s -f #{shared_path}/app_config.yml #{current_path}/config/app_config.yml" 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 start_mongo start_thin @@ -152,4 +157,4 @@ namespace :db do 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' diff --git a/config/deploy_config.yml b/config/deploy_config.yml index c53f90d60b15e233e73eb0952252adacc21099ac..c7477314a2b359c2e9b6b15dafbda3602d4a8eed 100644 --- a/config/deploy_config.yml +++ b/config/deploy_config.yml @@ -6,7 +6,7 @@ cross_server: deploy_to: '/usr/local/app/diaspora' user: 'root' repo: 'git://github.com/diaspora/diaspora.git' - branch: 'salmon_refactor' + branch: 'master' default_env: 'development' servers: tom: diff --git a/config/environment.rb b/config/environment.rb index 6b960209fb198744dd7b32970b6732ffd91a4095..ddfc9c247d7824ad8f070d87924c03cdf0d5e062 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -7,13 +7,17 @@ require File.expand_path('../application', __FILE__) Haml::Template.options[:format] = :html5 Haml::Template.options[:escape_html] = true -# Load facebook connection application credentials -fb_config = YAML::load(File.open(File.expand_path("./config/fb_config.yml"))) -FB_API_KEY = fb_config['fb_api_key'] -FB_SECRET = fb_config['fb_secret'] -FB_APP_ID = fb_config['fb_app_id'] -HOST = fb_config['host'] - +if File.exists?(File.expand_path("./config/fb_config.yml")) + # Load facebook connection application credentials + fb_config = YAML::load(File.open(File.expand_path("./config/fb_config.yml"))) + FB_API_KEY = fb_config['fb_api_key'] + FB_SECRET = fb_config['fb_secret'] + FB_APP_ID = fb_config['fb_app_id'] + HOST = fb_config['host'] + FACEBOOK = true +else + FACEBOOK = false +end # Initialize the rails application Diaspora::Application.initialize! diff --git a/config/fb_config.yml.example b/config/fb_config.yml.example new file mode 100644 index 0000000000000000000000000000000000000000..5bb1453166122f79fc718a368831c0d0bf5eab35 --- /dev/null +++ b/config/fb_config.yml.example @@ -0,0 +1,4 @@ +fb_api_key: {key} +fb_secret: {secret} +fb_app_id: {app_id} +host: http://localhost:3000/ diff --git a/config/locales/devise/devise.he.yml b/config/locales/devise/devise.he.yml index c33cfa67888cbe958fac58282f8d1c26d3a7fe7e..997ab6df00fdf41990d2d98b3480a45246eb562d 100644 --- a/config/locales/devise/devise.he.yml +++ b/config/locales/devise/devise.he.yml @@ -18,7 +18,7 @@ he: invalid: "הססמה ×ו הדו×״ל שגויי×." invalid_token: "×סימון ×”×ימות שגוי." timeout: "ההפעלה שלך פגה, × × ×œ×”×™×›× ×¡ שוב כדי להמשיך." - inactive: "×—×©×‘×•× ×š ×œ× ×”×•×¤×¢×œ עדין." + inactive: "×—×©×‘×•× ×š ×œ× ×”×•×¤×¢×œ עדיין." sessions: signed_in: "× ×›× ×¡×ª בהצלחה." signed_out: "יצ×ת בהצלחה." diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 8383396410d12aa2969239cb31eea482a96dd2c2..5595c4caa94c5db2e18b33fb5a03b1964a0cab83 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -113,6 +113,7 @@ en: albums: "Albums" you_dont_have_any_photos: "You don't have any photos! Go to the" page_to_upload_some: "page to upload some." + or: "or" comments: comment: ago: "ago" diff --git a/config/locales/diaspora/he.yml b/config/locales/diaspora/he.yml index 47f2a52c2946db5df32ded67e9c723642e5b8073..1105a3bcb0253785b765c402f5c173d46c04a667 100644 --- a/config/locales/diaspora/he.yml +++ b/config/locales/diaspora/he.yml @@ -86,7 +86,7 @@ he: add_a_new_aspect: "הוספת היבט חדש" create: "יצי××”" create: - success: "יש ללחוץ על סמל הפלוס שמימין כדי לומר לדי×ספורה מי יעול לצפות בהיבט החדש שלך." + success: "יש ללחוץ על סמל הפלוס שמימין כדי לומר לדי×ספורה מי יכול לצפות בהיבט החדש שלך." destroy: success: "%{name} הוסר בהצלחה." update: @@ -99,7 +99,7 @@ he: success: "כעת יופיע ×‘×¤× ×™ ×”×—×‘×¨×™× ×©×œ×š היבט ×חר שלך." helper: remove: "הסרה" - aspect_not_empty: "ההיסט ××™× ×• ריק" + aspect_not_empty: "ההיבט ××™× ×• ריק" users: edit: editing_profile: "עריכת הפרופיל" @@ -134,13 +134,13 @@ he: delete_photo: "מחיקת ×ª×ž×•× ×”" photo: show_comments: "הצגת הערות" - posted_a_new_photo_to: "פורסמה ×ª×ž×•× ×” חדשה ×ל" + posted_a_new_photo_to: "פורסמה ×ª×ž×•× ×” חדשה ב×לבו×" new: new_photo: "×ª×ž×•× ×” חדשה" back_to_list: "חזרה לרשימה" post_it: "פרסו×!" create: - runtime_error: "העל×ת ×”×ª×ž×•× ×” × ×›×©×œ×”. ×”×× ×”×—×’×•×¨×” שלך מהודקת?" + runtime_error: "העל×ת ×”×ª×ž×•× ×” × ×›×©×œ×”. הידקת ×ת החגורה?" integrity_error: "העל×ת ×”×ª×ž×•× ×” × ×›×©×œ×”. ×”×× ×–×• ב×מת הייתה ×ª×ž×•× ×”?" type_error: "העל×ת ×”×ª×ž×•× ×” × ×›×©×œ×”. ×”×× ×‘×מת × ×•×¡×¤×” ×ª×ž×•× ×”?" update: @@ -155,7 +155,7 @@ he: success: "הצטרפת לדי×ספורה!" status_messages: new_status_message: - tell_me_something_good: "×‘× ×œ×™ לשמוע סיפור טוב" + tell_me_something_good: "×‘× ×œ×™ לשמוע סיפור × ×—×ž×“" oh_yeah: "×חלה!" status_message: show_comments: "הצגת הערות" @@ -165,7 +165,7 @@ he: status_message: "הודעת מצב" comments: "הערות" are_you_sure: "בבטחה?" - destroy: "הריבה" + destroy: "הריסה" view_all: "צפייה בכול" message: "הודעה" owner: "בעלי×" diff --git a/config/locales/diaspora/it.yml b/config/locales/diaspora/it.yml index 24681fbe0b776d7384514798383c5ab44db92a2a..fe4b305ccd771126108f32e314aa15b4f1ff13d7 100644 --- a/config/locales/diaspora/it.yml +++ b/config/locales/diaspora/it.yml @@ -85,6 +85,7 @@ it: create: "Crea" create: 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: success: "%{name} è stato rimosso con successo." update: diff --git a/config/locales/diaspora/ru.yml b/config/locales/diaspora/ru.yml index daeb35915c01d1f10c4d2d2131b56bdc9790e7d0..f432c82d6bd37fa55477851145243ff3f36598ae 100644 --- a/config/locales/diaspora/ru.yml +++ b/config/locales/diaspora/ru.yml @@ -66,7 +66,10 @@ ru: add_a_new_aspect: "Добавить аÑпект" create: "Создать" create: - success:"Ðажмите на Ð¿Ð»ÑŽÑ Ñлева, Ð´Ð»Ñ Ñ‚Ð¾Ð³Ð¾, что-бы указать Diaspora тех, кто может видеть ваш новый аÑпект." + success:"Ðажмите на Ð¿Ð»ÑŽÑ Ñлева, Ð´Ð»Ñ Ñ‚Ð¾Ð³Ð¾, что-бы указать Diaspora тех, кто может видеть ваш новый аÑпект + helper: + remove: "Удалить" + aspect_not_empty: "ÐÑпект не пуÑÑ‚" users: edit: editing_profile: "Редактирование профилÑ" @@ -79,8 +82,9 @@ ru: picture: "Ðватар" editing_profile: "Редактирование профилÑ" albums: "Ðльбомы" - you_dont_have_any_photos: "У Ð²Ð°Ñ Ð½ÐµÑ‚ ни одной фотографии! Перейдите на " - page_to_upload_some: "Ñтраницу Ð´Ð»Ñ Ð·Ð°Ð³Ñ€ÑƒÐ·ÐºÐ¸." + you_dont_have_any_photos: "У Ð²Ð°Ñ Ð½ÐµÑ‚ ни одной фотографии! Перейдите в" + page_to_upload_some: "Ð´Ð»Ñ Ð·Ð°Ð³Ñ€ÑƒÐ·ÐºÐ¸." + or: "или" comments: comment: ago: "ранее" @@ -142,3 +146,18 @@ ru: save: "Ñохранить" are_you_sure: "Ð’Ñ‹ уверены?" 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: "Что-то пошло ÑовÑем не так." diff --git a/config/routes.rb b/config/routes.rb index 56ec559c94e7f5c5f7ad07d43d1f060c832486ff..16f6a9c98d786b919edaff623593ddcdd1842d13 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -43,6 +43,8 @@ Diaspora::Application.routes.draw do match 'webfinger', :to => 'publics#webfinger' match 'hcard/users/:id', :to => 'publics#hcard' + match 'hub', :to => 'publics#hub' + match '.well-known/host-meta',:to => 'publics#host_meta' match 'receive/users/:id', :to => 'publics#receive' match 'log', :to => "dev_utilities#log" diff --git a/lib/diaspora/ostatus_builder.rb b/lib/diaspora/ostatus_builder.rb index 997e538f3cae633cc248117643164f9c8a1f01ce..f75495ad2f99e28324d7b27701d4e411eb6c0c26 100644 --- a/lib/diaspora/ostatus_builder.rb +++ b/lib/diaspora/ostatus_builder.rb @@ -24,40 +24,41 @@ module Diaspora end def create_headers - <<-XML.strip - <?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/"> - <generator uri="http://joindiaspora.com/">Diaspora</generator> - <id>#{@user.username}/public</id> - <title>Stream</title> - <subtitle>its a stream</subtitle> - <updated>#{Time.now.xmlschema}</updated> - <author> - <name>#{@user.real_name}</name> - <uri>#{@user.public_url}</uri> - </author> + <<-XML +<?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/"> +<generator uri="http://joindiaspora.com/">Diaspora</generator> +<id>#{@user.public_url}.atom</id> +<title>#{@user.real_name}'s Public Feed</title> +<subtitle>its a stream</subtitle> +<updated>#{Time.now.xmlschema}</updated> +<author> + <name>#{@user.real_name}</name> + <uri>#{@user.public_url}</uri> +</author> XML end def create_endpoints <<-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 end def create_subject <<-XML - <activity:subject> - <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> - <id>#{@user.public_url}</id> - <title>#{@user.real_name}</title> - <link rel="alternative" type="text/html" href="#{@user.public_url}"/> - </activity:subject> +<activity:subject> + <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> + <id>#{@user.public_url}</id> + <title>#{@user.real_name}</title> + <link rel="alternative" type="text/html" href="#{@user.public_url}"/> +</activity:subject> XML end 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) unless xml curr.to_activity @@ -70,7 +71,7 @@ module Diaspora def create_footer <<-XML - </feed> +</feed> XML end end diff --git a/lib/hcard.rb b/lib/hcard.rb index 5640e711b383667330132712ce0f6d2e455ead30..e6baa49fd19eca2d8385a47f1325ced44eccdbb1 100644 --- a/lib/hcard.rb +++ b/lib/hcard.rb @@ -7,6 +7,7 @@ module HCard doc = Nokogiri::HTML(Net::HTTP.get URI.parse(url)) {:given_name => doc.css(".given_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 diff --git a/lib/message_handler.rb b/lib/message_handler.rb index e6ce75ffc923b973b61021f5a715b6af69544392..351ca99d620e0381b354d96ff0c42dceaca41598 100644 --- a/lib/message_handler.rb +++ b/lib/message_handler.rb @@ -20,6 +20,10 @@ class MessageHandler [*destinations].each{|dest| @queue.push(Message.new(:post, dest, :body => b))} end + def add_hub_notification(hub_url, feed_url) + @queue.push(Message.new(:hub_publish, hub_url, :body => feed_url)) + end + def process @queue.pop{ |query| case query.type @@ -29,6 +33,9 @@ class MessageHandler when :get http = EventMachine::HttpRequest.new(query.destination).get :timeout => TIMEOUT http.callback {process} + when :hub_publish + http = EventMachine::PubSubHubbub.new(query.destination).publish :timeout => TIMEOUT + http.callback {process; Rails.logger.debug(http.response)} else raise "message is not a type I know!" end diff --git a/public/javascripts/fancybox/jquery.easing-1.3.pack.js b/public/javascripts/fancybox/jquery.easing-1.3.pack.js old mode 100755 new mode 100644 diff --git a/public/javascripts/fancybox/jquery.fancybox-1.3.1.css b/public/javascripts/fancybox/jquery.fancybox-1.3.1.css old mode 100755 new mode 100644 diff --git a/public/javascripts/fancybox/jquery.fancybox-1.3.1.js b/public/javascripts/fancybox/jquery.fancybox-1.3.1.js old mode 100755 new mode 100644 diff --git a/public/javascripts/fancybox/jquery.fancybox-1.3.1.pack.js b/public/javascripts/fancybox/jquery.fancybox-1.3.1.pack.js old mode 100755 new mode 100644 diff --git a/public/javascripts/fancybox/jquery.mousewheel-3.0.2.pack.js b/public/javascripts/fancybox/jquery.mousewheel-3.0.2.pack.js old mode 100755 new mode 100644 diff --git a/public/javascripts/fileuploader.js b/public/javascripts/fileuploader.js old mode 100755 new mode 100644 diff --git a/public/javascripts/jquery.cycle/jquery.cycle.lite.min.js b/public/javascripts/jquery.cycle/jquery.cycle.lite.min.js old mode 100755 new mode 100644 diff --git a/public/javascripts/jquery.infieldlabel.js b/public/javascripts/jquery.infieldlabel.js old mode 100755 new mode 100644 diff --git a/public/javascripts/web_socket.js b/public/javascripts/web_socket.js old mode 100755 new mode 100644 diff --git a/public/stylesheets/blueprint/src/grid.css b/public/stylesheets/blueprint/src/grid.css old mode 100755 new mode 100644 diff --git a/public/stylesheets/blueprint/src/print.css b/public/stylesheets/blueprint/src/print.css old mode 100755 new mode 100644 diff --git a/public/stylesheets/blueprint/src/reset.css b/public/stylesheets/blueprint/src/reset.css old mode 100755 new mode 100644 diff --git a/public/stylesheets/brandongrotesque_light/Brandon_light-webfont.svg b/public/stylesheets/brandongrotesque_light/Brandon_light-webfont.svg old mode 100755 new mode 100644 diff --git a/public/stylesheets/brandongrotesque_light/demo.html b/public/stylesheets/brandongrotesque_light/demo.html old mode 100755 new mode 100644 diff --git a/public/stylesheets/brandongrotesque_light/stylesheet.css b/public/stylesheets/brandongrotesque_light/stylesheet.css old mode 100755 new mode 100644 diff --git a/public/stylesheets/fileuploader.css b/public/stylesheets/fileuploader.css old mode 100755 new mode 100644 diff --git a/script/server b/script/server index da43895fdc8a28a4eb8cbe538d882c91dd8b3da9..c5357a32e60a496bb7694ad591fe4b2e4fab7d93 100755 --- a/script/server +++ b/script/server @@ -7,9 +7,13 @@ then echo "Mongod not started" else mkdir -p -v log/thin/ - #force AGPL - tar cf ../_source.tar -X .gitignore * - mv ../_source.tar public/source.tar + #force AGPL + test -w public -a ! -e 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 thin start $@ fi diff --git a/spec/lib/message_handler_spec.rb b/spec/lib/message_handler_spec.rb index cb0592e9a38d32f6d4c44c76b93716c4f35fd6a5..ddc8223347e6d1880a44ee1fe03c14faf7905146 100644 --- a/spec/lib/message_handler_spec.rb +++ b/spec/lib/message_handler_spec.rb @@ -94,6 +94,26 @@ describe MessageHandler do 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 it 'should process both POST and GET requests in the same queue' do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 7d072bdd571c2a2d0ad38229527678837609318d..d21b1d57c28ce905b74e13f63efaf5103a853bfe 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -12,12 +12,16 @@ describe User do user = Factory.build(:user, :username => "ALLUPPERCASE") user.valid? user.username.should == "alluppercase" + + user = Factory.build(:user, :username => "someUPPERCASE") + user.valid? + user.username.should == "someuppercase" end end describe '#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