DG MS fixing webfinger, i hope to goodness
This commit is contained in:
parent
57bd052c5b
commit
84c60e5f2e
16 changed files with 34 additions and 33 deletions
|
|
@ -3,7 +3,7 @@
|
|||
The privacy aware, personally controlled, do-it-all, open source social network.
|
||||
|
||||
**DISCLAIMER: THIS IS PRE-ALPHA SOFTWARE AND SHOULD BE TREATED ACCORDINGLY.**
|
||||
These instructions are for machines running [Ubuntu](http://www.ubuntu.com/) or Mac OS X.
|
||||
These instructions are for machines running [Ubuntu](http://www.ubuntu.com/) or Mac OS X. We are developing Diaspora for the latest and greatest browsers, so please update your Firefox, Chrome or Safari to the latest and greatest.
|
||||
|
||||
## Preparing your system
|
||||
In order to run Diaspora, you will need to download the following dependencies (specific instructions follow):
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@ class Person
|
|||
include Encryptor::Public
|
||||
|
||||
xml_accessor :_id
|
||||
xml_accessor :email
|
||||
xml_accessor :diaspora_handle
|
||||
xml_accessor :url
|
||||
xml_accessor :profile, :as => Profile
|
||||
xml_reader :exported_key
|
||||
|
||||
key :url, String
|
||||
key :email, String, :unique => true
|
||||
key :diaspora_handle, String, :unique => true
|
||||
key :serialized_key, String
|
||||
|
||||
key :owner_id, ObjectId
|
||||
|
|
@ -30,13 +30,13 @@ class Person
|
|||
|
||||
before_destroy :remove_all_traces
|
||||
before_validation :clean_url
|
||||
validates_presence_of :email, :url, :profile, :serialized_key
|
||||
validates_presence_of :diaspora_handle, :url, :profile, :serialized_key
|
||||
validates_format_of :url, :with =>
|
||||
/^(https?):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(\.[a-z]{2,5})?(:[0-9]{1,5})?(\/.*)?$/ix
|
||||
|
||||
|
||||
def self.search(query)
|
||||
Person.all('$where' => "function() { return this.email.match(/^#{query}/i) ||
|
||||
Person.all('$where' => "function() { return this.diaspora_handle.match(/^#{query}/i) ||
|
||||
this.profile.first_name.match(/^#{query}/i) ||
|
||||
this.profile.last_name.match(/^#{query}/i); }")
|
||||
end
|
||||
|
|
@ -79,7 +79,8 @@ class Person
|
|||
end
|
||||
|
||||
def self.by_webfinger( identifier )
|
||||
local_person = Person.first(:email => identifier.gsub('acct:', ''))
|
||||
local_person = Person.first(:diaspora_handle => identifier.gsub('acct:', ''))
|
||||
|
||||
if local_person
|
||||
local_person
|
||||
elsif !identifier.include?("localhost")
|
||||
|
|
@ -102,7 +103,7 @@ class Person
|
|||
guid = profile.links.select{|x| x.rel == 'http://joindiaspora.com/guid'}.first.href
|
||||
new_person.id = guid
|
||||
|
||||
new_person.email = identifier
|
||||
new_person.diaspora_handle = identifier
|
||||
|
||||
hcard = HCard.find profile.hcard.first[:href]
|
||||
|
||||
|
|
@ -124,7 +125,7 @@ class Person
|
|||
:person => {
|
||||
:id => self.id,
|
||||
:name => self.real_name,
|
||||
:email => self.email,
|
||||
:diaspora_handle => self.diaspora_handle,
|
||||
:url => self.url,
|
||||
:exported_key => exported_key
|
||||
}
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ class User
|
|||
|
||||
def setup_person
|
||||
self.person.serialized_key ||= User.generate_key.export
|
||||
self.person.email ||= email
|
||||
self.person.diaspora_handle ||= self.diaspora_handle
|
||||
self.person.save!
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
%table
|
||||
%tr
|
||||
%th real name
|
||||
%th email
|
||||
%th diaspora handle
|
||||
%th url
|
||||
- for person in @people
|
||||
%tr
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
- else
|
||||
%td= person.real_name
|
||||
|
||||
%td= person.email
|
||||
%td= person.diaspora_handle
|
||||
%td= person.url
|
||||
|
||||
-if current_user.friends.include? person
|
||||
|
|
@ -46,5 +46,5 @@
|
|||
%td
|
||||
= form_for Request.new do |f|
|
||||
= f.select(:aspect_id, @aspects_dropdown_array)
|
||||
= f.hidden_field :destination_url, :value => person.email
|
||||
= f.hidden_field :destination_url, :value => person.diaspora_handle
|
||||
= f.submit "add friend"
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
= form_for @person do |f|
|
||||
= f.error_messages
|
||||
%p
|
||||
= f.label :email
|
||||
= f.label :diaspora_handle
|
||||
%br
|
||||
= f.text_field :email
|
||||
= f.text_field :diaspora_handle
|
||||
%p
|
||||
= f.label :url
|
||||
%br
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
|
||||
<Subject>acct:<%=@person.email%></Subject>
|
||||
<Subject>acct:<%=@person.diaspora_handle%></Subject>
|
||||
<Alias>"<%= @person.url %>"</Alias>
|
||||
<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%>"/>
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ module Salmon
|
|||
<entry xmlns='http://www.w3.org/2005/Atom'>
|
||||
<author>
|
||||
<name>#{@author.real_name}</name>
|
||||
<uri>acct:#{@author.email}</uri>
|
||||
<uri>acct:#{@author.diaspora_handle}</uri>
|
||||
</author>
|
||||
#{@magic_sig.to_xml}
|
||||
</entry>
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ describe PublicsController do
|
|||
end
|
||||
|
||||
it 'should add the pending request to the right user if the target person does not exist locally' do
|
||||
Person.should_receive(:by_webfinger).with(@user2.person.email).and_return(@user2.person)
|
||||
Person.should_receive(:by_webfinger).with(@user2.person.diaspora_handle).and_return(@user2.person)
|
||||
@user2.person.delete
|
||||
@user2.delete
|
||||
post :receive, :id => @user.person.id, :xml => @xml
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ Factory.define :profile do |p|
|
|||
end
|
||||
|
||||
Factory.define :person do |p|
|
||||
p.sequence(:email) {|n| "bob-person-#{n}@aol.com"}
|
||||
p.sequence(:diaspora_handle) {|n| "bob-person-#{n}@aol.com"}
|
||||
p.sequence(:url) {|n| "http://google-#{n}.com/"}
|
||||
p.profile Factory.create(:profile)
|
||||
|
||||
|
|
|
|||
2
spec/fixtures/msg.xml.clear.asc
vendored
2
spec/fixtures/msg.xml.clear.asc
vendored
|
|
@ -5,7 +5,7 @@ Hash: SHA1
|
|||
<message>jimmy's 1 whales</message>
|
||||
<_id>4c3b7cf9312f91367f000004</_id>
|
||||
<person>
|
||||
<email>bob1@aol.com</email>
|
||||
<diaspora_handle>bob1@aol.com</diaspora_handle>
|
||||
<url>http://www.example.com/</url>
|
||||
<_id>4c3b7c64312f913664000005</_id>
|
||||
<key_fingerprint>0264242496D4B585297BF236BEEFE6DEBE3407AA</key_fingerprint>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ describe Diaspora::Parser do
|
|||
before do
|
||||
@user = Factory.create(:user, :email => "bob@aol.com")
|
||||
@aspect = @user.aspect(:name => 'spies')
|
||||
@person = Factory.create(:person_with_private_key, :email => "bill@gates.com")
|
||||
@person = Factory.create(:person_with_private_key, :diaspora_handle => "bill@gates.com")
|
||||
@user2 = Factory.create(:user)
|
||||
end
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ describe Diaspora::Parser do
|
|||
end
|
||||
|
||||
it 'should be able to correctly handle comments with person in db' do
|
||||
person = Factory.create(:person, :email => "test@testing.com")
|
||||
person = Factory.create(:person, :diaspora_handle => "test@testing.com")
|
||||
post = Factory.create(:status_message, :person => @user.person)
|
||||
comment = Factory.build(:comment, :post => post, :person => person, :text => "Freedom!")
|
||||
xml = comment.to_diaspora_xml
|
||||
|
|
@ -49,7 +49,7 @@ describe Diaspora::Parser do
|
|||
|
||||
parsed_person = Diaspora::Parser::parse_or_find_person_from_xml(xml)
|
||||
parsed_person.save.should be true
|
||||
parsed_person.email.should == commenter.person.email
|
||||
parsed_person.diaspora_handle.should == commenter.person.diaspora_handle
|
||||
parsed_person.profile.should_not be_nil
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ describe Salmon do
|
|||
@parsed_salmon.data.should == xml
|
||||
end
|
||||
|
||||
it 'should parse out the author email' do
|
||||
@parsed_salmon.author_email.should == @user.person.email
|
||||
it 'should parse out the authors diaspora_handle' do
|
||||
@parsed_salmon.author_email.should == @user.person.diaspora_handle
|
||||
end
|
||||
|
||||
it 'should reference a local author' do
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ describe Person do
|
|||
@aspect2 = @user2.aspect(:name => "Abscence of Babes")
|
||||
end
|
||||
|
||||
it 'should not allow two people with the same email' do
|
||||
person_two = Factory.build(:person, :url => @person.email)
|
||||
it 'should not allow two people with the same diaspora_handle' do
|
||||
person_two = Factory.build(:person, :url => @person.diaspora_handle)
|
||||
person_two.valid?.should == false
|
||||
end
|
||||
|
||||
|
|
@ -147,10 +147,10 @@ describe Person do
|
|||
people.include?(@friend_three).should == false
|
||||
end
|
||||
|
||||
it 'should search by email exactly' do
|
||||
it 'should search by diaspora_handle exactly' do
|
||||
|
||||
stub_success("tom@tom.joindiaspora.com")
|
||||
Person.by_webfinger(@friend_one.email).should == @friend_one
|
||||
Person.by_webfinger(@friend_one.diaspora_handle).should == @friend_one
|
||||
end
|
||||
|
||||
it 'should create a stub for a remote user' do
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ describe Post do
|
|||
end
|
||||
|
||||
it 'should serialize to xml with its person' do
|
||||
@message.to_xml.to_s.include?(@user.person.email).should == true
|
||||
@message.to_xml.to_s.include?(@user.person.diaspora_handle).should == true
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -25,14 +25,14 @@ describe Request do
|
|||
|
||||
xml = request.to_xml.to_s
|
||||
|
||||
xml.include?(@user.person.email).should be true
|
||||
xml.include?(@user.person.diaspora_handle).should be true
|
||||
xml.include?(@user.url).should be true
|
||||
xml.include?(@user.profile.first_name).should be true
|
||||
xml.include?(@user.profile.last_name).should be true
|
||||
end
|
||||
|
||||
it 'should allow me to see only friend requests sent to me' do
|
||||
remote_person = Factory.build(:person, :email => "robert@grimm.com", :url => "http://king.com/")
|
||||
remote_person = Factory.build(:person, :diaspora_handle => "robert@grimm.com", :url => "http://king.com/")
|
||||
|
||||
Request.instantiate(:into => @aspect.id, :from => @user.person, :to => remote_person.receive_url).save
|
||||
Request.instantiate(:into => @aspect.id, :from => @user.person, :to => remote_person.receive_url).save
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@ describe 'user encryption' do
|
|||
@person = Factory.create(:person_with_private_key,
|
||||
:profile => Profile.new(:first_name => 'Remote',
|
||||
:last_name => 'Friend'),
|
||||
:email => 'somewhere@else.com',
|
||||
:diaspora_handle => 'somewhere@else.com',
|
||||
:url => 'http://distant-example.com/')
|
||||
@person2 = Factory.create(:person_with_private_key,
|
||||
:profile => Profile.new(:first_name => 'Second',
|
||||
:last_name => 'Friend'),
|
||||
:email => 'elsewhere@else.com',
|
||||
:diaspora_handle => 'elsewhere@else.com',
|
||||
:url => 'http://distanter-example.com/')
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue