X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/11cc4a5e601dd288d601e6e35a72d159062f18b5..8ebfdbc1ffacee695ca773f3b3c8af02bb41b8c1:/app/controllers/site_controller.rb diff --git a/app/controllers/site_controller.rb b/app/controllers/site_controller.rb index 57ac07501..52fea6133 100644 --- a/app/controllers/site_controller.rb +++ b/app/controllers/site_controller.rb @@ -75,28 +75,36 @@ class SiteController < ApplicationController :plugin_types => %w[application/x-shockwave-flash], :script_src => %w['unsafe-inline'] ) + elsif %w[id].include?(editor) + append_content_security_policy_directives( + :frame_src => %w[blob:] + ) end - if params[:node] - bbox = Node.find(params[:node]).bbox.to_unscaled - @lat = bbox.centre_lat - @lon = bbox.centre_lon - @zoom = 18 - elsif params[:way] - bbox = Way.find(params[:way]).bbox.to_unscaled - @lat = bbox.centre_lat - @lon = bbox.centre_lon - @zoom = 17 - elsif params[:note] - note = Note.find(params[:note]) - @lat = note.lat - @lon = note.lon - @zoom = 17 - elsif params[:gpx] && current_user - trace = Trace.visible_to(current_user).find(params[:gpx]) - @lat = trace.latitude - @lon = trace.longitude - @zoom = 16 + begin + if params[:node] + bbox = Node.visible.find(params[:node]).bbox.to_unscaled + @lat = bbox.centre_lat + @lon = bbox.centre_lon + @zoom = 18 + elsif params[:way] + bbox = Way.visible.find(params[:way]).bbox.to_unscaled + @lat = bbox.centre_lat + @lon = bbox.centre_lon + @zoom = 17 + elsif params[:note] + note = Note.visible.find(params[:note]) + @lat = note.lat + @lon = note.lon + @zoom = 17 + elsif params[:gpx] && current_user + trace = Trace.visible_to(current_user).find(params[:gpx]) + @lat = trace.latitude + @lon = trace.longitude + @zoom = 16 + end + rescue ActiveRecord::RecordNotFound + # don't try and derive a location from a missing/deleted object end end @@ -108,7 +116,9 @@ class SiteController < ApplicationController def help; end - def about; end + def about + @locale = params[:about_locale] || I18n.locale + end def export; end