diff --git a/app/models/app_config.rb b/app/models/app_config.rb index e3aea84cb86da5e37bce863e9f7f96138be6542a..33803600248e7344500a5706b6b63ae0a0ed67c6 100644 --- a/app/models/app_config.rb +++ b/app/models/app_config.rb @@ -125,7 +125,7 @@ HELP def self.pod_uri if @@pod_uri.nil? begin - @@pod_uri = URI.parse(self.pod_url) + @@pod_uri = Addressable::URI.parse(self.pod_url) rescue puts "WARNING: pod url " + self.pod_url + " is not a legal URI" end diff --git a/app/models/user.rb b/app/models/user.rb index b93c093ace69c00fa6b2d916f3739d7cd469485f..a37445555cb9b3b453fdd66a8ddc0523476ca2fe 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -340,7 +340,7 @@ class User < ActiveRecord::Base end self.person = Person.new(opts[:person]) - self.person.diaspora_handle = "#{opts[:username]}@#{AppConfig[:pod_uri].host}" + self.person.diaspora_handle = "#{opts[:username]}@#{AppConfig[:pod_uri].authority}" self.person.url = AppConfig[:pod_url] diff --git a/app/views/publics/host_meta.erb b/app/views/publics/host_meta.erb index faaa0e0a222a388574b03656118045a65b4d6dff..5bb6786c56c608293ab5f8d3acd1c3c4a068fbaf 100644 --- a/app/views/publics/host_meta.erb +++ b/app/views/publics/host_meta.erb @@ -1,7 +1,7 @@ <?xml version='1.0' encoding='UTF-8'?> <XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0' xmlns:hm='http://host-meta.net/xrd/1.0'> - <hm:Host><%= AppConfig[:pod_uri].host %></hm:Host> + <hm:Host><%= AppConfig[:pod_uri].authority %></hm:Host> <Link rel='lrdd' template='<%= AppConfig[:pod_url].chomp("/") %>/webfinger?q={uri}'> <Title>Resource Descriptor</Title> diff --git a/app/views/publics/host_meta.html.erb b/app/views/publics/host_meta.html.erb index 8b0ad3aa839df04e4cf0a163995eb08c781f9a1e..fa8cd9879768b50a59eabce78811661b7887431e 100644 --- a/app/views/publics/host_meta.html.erb +++ b/app/views/publics/host_meta.html.erb @@ -1,7 +1,7 @@ <?xml version='1.0' encoding='UTF-8'?> <XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0' xmlns:hm='http://host-meta.net/xrd/1.0'> - <hm:Host><%= AppConfig[:pod_uri].host %></hm:Host> + <hm:Host><%= AppConfig[:pod_uri].authority %></hm:Host> <Link rel='lrdd' template='<%= AppConfig[:pod_url] %>webfinger?q={uri}'> <Title>Resource Descriptor</Title> diff --git a/config/initializers/mailer_config.rb b/config/initializers/mailer_config.rb index 0f154d3e95136aec7fe58d0f33e0677e34eea1d2..a42f539c31726a4404a60ce119b1df8a12830ae2 100644 --- a/config/initializers/mailer_config.rb +++ b/config/initializers/mailer_config.rb @@ -3,7 +3,7 @@ # the COPYRIGHT file. Diaspora::Application.configure do - config.action_mailer.default_url_options = {:host => AppConfig[:pod_uri].host} + config.action_mailer.default_url_options = {:host => AppConfig[:pod_uri].authority } unless Rails.env == 'test' || AppConfig[:mailer_on] != true if AppConfig[:mailer_method] == "sendmail" config.action_mailer.delivery_method = :sendmail diff --git a/spec/support/server.rb b/spec/support/server.rb index eb31db5e6a56efef2696305ee9b4cabc5033a764..27df791f7ea290446044412d3b0b614bc9ec872d 100644 --- a/spec/support/server.rb +++ b/spec/support/server.rb @@ -9,7 +9,7 @@ class Server attr_reader :port, :env def initialize(env) @db_config = ActiveRecord::Base.configurations[env] - @app_config = (YAML.load_file AppConfig.source)[env] + @app_config = (YAML.load_file AppConfig.source)[env] @port = URI::parse(@app_config["pod_url"]).port @env = env ensure_database_setup @@ -18,7 +18,7 @@ class Server def ensure_database_setup `cd #{Rails.root} && RAILS_ENV=#{@env} bundle exec rake db:create` tables_exist = self.db do - ActiveRecord::Base.connection.tables.include?("users") + ActiveRecord::Base.connection.tables.include?("users") end if tables_exist truncate_database @@ -49,7 +49,7 @@ class Server processes.first.split(" ").first }.call end - + def running? begin RestClient.get("localhost:#{@port}/users/sign_in") @@ -79,7 +79,7 @@ class Server def in_scope pod_url = "http://localhost:#{@port}/" AppConfig.stub!(:pod_url).and_return(pod_url) - AppConfig.stub!(:pod_uri).and_return(URI.parse(pod_url)) + AppConfig.stub!(:pod_uri).and_return(Addressable::URI.parse(pod_url)) begin result = db do yield