Skip to content

Commit

Permalink
hm?
Browse files Browse the repository at this point in the history
  • Loading branch information
Ember-ruby committed Jan 22, 2024
1 parent 7f63ff2 commit 4f6cefa
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions config/initializers/content_security_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@
assets_host = policy.assets_host
media_hosts = policy.media_hosts

base_host = Rails.configuration.x.web_domain

assets_host = Rails.configuration.action_controller.asset_host
assets_host ||= host_to_url(base_host)

media_host = host_to_url(ENV['S3_ALIAS_HOST'])
media_host ||= host_to_url(ENV['S3_CLOUDFRONT_HOST'])
media_host ||= host_to_url(ENV['AZURE_ALIAS_HOST'])
media_host ||= host_to_url(ENV['S3_HOSTNAME']) if ENV['S3_ENABLED'] == 'true'
media_host ||= assets_host

def sso_host
return unless ENV['ONE_CLICK_SSO_LOGIN'] == 'true'
return unless ENV['OMNIAUTH_ONLY'] == 'true'
Expand Down Expand Up @@ -63,9 +52,9 @@ def sso_host

if Rails.env.development?
webpacker_public_host = ENV.fetch('WEBPACKER_DEV_SERVER_PUBLIC', Webpacker.config.dev_server[:public])
webpacker_urls = %w(ws http).map { |protocol| "#{protocol}#{Webpacker.dev_server.https? ? 's' : ''}://#{webpacker_public_host}" }
front_end_build_urls = %w(ws http).map { |protocol| "#{protocol}#{Webpacker.dev_server.https? ? 's' : ''}://#{webpacker_public_host}" }

p.connect_src :self, :data, :blob, *media_hosts, Rails.configuration.x.streaming_api_base_url, *webpacker_urls
p.connect_src :self, :data, :blob, *media_hosts, Rails.configuration.x.streaming_api_base_url, *front_end_build_urls
p.script_src :self, :unsafe_inline, :unsafe_eval, assets_host
else
p.connect_src :self, :data, :blob, *media_hosts, Rails.configuration.x.streaming_api_base_url
Expand Down

0 comments on commit 4f6cefa

Please sign in to comment.