changing some webfinger resources
This commit is contained in:
parent
95c4de5d6c
commit
71612ba33d
9 changed files with 39 additions and 25 deletions
|
|
@ -3,8 +3,11 @@ class PublicsController < ApplicationController
|
||||||
include Diaspora::Parser
|
include Diaspora::Parser
|
||||||
|
|
||||||
def hcard
|
def hcard
|
||||||
@user = User.owner
|
@person = Person.first(:_id => params[:id])
|
||||||
render 'hcard'
|
|
||||||
|
unless @person.nil? || @person.owner.nil?
|
||||||
|
render 'hcard'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def host_meta
|
def host_meta
|
||||||
|
|
@ -13,8 +16,10 @@ class PublicsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def webfinger
|
def webfinger
|
||||||
@user = Person.first(:email => params[:q].gsub('acct:', ''))
|
@person = Person.first(:email => params[:q].gsub('acct:', ''))
|
||||||
render 'webfinger', :layout => false, :content_type => 'application/xrd+xml'
|
unless @person.nil? || @person.owner.nil?
|
||||||
|
render 'webfinger', :layout => false, :content_type => 'application/xrd+xml'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def receive
|
def receive
|
||||||
|
|
|
||||||
|
|
@ -14,4 +14,11 @@ module PublicsHelper
|
||||||
400
|
400
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
def terse_url(full_url)
|
||||||
|
terse = full_url.gsub(/https?:\/\//, '')
|
||||||
|
terse.gsub!(/www\./, '')
|
||||||
|
terse = terse.chop! if terse[-1, 1] == '/'
|
||||||
|
terse
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,9 @@ class Person
|
||||||
self.id == post.person.id
|
self.id == post.person.id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def recieve_url
|
||||||
|
"#{self.url}user/#{self.owner.id}"
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
def clean_url
|
def clean_url
|
||||||
|
|
|
||||||
|
|
@ -77,14 +77,11 @@ class User
|
||||||
def receive_friend_request(friend_request)
|
def receive_friend_request(friend_request)
|
||||||
Rails.logger.debug("receiving friend request #{friend_request.to_json}")
|
Rails.logger.debug("receiving friend request #{friend_request.to_json}")
|
||||||
|
|
||||||
#u am originator
|
|
||||||
if Request.where(:callback_url => person.url, :destination_url => person.url).first
|
if Request.where(:callback_url => person.url, :destination_url => person.url).first
|
||||||
puts "NOOO!!"
|
|
||||||
activate_friend friend_request.person
|
activate_friend friend_request.person
|
||||||
Rails.logger.debug("#{self.real_name}'s friend request has been accepted")
|
Rails.logger.debug("#{self.real_name}'s friend request has been accepted")
|
||||||
friend_request.destroy
|
friend_request.destroy
|
||||||
else
|
else
|
||||||
puts "423423"
|
|
||||||
friend_request.person.save
|
friend_request.person.save
|
||||||
pending_requests << friend_request
|
pending_requests << friend_request
|
||||||
save
|
save
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,24 @@
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<h1><%=@user.real_name%></h1>
|
<h1><%=@person.real_name%></h1>
|
||||||
<div id="content_inner">
|
<div id="content_inner">
|
||||||
<div id="i" class="entity_profile vcard author">
|
<div id="i" class="entity_profile vcard author">
|
||||||
<h2>User profile</h2>
|
<h2>User profile</h2>
|
||||||
<dl class="entity_nickname">
|
<dl class="entity_nickname">
|
||||||
<dt>Nickname</dt>
|
<dt>Nickname</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<a href="<%=@user.url%>" rel="me" class="nickname url uid"><%= @user.real_name%></a>
|
<a href="<%=@person.url%>" rel="me" class="nickname url uid"><%= @person.real_name%></a>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl class="entity_fn">
|
<dl class="entity_fn">
|
||||||
<dt>Full name</dt>
|
<dt>Full name</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<span class="fn"><%= @user.real_name %></span>
|
<span class="fn"><%= @person.real_name %></span>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl class="entity_url">
|
<dl class="entity_url">
|
||||||
<dt>URL</dt>
|
<dt>URL</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<a href="<%= @user.url%>" rel="me" class="url"><%= @user.url%></a>
|
<a href="<%= @person.url%>" rel="me" class="url"><%= @person.url%></a>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl class="entity_note">
|
<dl class="entity_note">
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'
|
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'
|
||||||
xmlns:hm='http://host-meta.net/xrd/1.0'>
|
xmlns:hm='http://host-meta.net/xrd/1.0'>
|
||||||
<hm:Host><%= @user.terse_url %></hm:Host>
|
<hm:Host><%= terse_url(root_url) %></hm:Host>
|
||||||
<Link rel='lrdd'
|
<Link rel='lrdd'
|
||||||
template='<%=@user.url%>webfinger?q={uri}'>
|
template='<%= root_url %>webfinger?q={uri}'>
|
||||||
<Title>Resource Descriptor</Title>
|
<Title>Resource Descriptor</Title>
|
||||||
</Link>
|
</Link>
|
||||||
</XRD>
|
</XRD>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
|
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
|
||||||
<Subject>acct:<%=@user.email%></Subject>
|
<Subject>acct:<%=@person.email%></Subject>
|
||||||
<Alias>"<%=@user.url%>hcard"</Alias>
|
<Alias>"<%= @person.url %>users/#{@user.id}/hcard"</Alias>
|
||||||
<Link rel="http://microformats.org/profile/hcard" type="text/html" href="<%=@user.url%>hcard"/>
|
<Link rel="http://microformats.org/profile/hcard" type="text/html" href="<%=@person.url%>hcard"/>
|
||||||
<Link rel="http://schemas.google.com/g/2010#updates-from" type="application/atom+xml" href="<%=@user.url%>status_messages.atom"/>
|
<Link rel="http://schemas.google.com/g/2010#updates-from" type="application/atom+xml" href="<%=@person.url%>status_messages.atom"/>
|
||||||
<Link rel="http://joindiaspora.com/seed_location" type = 'text/html' href="<%=@user.url%>"/>
|
<Link rel="http://joindiaspora.com/seed_location" type = 'text/html' href="<%=@person.receive_url%>"/>
|
||||||
</XRD>
|
</XRD>
|
||||||
|
|
|
||||||
|
|
@ -24,13 +24,13 @@ Diaspora::Application.routes.draw do |map|
|
||||||
#match 'signup', :to => 'devise/registrations#new', :as => "new_user_registration"
|
#match 'signup', :to => 'devise/registrations#new', :as => "new_user_registration"
|
||||||
resources :users
|
resources :users
|
||||||
|
|
||||||
|
|
||||||
#public routes
|
#public routes
|
||||||
match 'receive/users/:id', :to => 'publics#receive'
|
#
|
||||||
match '.well-known/host-meta',:to => 'publics#host_meta'
|
match 'webfinger', :to => 'publics#webfinger'
|
||||||
match 'webfinger', :to => 'publics#webfinger'
|
match 'users/:id/hcard', :to => 'publics#hcard'
|
||||||
match 'hcard', :to => 'publics#hcard'
|
|
||||||
|
match '.well-known/host-meta',:to => 'publics#host_meta'
|
||||||
|
match 'receive/users/:id', :to => 'publics#receive'
|
||||||
#root
|
#root
|
||||||
root :to => 'dashboards#index'
|
root :to => 'dashboards#index'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ describe Person do
|
||||||
before do
|
before do
|
||||||
@person = Factory.create(:person)
|
@person = Factory.create(:person)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
it 'should not allow two people with the same email' do
|
it 'should not allow two people with the same email' do
|
||||||
person_two = Factory.build(:person, :url => @person.email)
|
person_two = Factory.build(:person, :url => @person.email)
|
||||||
person_two.valid?.should == false
|
person_two.valid?.should == false
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue