Chubbies no longer saves diaspora_handle from the browser
This commit is contained in:
parent
7aeb3a3649
commit
67eaafe3a9
12 changed files with 47 additions and 30 deletions
|
|
@ -139,7 +139,7 @@ production:
|
||||||
# Do not touch unless you know what you're doing
|
# Do not touch unless you know what you're doing
|
||||||
test:
|
test:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
pod_url: "http://example.org"
|
pod_url: "http://localhost:9887"
|
||||||
socket_port: 8081
|
socket_port: 8081
|
||||||
enable_splunk_logging: false
|
enable_splunk_logging: false
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -283,7 +283,6 @@ ActiveRecord::Schema.define(:version => 20110603212633) do
|
||||||
t.string "provider_display_name"
|
t.string "provider_display_name"
|
||||||
t.string "actor_url"
|
t.string "actor_url"
|
||||||
t.integer "objectId"
|
t.integer "objectId"
|
||||||
t.integer "root_id"
|
|
||||||
t.string "status_message_guid"
|
t.string "status_message_guid"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@ Feature: oauth
|
||||||
Exchanging oauth credentials
|
Exchanging oauth credentials
|
||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given Chubbies is running
|
Given Chubbies has been killed
|
||||||
|
And Chubbies is running
|
||||||
When I visit "/" on Chubbies
|
When I visit "/" on Chubbies
|
||||||
And a user with username "bob" and password "secret"
|
And a user with username "bob" and password "secret"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,9 @@
|
||||||
Given /^Chubbies is running$/ do
|
Given /^Chubbies is running$/ do
|
||||||
if Chubbies.running?
|
Chubbies.run unless Chubbies.running?
|
||||||
puts "Chubbies is already running. Killing it."
|
end
|
||||||
Chubbies.kill
|
|
||||||
end
|
Given /^Chubbies has been killed$/ do
|
||||||
Chubbies.run
|
Chubbies.ensure_killed
|
||||||
at_exit do
|
|
||||||
Chubbies.kill
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Given /^Chubbies is registered on my pod$/ do
|
Given /^Chubbies is registered on my pod$/ do
|
||||||
|
|
@ -47,8 +44,13 @@ class Chubbies
|
||||||
|
|
||||||
def self.run
|
def self.run
|
||||||
@pid = fork do
|
@pid = fork do
|
||||||
Process.exec "cd #{Rails.root}/spec/support/chubbies/ && BUNDLE_GEMFILE=Gemfile DIASPORA_PORT=9887 bundle exec rackup -p #{PORT} 2> /dev/null"
|
Process.exec "cd #{Rails.root}/spec/chubbies/ && BUNDLE_GEMFILE=Gemfile DIASPORA_PORT=9887 bundle exec rackup -p #{PORT} 2> /dev/null"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
at_exit do
|
||||||
|
Chubbies.kill
|
||||||
|
end
|
||||||
|
|
||||||
while(!running?) do
|
while(!running?) do
|
||||||
sleep(1)
|
sleep(1)
|
||||||
end
|
end
|
||||||
|
|
@ -58,6 +60,13 @@ class Chubbies
|
||||||
`kill -9 #{get_pid}`
|
`kill -9 #{get_pid}`
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.ensure_killed
|
||||||
|
if !(@killed) && self.running?
|
||||||
|
self.kill
|
||||||
|
@killed = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.running?
|
def self.running?
|
||||||
begin
|
begin
|
||||||
RestClient.get("localhost:#{PORT}")
|
RestClient.get("localhost:#{PORT}")
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,4 @@ gem 'httparty'
|
||||||
gem 'json'
|
gem 'json'
|
||||||
gem 'shotgun'
|
gem 'shotgun'
|
||||||
gem 'sqlite3'
|
gem 'sqlite3'
|
||||||
gem 'activerecord'
|
gem 'activerecord', '3.0.3'
|
||||||
|
|
@ -1,23 +1,23 @@
|
||||||
GEM
|
GEM
|
||||||
remote: http://rubygems.org/
|
remote: http://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
activemodel (3.0.7)
|
activemodel (3.0.3)
|
||||||
activesupport (= 3.0.7)
|
activesupport (= 3.0.3)
|
||||||
builder (~> 2.1.2)
|
builder (~> 2.1.2)
|
||||||
i18n (~> 0.5.0)
|
i18n (~> 0.4)
|
||||||
activerecord (3.0.7)
|
activerecord (3.0.3)
|
||||||
activemodel (= 3.0.7)
|
activemodel (= 3.0.3)
|
||||||
activesupport (= 3.0.7)
|
activesupport (= 3.0.3)
|
||||||
arel (~> 2.0.2)
|
arel (~> 2.0.2)
|
||||||
tzinfo (~> 0.3.23)
|
tzinfo (~> 0.3.23)
|
||||||
activesupport (3.0.7)
|
activesupport (3.0.3)
|
||||||
arel (2.0.10)
|
arel (2.0.10)
|
||||||
builder (2.1.2)
|
builder (2.1.2)
|
||||||
crack (0.1.8)
|
crack (0.1.8)
|
||||||
haml (3.0.18)
|
haml (3.0.18)
|
||||||
httparty (0.7.4)
|
httparty (0.7.4)
|
||||||
crack (= 0.1.8)
|
crack (= 0.1.8)
|
||||||
i18n (0.5.0)
|
i18n (0.6.0)
|
||||||
json (1.4.6)
|
json (1.4.6)
|
||||||
rack (1.2.2)
|
rack (1.2.2)
|
||||||
shotgun (0.9)
|
shotgun (0.9)
|
||||||
|
|
@ -33,7 +33,7 @@ PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
activerecord
|
activerecord (= 3.0.3)
|
||||||
haml
|
haml
|
||||||
httparty
|
httparty
|
||||||
json
|
json
|
||||||
|
|
@ -5,9 +5,10 @@ require 'haml'
|
||||||
require 'httparty'
|
require 'httparty'
|
||||||
require 'json'
|
require 'json'
|
||||||
require 'active_record'
|
require 'active_record'
|
||||||
|
require 'pp'
|
||||||
|
|
||||||
# models ======================================
|
# models ======================================
|
||||||
`rm -f chubbies.sqlite3`
|
`rm -f #{File.expand_path('../chubbies.sqlite3', __FILE__)}`
|
||||||
ActiveRecord::Base.establish_connection(
|
ActiveRecord::Base.establish_connection(
|
||||||
:adapter => "sqlite3",
|
:adapter => "sqlite3",
|
||||||
:database => "chubbies.sqlite3"
|
:database => "chubbies.sqlite3"
|
||||||
|
|
@ -76,8 +77,8 @@ get '/callback' do
|
||||||
:grant_type => 'authorization_code'}
|
:grant_type => 'authorization_code'}
|
||||||
)
|
)
|
||||||
|
|
||||||
user = pod.users.create!(:access_token => response["access_token"], :diaspora_handle => params['diaspora_handle'])
|
user = pod.users.create!(:access_token => response["access_token"] )
|
||||||
redirect "/account?diaspora_handle=#{user.diaspora_handle}"
|
redirect "/account?id=#{user.id}"
|
||||||
else
|
else
|
||||||
"What is your major malfunction?"
|
"What is your major malfunction?"
|
||||||
end
|
end
|
||||||
|
|
@ -85,12 +86,14 @@ end
|
||||||
|
|
||||||
get '/account' do
|
get '/account' do
|
||||||
# have diaspora handle
|
# have diaspora handle
|
||||||
host = domain_from_handle
|
if params[:diaspora_handle]
|
||||||
unless pod = Pod.where(:host => host).first
|
host = domain_from_handle
|
||||||
pod = register_with_pod
|
unless pod = Pod.where(:host => host).first
|
||||||
|
pod = register_with_pod
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if user = pod.users.where(:diaspora_handle => params['diaspora_handle']).first
|
if params['id'] && user = User.where(:id => params['id']).first
|
||||||
@resource_response = get_with_access_token(user, "/api/v0/me")
|
@resource_response = get_with_access_token(user, "/api/v0/me")
|
||||||
haml :response
|
haml :response
|
||||||
else
|
else
|
||||||
|
|
@ -107,6 +110,11 @@ get '/manifest' do
|
||||||
}.to_json
|
}.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get '/reset' do
|
||||||
|
User.delete_all
|
||||||
|
Pod.delete_all
|
||||||
|
"reset."
|
||||||
|
end
|
||||||
#=============================
|
#=============================
|
||||||
#helpers
|
#helpers
|
||||||
#
|
#
|
||||||
|
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 147 KiB |
Loading…
Reference in a new issue