From 67fbd02ae045ffd12f338eb7b0ff4aeec20adc6f Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Thu, 10 Mar 2016 00:31:06 +0100 Subject: [PATCH 1/2] use AppConfig.url_to for generated urls for oembed _url doesn't with generate https if the pod uses https --- app/helpers/posts_helper.rb | 4 ++-- app/presenters/o_embed_presenter.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb index 6a4758a73..59c12ded6 100644 --- a/app/helpers/posts_helper.rb +++ b/app/helpers/posts_helper.rb @@ -20,7 +20,7 @@ module PostsHelper def post_iframe_url(post_id, opts={}) opts[:width] ||= 516 opts[:height] ||= 315 - host = AppConfig.pod_uri.authority - "".html_safe + "".html_safe end end diff --git a/app/presenters/o_embed_presenter.rb b/app/presenters/o_embed_presenter.rb index b3788ca50..4fe98761d 100644 --- a/app/presenters/o_embed_presenter.rb +++ b/app/presenters/o_embed_presenter.rb @@ -38,7 +38,7 @@ class OEmbedPresenter end def post_author_url - Rails.application.routes.url_helpers.person_url(@post.author, :host => AppConfig.pod_uri.host) + AppConfig.url_to(Rails.application.routes.url_helpers.person_path(@post.author)) end def iframe_html From 6ea8cd546e08fbcdfe46576b9e210ac1533eb36f Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Thu, 10 Mar 2016 00:34:41 +0100 Subject: [PATCH 2/2] don't change AppConfig.environment.url in jsxc_helper_spec closes #6748 --- Changelog.md | 1 + spec/helpers/jsxc_helper_spec.rb | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Changelog.md b/Changelog.md index 64cb1f2ce..e8448ec6b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,6 +7,7 @@ * Fix empty name field when editing aspect names [#6706](https://github.com/diaspora/diaspora/pull/6706) * Fix internal server error when trying to log out of an expired session [#6707](https://github.com/diaspora/diaspora/pull/6707) * Only mark unread notifications as read [#6711](https://github.com/diaspora/diaspora/pull/6711) +* Use https for OEmbeds [#6748](https://github.com/diaspora/diaspora/pull/6748) ## Features * Added the footer to conversation pages [#6710](https://github.com/diaspora/diaspora/pull/6710) diff --git a/spec/helpers/jsxc_helper_spec.rb b/spec/helpers/jsxc_helper_spec.rb index d38a72bc4..abbf5e0b3 100644 --- a/spec/helpers/jsxc_helper_spec.rb +++ b/spec/helpers/jsxc_helper_spec.rb @@ -2,20 +2,19 @@ require 'spec_helper' describe JsxcHelper, :type => :helper do before do - AppConfig.chat.server.bosh.proxy = false AppConfig.chat.server.bosh.port = 1234 - AppConfig.chat.server.bosh.bind = '/bind' - AppConfig.environment.url = "https://localhost/" - AppConfig.instance_variable_set(:@pod_uri, nil) + AppConfig.chat.server.bosh.bind = "/bind" end describe "#get_bosh_endpoint" do it "using http scheme and default values" do + AppConfig.chat.server.bosh.proxy = false expect(helper.get_bosh_endpoint).to include %Q(http://localhost:1234/bind) end it "using https scheme and no port" do AppConfig.chat.server.bosh.proxy = true + allow(AppConfig).to receive(:pod_uri).and_return(Addressable::URI.parse("https://localhost/")) expect(helper.get_bosh_endpoint).to include %Q(https://localhost/bind) end end