]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/site_controller.rb
Add support for Content-Security-Policy
[rails.git] / app / controllers / site_controller.rb
index aa284ecdc100ba37135d7a8e5b9f38db35650218..353feecefe32ae21062597d2ee7d9cfb2c137b0c 100644 (file)
@@ -69,6 +69,13 @@ class SiteController < ApplicationController
       require_user
     end
 
+    if editor == "potlatch" || editor == "potlatch2"
+      append_content_security_policy_directives(
+        :object_src => %w(*),
+        :plugin_types => %w(application/x-shockwave-flash)
+      )
+    end
+
     if params[:node]
       bbox = Node.find(params[:node]).bbox.to_unscaled
       @lat = bbox.centre_lat
@@ -111,6 +118,12 @@ class SiteController < ApplicationController
   end
 
   def id
+    append_content_security_policy_directives(
+      :connect_src => %w(taginfo.openstreetmap.org *.mapillary.com),
+      :img_src => %w(*),
+      :script_src => %w(dev.virtualearth.net)
+    )
+
     render "id", :layout => false
   end