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

This commit is contained in:
maxwell 2010-11-17 20:14:12 -08:00
commit 3db8da992a
22 changed files with 874 additions and 447 deletions

View file

@ -5,6 +5,8 @@ gem 'rails', '3.0.1'
gem 'bundler', '>= 1.0.0'
gem "chef", :require => false
gem "nokogiri", "1.4.3.1"
#Security
gem 'devise', '1.1.3'
gem 'devise-mongo_mapper', :git => 'git://github.com/collectiveidea/devise-mongo_mapper'

View file

@ -220,7 +220,7 @@ GEM
multi_json (0.0.5)
multipart-post (1.0.1)
net-ldap (0.1.1)
nokogiri (1.4.4)
nokogiri (1.4.3.1)
oa-basic (0.1.6)
multi_json (~> 0.0.2)
nokogiri (~> 1.4.2)
@ -299,7 +299,7 @@ GEM
rspec-core (2.1.0)
rspec-expectations (2.1.0)
diff-lcs (~> 1.1.2)
rspec-instafail (0.1.3)
rspec-instafail (0.1.4)
rspec-mocks (2.1.0)
rspec-rails (2.1.0)
rspec (~> 2.1.0)
@ -377,6 +377,7 @@ DEPENDENCIES
mocha
mongo_mapper!
mongrel
nokogiri (= 1.4.3.1)
omniauth
pubsubhubbub
rails (= 3.0.1)

View file

@ -0,0 +1,15 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class HomeController < ApplicationController
def show
if current_user
redirect_to aspects_path
else
render :show
end
end
end

View file

@ -104,14 +104,12 @@ class PeopleController < ApplicationController
def webfinger(account, opts = {})
finger = EMWebfinger.new(account)
finger.on_person do |response|
Rails.logger.info("event=controller_webfinger status=callback response=#{response.inspect}")
if response.class == Person
response.socket_to_uid(current_user.id, opts)
else
require File.join(Rails.root,'lib/diaspora/websocket')
Diaspora::WebSocket.queue_to_user(current_user.id, {:class => 'people', :status => 'fail', :query => account, :response => response}.to_json)
end
Rails.logger.info("event=controller_webfinger status=callback_complete response=#{response.inspect}")
end
end
end

View file

@ -1,3 +1,7 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
.span-10.append-1.last
.floating
%h3

View file

@ -0,0 +1,25 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
.span-22.prepend-1.last
#landing_content
#diaspora_description.section
%p
Share what you want, with who you want.
#signup_field.section
= render 'shared/mail_signup_form'
#login_field.section
already have an account?
= link_to "log in here", "#"
.span-24.last{:style=>"text-align:center;"}
%ul#press_logos
%li= link_to image_tag("press_logos/nyt.png"), "http://www.nytimes.com/2010/05/12/nyregion/12about.html", :title => "The New York Times"
%li= link_to image_tag("press_logos/nymag.gif"), "http://nymag.com/news/features/establishments/68512/", :title => "New York Magazine"
%li= link_to image_tag("press_logos/mashable.jpeg"), "http://mashable.com/2010/08/26/facebook-alternative-diaspora-launches-september-15/", :title => "Mashable"
%li= link_to image_tag("press_logos/techcrunch.gif"), "http://techcrunch.com/2010/09/15/diaspora-revealed/", :title => "TechCrunch"

View file

@ -59,11 +59,17 @@
#notification
#diaspora_text
= link_to "DIASPORA", (current_user ? root_path : new_user_session_path)
= link_to "DIASPORA*", (current_user ? root_path : new_user_session_path)
%span.sub_text
PREVIEW
ALPHA
- if current_user
- unless current_user
.right
%ul#landing_nav
%li= link_to "blog", "http://blog.joindiaspora.com"
%li= link_to "developers", "https://github.com/diaspora/diaspora"
%li= link_to "login", new_user_session_path
- else
#global_search
= form_tag(people_path, :method => 'get') do
= text_field_tag 'q', nil, :placeholder => t('search'), :type => 'search', :results => 5
@ -83,8 +89,17 @@
.span-24.last
= yield
.span-24.last
= render "posts/debug"
/.span-24.last
/= render "posts/debug"
.clearfix
%footer
.container
.brandon POWERED BY DIASPORA*
%ul#footer_nav
%li= link_to "blog", "http://blog.joindiaspora.com"
%li= link_to "developers", "https://github.com/diaspora/diaspora"
:javascript
var is_ssl = ("https:" == document.location.protocol);
var asset_host = is_ssl ? "https://s3.amazonaws.com/getsatisfaction.com/" : "http://s3.amazonaws.com/getsatisfaction.com/";
@ -98,3 +113,4 @@
feedback_widget_options.color = "#222";
feedback_widget_options.style = "idea";
var feedback_widget = new GSFN.feedback_widget(feedback_widget_options);

View file

@ -0,0 +1,133 @@
<!-- Begin MailChimp Signup Form -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript" src="http://downloads.mailchimp.com/js/jquery.validate.js"></script>
<script type="text/javascript" src="http://downloads.mailchimp.com/js/jquery.form.js"></script>
<script type="text/javascript">
// delete this script tag and use a "div.mce_inline_error{ XXX !important}" selector
// or fill this in and it will be inlined when errors are generated
var mc_custom_error_style = '';
</script>
<div id="mc_embed_signup">
<form action="http://joindiaspora.us1.list-manage.com/subscribe/post?u=d759919b94f9cdcf39d204f3f&amp;id=7b5ceb2f8b" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank">
<div class="mc-field-group">
<input type="text" value="" name="EMAIL" class="required email" placeholder="Email" id="mce-EMAIL">
</div>
<div><input type="submit" value="Sign up for an invite!" name="subscribe" id="mc-embedded-subscribe" class="btn"></div>
<div id="mce-responses">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div>
</form>
</div>
<script type="text/javascript">
var fnames = new Array();var ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[3]='MMERGE3';ftypes[3]='text';fnames[4]='MMERGE4';ftypes[4]='text';var err_style = '';
try{
err_style = mc_custom_error_style;
} catch(e){
err_style = 'margin: 1em 0 0 0; padding: 1em 0.5em 0.5em 0.5em; background: ERROR_BGCOLOR none repeat scroll 0% 0%; font-weight: bold; float: left; z-index: 1; width: 80%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: ERROR_COLOR;';
}
var mce_jQuery = jQuery.noConflict();
mce_jQuery(document).ready( function($) {
var options = { errorClass: 'mce_inline_error', errorElement: 'div', errorStyle: err_style, onkeyup: function(){}, onfocusout:function(){}, onblur:function(){} };
var mce_validator = mce_jQuery("#mc-embedded-subscribe-form").validate(options);
options = { url: 'http://joindiaspora.us1.list-manage2.com/subscribe/post-json?u=d759919b94f9cdcf39d204f3f&id=7b5ceb2f8b&c=?', type: 'GET', dataType: 'json', contentType: "application/json; charset=utf-8",
beforeSubmit: function(){
mce_jQuery('#mce_tmp_error_msg').remove();
mce_jQuery('.datefield','#mc_embed_signup').each(
function(){
var txt = 'filled';
var fields = new Array();
var i = 0;
mce_jQuery(':text', this).each(
function(){
fields[i] = this;
i++;
});
mce_jQuery(':hidden', this).each(
function(){
if ( fields[0].value=='MM' && fields[1].value=='DD' && fields[2].value=='YYYY' ){
this.value = '';
} else if ( fields[0].value=='' && fields[1].value=='' && fields[2].value=='' ){
this.value = '';
} else {
this.value = fields[0].value+'/'+fields[1].value+'/'+fields[2].value;
}
});
});
return mce_validator.form();
},
success: mce_success_cb
};
mce_jQuery('#mc-embedded-subscribe-form').ajaxForm(options);
});
function mce_success_cb(resp){
mce_jQuery('#mce-success-response').hide();
mce_jQuery('#mce-error-response').hide();
if (resp.result=="success"){
mce_jQuery('#mce-'+resp.result+'-response').show();
mce_jQuery('#mce-'+resp.result+'-response').html(resp.msg);
mce_jQuery('#mc-embedded-subscribe-form').each(function(){
this.reset();
});
} else {
var index = -1;
var msg;
try {
var parts = resp.msg.split(' - ',2);
if (parts[1]==undefined){
msg = resp.msg;
} else {
i = parseInt(parts[0]);
if (i.toString() == parts[0]){
index = parts[0];
msg = parts[1];
} else {
index = -1;
msg = resp.msg;
}
}
} catch(e){
index = -1;
msg = resp.msg;
}
try{
if (index== -1){
mce_jQuery('#mce-'+resp.result+'-response').show();
mce_jQuery('#mce-'+resp.result+'-response').html(msg);
} else {
err_id = 'mce_tmp_error_msg';
html = '<div id="'+err_id+'" style="'+err_style+'"> '+msg+'</div>';
var input_id = '#mc_embed_signup';
var f = mce_jQuery(input_id);
if (ftypes[index]=='address'){
input_id = '#mce-'+fnames[index]+'-addr1';
f = mce_jQuery(input_id).parent().parent().get(0);
} else if (ftypes[index]=='date'){
input_id = '#mce-'+fnames[index]+'-month';
f = mce_jQuery(input_id).parent().parent().get(0);
} else {
input_id = '#mce-'+fnames[index];
f = mce_jQuery().parent(input_id).get(0);
}
if (f){
mce_jQuery(f).append(html);
mce_jQuery(input_id).focus();
} else {
mce_jQuery('#mce-'+resp.result+'-response').show();
mce_jQuery('#mce-'+resp.result+'-response').html(msg);
}
}
} catch(e){
mce_jQuery('#mce-'+resp.result+'-response').show();
mce_jQuery('#mce-'+resp.result+'-response').html(msg);
}
}
}
</script>
<!--End mc_embed_signup-->

View file

@ -20,7 +20,8 @@
- if current_user.owns?(post)
.right
= link_to t('delete'), photo_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete"
= render 'shared/reshare', :post => post if post.is_a? StatusMessage
= link_to t('delete'), object_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete"
= render type_partial(post), :post => post

View file

@ -6,7 +6,7 @@ Diaspora::Application.routes.draw do
resources :status_messages, :only => [:create, :destroy, :show]
resources :comments, :except => [:index]
resources :requests, :except => [:edit, :update]
resources :photos, :except => [:index]
resources :photos, :except => [:index]
resources :services
resources :people
@ -26,6 +26,7 @@ Diaspora::Application.routes.draw do
match 'getting_started', :to => 'users#getting_started', :as => 'getting_started'
match 'users/export', :to => 'users#export'
match 'users/export_photos', :to => 'users#export_photos'
match 'login', :to => 'users#sign_up'
resources :users, :except => [:create, :new, :show]
match 'aspects/move_contact', :to => 'aspects#move_contact', :as => 'move_contact'
@ -40,9 +41,6 @@ Diaspora::Application.routes.draw do
match 'set_backer_number', :to => "dev_utilities#set_backer_number"
match 'set_profile_photo', :to => "dev_utilities#set_profile_photo"
#signup
match 'get_to_the_choppa', :to => redirect("/users/sign_up")
#public routes
match 'webfinger', :to => 'publics#webfinger'
match 'hcard/users/:id', :to => 'publics#hcard'
@ -51,6 +49,7 @@ Diaspora::Application.routes.draw do
match 'hub', :to => 'publics#hub'
match 'log', :to => "dev_utilities#log"
#root
root :to => 'aspects#index'
root :to => 'home#show'
end

View file

@ -6,11 +6,11 @@ Feature: user authentication
And I fill in "Username" with "ohai"
And I fill in "Password" with "secret"
And I press "Sign in"
Then I should be on the home page
Then I should be on the aspects page
@javascript
Scenario: user logs out
Given I am signed in
And I click on my name in the header
And I follow "logout"
Then I should be on the new user session page
Then I should be on the home page

View file

@ -31,11 +31,11 @@ Feature: new user registration
Then I should see "You're all set up, O!"
When I follow "Continue on to your everyone page, an overview of all of your aspects."
Then I should be on the home page
Then I should be on the aspects page
And I should see "bring them to Diaspora!"
Scenario: new user skips the setup wizard
When I follow "skip getting started"
And I wait for the home page to load
Then I should be on the home page
And I wait for the aspects page to load
Then I should be on the aspects page
And I should see "bring them to Diaspora!"

View file

@ -22,11 +22,11 @@ Then /^I should see "([^\"]*)" in the main content area$/ do |stuff|
end
end
When /^I wait for the home page to load$/ do
wait_until { current_path == root_path }
When /^I wait for the aspects page to load$/ do
wait_until { current_path == aspects_path }
end
When /^I wait for the ajax to finish$/ do
pending
# wait_until { ??? }
end
end

View file

@ -3,6 +3,8 @@ require File.join(Rails.root, 'lib/webfinger_profile')
class EMWebfinger
TIMEOUT = 5
REDIRECTS = 3
OPTS = {:timeout => TIMEOUT, :redirects => REDIRECTS}
def initialize(account)
@account = account.strip.gsub('acct:','').to_s
@callbacks = []
@ -15,15 +17,15 @@ class EMWebfinger
end
def fetch
if @callbacks.empty?
Rails.logger.info("event=EMWebfinger status=abort target=#{account} callbacks=empty")
Rails.logger.info("event=EMWebfinger status=abort target=#{@account} callbacks=empty")
raise 'you need to set a callback before calling fetch'
end
person = Person.by_account_identifier(@account)
if person
Rails.logger.info("event=EMWebfinger status=local target=#{account}")
Rails.logger.info("event=EMWebfinger status=local target=#{@account}")
process_callbacks person
else
Rails.logger.info("event=EMWebfinger status=remote target=#{account}")
Rails.logger.info("event=EMWebfinger status=remote target=#{@account}")
get_xrd
end
end
@ -36,7 +38,7 @@ class EMWebfinger
private
def get_xrd
http = EventMachine::HttpRequest.new(xrd_url).get :timeout => TIMEOUT
http = EventMachine::HttpRequest.new(xrd_url).get OPTS
http.callback {
profile_url = webfinger_profile_url(http.response)
if profile_url
@ -60,7 +62,7 @@ class EMWebfinger
def get_webfinger_profile(profile_url)
http = EventMachine::HttpRequest.new(profile_url).get :timeout => TIMEOUT
http = EventMachine::HttpRequest.new(profile_url).get OPTS
http.callback{ make_person_from_webfinger(http.response) }
http.errback{ process_callbacks "failed to fetch webfinger profile for #{profile_url}"}
end
@ -68,13 +70,21 @@ class EMWebfinger
def make_person_from_webfinger(webfinger_profile)
unless webfinger_profile.strip == ""
wf_profile = WebfingerProfile.new(@account, webfinger_profile)
begin
wf_profile = WebfingerProfile.new(@account, webfinger_profile)
rescue
return process_callbacks "No person could be constructed from this webfinger profile."
end
http = EventMachine::HttpRequest.new(wf_profile.hcard).get :timeout => TIMEOUT
http = EventMachine::HttpRequest.new(wf_profile.hcard).get OPTS
http.callback{
hcard = HCard.build http.response
p = Person.build_from_webfinger(wf_profile, hcard)
process_callbacks(p)
begin
hcard = HCard.build http.response
p = Person.build_from_webfinger(wf_profile, hcard)
process_callbacks(p)
rescue
process_callbacks "No person could be constructed from this hcard."
end
}
http.errback{process_callbacks "there was a problem fetching the hcard for #{@account}"}
end
@ -82,7 +92,7 @@ class EMWebfinger
def process_callbacks(person)
Rails.logger.info("event=EMWebfinger status=callbacks_started response=#{person.inspect}")
Rails.logger.info("event=EMWebfinger status=callbacks_started target=#{@account} response=#{person.inspect}")
@callbacks.each { |c|
begin
c.call(person)

BIN
public/images/ball.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -12,6 +12,7 @@
:style normal
body
:padding 2em
:margin 0
:background-color rgb(252,252,252)
@ -1613,3 +1614,196 @@ ul#request_result
&.remove
:color red
footer
:margin
:top 40px
:text
:align center
:width 100%
:left 0
:bottom 0
:color #999
.container
:padding 0
:top 2em
:border
:top 1px solid #ddd
ul#footer_nav
:margin 0
:padding 0
:list
:style none
> li
:display inline
:margin
:right 1em
a
:color #777
:font
:weight bold
&:hover
:color #ccc
.brandon
:font
:family 'BrandonGrotesqueLightRegular'
:text
:transform uppercase
ul#landing_nav
:margin 0
:padding 0
:list
:style none
:font
:size 14px
> li
:display inline
:margin
:right 0.5em
a
:color #107FC9
:text-shadow 0 1px 0 #000
#signup_field
:margin
:top -200px
:height 46px
:padding 0
:width 400px
:display inline
div
:display inline
#mce-responses
:margin
:top 12px
:font
:size 12px
:display block
:color #888
:text-shadow 0 1px 0 #fff
#mce-error-response
:color red
#mce-success-response
:color green
input[type='text']
:top -1px
:margin 0
:right -3px
:width 300px
:border-radius 5px 0 0 5px
:-webkit-border-radius 5px 0 0 5px
:-moz-border-radius 5px 0 0 5px
:position relative
:display inline
:padding 12px
:font
:size 18px
#big_action_button, input[type='submit']
:height 47px
:margin 0
:background
:color #107FC9
:-webkit-border-radius 0 5px 5px 0
:-moz-border-radius 0 5px 5px 0
:border-radius 0 5px 5px 0
:background -webkit-gradient( linear, left bottom, left top, color-stop(0, rgb(0,123,194)), color-stop(1, rgb(65,182,250)))
:background -moz-linear-gradient( center bottom, rgb(0,123,194) 0%, rgb(65,182,250) 100%)
:padding 12px
:font
:size 18px
:weight bold
:color #eee
:text-shadow 0 1px 0 #333
:text
:align center
&:hover
:background -webkit-gradient( linear, left bottom, left top, color-stop(0, rgb(0,136,209)), color-stop(1, rgb(113,204,255)))
:background -moz-linear-gradient( center bottom, rgb(0,136,209) 0%, rgb(113,204,255) 100%)
&:active
#diaspora_description
:background
:image url('../images/ball.png')
:repeat no-repeat
:position top center
:padding
:top 250px
:margin
:top -200px
:font
:size 3.3em
:weight bold
:text-shadow 0 1px 3px #999
p
:padding 12px
:background
:color #fff
:-webkit-box-shadow 0 1px 3px #ccc
:-moz-box-shadow 0 1px 3px #ccc
:box-shadow 0 1px 3px #ccc
#login_field
:text
:align left
:font
:style italic
:margin
:top 14px
:left 500px
:color #888
ul#press_logos
:margin 0
:top 100px
:padding 0
:list
:style none
> li
:display inline
:margin
:right 30px
img
:height 40px
&:last-child
:margin
:right 0
#landing_content
:margin
:top 100px
:text
:align center

View file

@ -0,0 +1,29 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
describe HomeController do
render_views
before do
@user = make_user
sign_in @user
sign_out @user
end
describe '#show' do
it 'should show a login link if no user is not logged in' do
get :show
response.body.should include("log in")
end
it 'should redirect to aspects index if user is logged in' do
sign_in @user
get :show
response.should redirect_to aspects_path
end
end
end

File diff suppressed because it is too large Load diff