-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f8d862c
commit 34ed547
Showing
6 changed files
with
41 additions
and
7 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
app/controllers/concerns/decidim/decidim_awesome/content_security_policy.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim | ||
module DecidimAwesome | ||
module ContentSecurityPolicy | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
after_action :append_awesome_csp_directives | ||
end | ||
|
||
private | ||
|
||
def append_awesome_csp_directives | ||
return unless DecidimAwesome.enabled?(:intergram_for_admins) || DecidimAwesome.enabled?(:intergram_for_public) | ||
|
||
intergram = URI.parse(DecidimAwesome.intergram_url) | ||
if intergram.host && intergram.scheme | ||
content_security_policy.append_csp_directive("script-src", "#{intergram.scheme}://#{intergram.host}") | ||
content_security_policy.append_csp_directive("frame-src", "#{intergram.scheme}://#{intergram.host}") | ||
# content_security_policy.append_csp_directive("frame-src", "http://www.loadmill.com") | ||
# content_security_policy.append_csp_directive("frame-src", "http://app.loadmill.com") | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
app/views/layouts/decidim/decidim_awesome/_intergram_widget.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters