1 class ExportController < ApplicationController
2 before_action :authorize_web
3 before_action :set_locale
4 before_action :update_totp, :only => [:finish]
5 authorize_resource :class => false
7 content_security_policy(:only => :embed) do |policy|
8 policy.frame_ancestors("*")
13 # When the user clicks 'Export' we redirect to a URL which generates the export download
15 bbox = BoundingBox.from_lon_lat_params(params)
16 style = params[:format]
17 format = params[:mapnik_format]
21 # redirect to API map get
22 redirect_to :controller => "api/map", :action => "index", :bbox => bbox
25 # redirect to a special 'export' cgi script
26 scale = params[:mapnik_scale]
28 redirect_to "https://render.openstreetmap.org/cgi-bin/export?bbox=#{bbox}&scale=#{scale}&format=#{format}", :allow_other_host => true
29 when "cyclemap", "transportmap"
33 width = params[:width]
34 height = params[:height]
36 redirect_to "https://tile.thunderforest.com/static/#{style[..-4]}/#{lon},#{lat},#{zoom}/#{width}x#{height}.#{format}?apikey=#{Settings.thunderforest_key}", :allow_other_host => true