Move all settings to settings.yml
We leave the STATUS setting alone, since it's required before rails boots. The test-specific settings now live in config/settings/test.yml
This commit is contained in:
parent
7b08270526
commit
d102c9aaf4
62 changed files with 316 additions and 349 deletions
|
@ -20,8 +20,8 @@ window.onload = function () {
|
|||
}
|
||||
|
||||
var thunderforestOptions = {
|
||||
<% if defined?(THUNDERFOREST_KEY) %>
|
||||
apikey: <%= THUNDERFOREST_KEY.to_json %>
|
||||
<% if Settings.key?(:thunderforest_key) %>
|
||||
apikey: <%= Settings.thunderforest_key.to_json %>
|
||||
<% end %>
|
||||
};
|
||||
|
||||
|
|
|
@ -5,20 +5,20 @@ OSM = {
|
|||
PIWIK: <%= PIWIK.to_json %>,
|
||||
<% end %>
|
||||
|
||||
MAX_REQUEST_AREA: <%= MAX_REQUEST_AREA.to_json %>,
|
||||
SERVER_PROTOCOL: <%= SERVER_PROTOCOL.to_json %>,
|
||||
SERVER_URL: <%= SERVER_URL.to_json %>,
|
||||
API_VERSION: <%= API_VERSION.to_json %>,
|
||||
MAX_REQUEST_AREA: <%= Settings.max_request_area.to_json %>,
|
||||
SERVER_PROTOCOL: <%= Settings.server_protocol.to_json %>,
|
||||
SERVER_URL: <%= Settings.server_url.to_json %>,
|
||||
API_VERSION: <%= Settings.api_version.to_json %>,
|
||||
STATUS: <%= STATUS.to_json %>,
|
||||
MAX_NOTE_REQUEST_AREA: <%= MAX_NOTE_REQUEST_AREA.to_json %>,
|
||||
OVERPASS_URL: <%= OVERPASS_URL.to_json %>,
|
||||
NOMINATIM_URL: <%= NOMINATIM_URL.to_json %>,
|
||||
GRAPHHOPPER_URL: <%= GRAPHHOPPER_URL.to_json %>,
|
||||
FOSSGIS_OSRM_URL: <%= FOSSGIS_OSRM_URL.to_json %>,
|
||||
MAX_NOTE_REQUEST_AREA: <%= Settings.max_note_request_area.to_json %>,
|
||||
OVERPASS_URL: <%= Settings.overpass_url.to_json %>,
|
||||
NOMINATIM_URL: <%= Settings.nominatim_url.to_json %>,
|
||||
GRAPHHOPPER_URL: <%= Settings.graphhopper_url.to_json %>,
|
||||
FOSSGIS_OSRM_URL: <%= Settings.fossgis_osrm_url.to_json %>,
|
||||
DEFAULT_LOCALE: <%= I18n.default_locale.to_json %>,
|
||||
|
||||
<% if defined?(THUNDERFOREST_KEY) %>
|
||||
THUNDERFOREST_KEY: <%= THUNDERFOREST_KEY.to_json %>,
|
||||
<% if Settings.key?(:thunderforest_key) %>
|
||||
THUNDERFOREST_KEY: <%= Settings.thunderforest_key.to_json %>,
|
||||
<% end %>
|
||||
|
||||
MARKER_GREEN: <%= image_path("marker-green.png").to_json %>,
|
||||
|
@ -212,7 +212,7 @@ OSM = {
|
|||
|
||||
return 6372795 * 2 * Math.asin(
|
||||
Math.sqrt(
|
||||
Math.pow(Math.sin(latdiff / 2), 2) +
|
||||
Math.pow(Math.sin(latdiff / 2), 2) +
|
||||
Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(lngdiff / 2), 2)
|
||||
));
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ module Api
|
|||
|
||||
def amf_handle_error_with_timeout(call, rootobj, rootid)
|
||||
amf_handle_error(call, rootobj, rootid) do
|
||||
OSM::Timer.timeout(API_TIMEOUT, OSM::APITimeoutError) do
|
||||
OSM::Timer.timeout(Settings.api_timeout, OSM::APITimeoutError) do
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,11 +30,11 @@ module Api
|
|||
return
|
||||
end
|
||||
|
||||
nodes = Node.bbox(bbox).where(:visible => true).includes(:node_tags).limit(MAX_NUMBER_OF_NODES + 1)
|
||||
nodes = Node.bbox(bbox).where(:visible => true).includes(:node_tags).limit(Settings.max_number_of_nodes + 1)
|
||||
|
||||
node_ids = nodes.collect(&:id)
|
||||
if node_ids.length > MAX_NUMBER_OF_NODES
|
||||
report_error("You requested too many nodes (limit is #{MAX_NUMBER_OF_NODES}). Either request a smaller area, or use planet.osm")
|
||||
if node_ids.length > Settings.max_number_of_nodes
|
||||
report_error("You requested too many nodes (limit is #{Settings.max_number_of_nodes}). Either request a smaller area, or use planet.osm")
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ module Api
|
|||
bbox.check_boundaries
|
||||
|
||||
# Check the the bounding box is not too big
|
||||
bbox.check_size(MAX_NOTE_REQUEST_AREA)
|
||||
bbox.check_size(Settings.max_note_request_area)
|
||||
|
||||
# Find the notes we want to return
|
||||
@notes = notes.bbox(bbox).order("updated_at DESC").limit(result_limit).preload(:comments)
|
||||
|
@ -190,7 +190,7 @@ module Api
|
|||
bbox = BoundingBox.from_bbox_params(params)
|
||||
|
||||
bbox.check_boundaries
|
||||
bbox.check_size(MAX_NOTE_REQUEST_AREA)
|
||||
bbox.check_size(Settings.max_note_request_area)
|
||||
|
||||
notes = notes.bbox(bbox)
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ module Api
|
|||
return
|
||||
end
|
||||
|
||||
offset = page * TRACEPOINTS_PER_PAGE
|
||||
offset = page * Settings.tracepoints_per_page
|
||||
|
||||
# Figure out the bbox
|
||||
# check boundary is sane and area within defined
|
||||
|
@ -36,7 +36,7 @@ module Api
|
|||
# get all the points
|
||||
ordered_points = Tracepoint.bbox(bbox).joins(:trace).where(:gpx_files => { :visibility => %w[trackable identifiable] }).order("gpx_id DESC, trackid ASC, timestamp ASC")
|
||||
unordered_points = Tracepoint.bbox(bbox).joins(:trace).where(:gpx_files => { :visibility => %w[public private] }).order("gps_points.latitude", "gps_points.longitude", "gps_points.timestamp")
|
||||
points = ordered_points.union_all(unordered_points).offset(offset).limit(TRACEPOINTS_PER_PAGE)
|
||||
points = ordered_points.union_all(unordered_points).offset(offset).limit(Settings.tracepoints_per_page)
|
||||
|
||||
doc = XML::Document.new
|
||||
doc.encoding = XML::Encoding::UTF_8
|
||||
|
|
|
@ -52,7 +52,7 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def require_oauth
|
||||
@oauth = current_user.access_token(OAUTH_KEY) if current_user && defined? OAUTH_KEY
|
||||
@oauth = current_user.access_token(Settings.oauth_key) if current_user && Settings.key?(:oauth_key)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -272,7 +272,7 @@ class ApplicationController < ActionController::Base
|
|||
##
|
||||
# wrap an api call in a timeout
|
||||
def api_call_timeout
|
||||
OSM::Timer.timeout(API_TIMEOUT, Timeout::Error) do
|
||||
OSM::Timer.timeout(Settings.api_timeout, Timeout::Error) do
|
||||
yield
|
||||
end
|
||||
rescue Timeout::Error
|
||||
|
@ -282,7 +282,7 @@ class ApplicationController < ActionController::Base
|
|||
##
|
||||
# wrap a web page in a timeout
|
||||
def web_timeout
|
||||
OSM::Timer.timeout(WEB_TIMEOUT, Timeout::Error) do
|
||||
OSM::Timer.timeout(Settings.web_timeout, Timeout::Error) do
|
||||
yield
|
||||
end
|
||||
rescue ActionView::Template::Error => ex
|
||||
|
@ -333,7 +333,7 @@ class ApplicationController < ActionController::Base
|
|||
append_content_security_policy_directives(
|
||||
:child_src => %w[http://127.0.0.1:8111 https://127.0.0.1:8112],
|
||||
:frame_src => %w[http://127.0.0.1:8111 https://127.0.0.1:8112],
|
||||
:connect_src => [NOMINATIM_URL, OVERPASS_URL, FOSSGIS_OSRM_URL, GRAPHHOPPER_URL],
|
||||
:connect_src => [Settings.nominatim_url, Settings.overpass_url, Settings.fossgis_osrm_url, Settings.graphhopper_url],
|
||||
:form_action => %w[render.openstreetmap.org],
|
||||
:style_src => %w['unsafe-inline']
|
||||
)
|
||||
|
@ -357,7 +357,7 @@ class ApplicationController < ActionController::Base
|
|||
elsif current_user&.preferred_editor
|
||||
current_user.preferred_editor
|
||||
else
|
||||
DEFAULT_EDITOR
|
||||
Settings.default_editor
|
||||
end
|
||||
|
||||
editor
|
||||
|
@ -366,9 +366,9 @@ class ApplicationController < ActionController::Base
|
|||
helper_method :preferred_editor
|
||||
|
||||
def update_totp
|
||||
if defined?(TOTP_KEY)
|
||||
if Settings.key?(:totp_key)
|
||||
cookies["_osm_totp_token"] = {
|
||||
:value => ROTP::TOTP.new(TOTP_KEY, :interval => 3600).now,
|
||||
:value => ROTP::TOTP.new(Settings.totp_key, :interval => 3600).now,
|
||||
:domain => "openstreetmap.org",
|
||||
:expires => 1.hour.from_now
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ class DiaryEntriesController < ApplicationController
|
|||
@entries = user.diary_entries
|
||||
@title = t("diary_entries.feed.user.title", :user => user.display_name)
|
||||
@description = t("diary_entries.feed.user.description", :user => user.display_name)
|
||||
@link = url_for :action => "index", :display_name => user.display_name, :host => SERVER_URL, :protocol => SERVER_PROTOCOL
|
||||
@link = url_for :action => "index", :display_name => user.display_name, :host => Settings.server_url, :protocol => Settings.server_protocol
|
||||
else
|
||||
head :not_found
|
||||
return
|
||||
|
@ -170,11 +170,11 @@ class DiaryEntriesController < ApplicationController
|
|||
@entries = @entries.where(:language_code => params[:language])
|
||||
@title = t("diary_entries.feed.language.title", :language_name => Language.find(params[:language]).english_name)
|
||||
@description = t("diary_entries.feed.language.description", :language_name => Language.find(params[:language]).english_name)
|
||||
@link = url_for :action => "index", :language => params[:language], :host => SERVER_URL, :protocol => SERVER_PROTOCOL
|
||||
@link = url_for :action => "index", :language => params[:language], :host => Settings.server_url, :protocol => Settings.server_protocol
|
||||
else
|
||||
@title = t("diary_entries.feed.all.title")
|
||||
@description = t("diary_entries.feed.all.description")
|
||||
@link = url_for :action => "index", :host => SERVER_URL, :protocol => SERVER_PROTOCOL
|
||||
@link = url_for :action => "index", :host => Settings.server_url, :protocol => Settings.server_protocol
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class GeocoderController < ApplicationController
|
|||
if @params[:lat] && @params[:lon]
|
||||
@sources.push "latlon"
|
||||
@sources.push "osm_nominatim_reverse"
|
||||
@sources.push "geonames_reverse" if defined?(GEONAMES_USERNAME)
|
||||
@sources.push "geonames_reverse" if Settings.key?(:geonames_username)
|
||||
elsif @params[:query]
|
||||
if @params[:query] =~ /^\d{5}(-\d{4})?$/
|
||||
@sources.push "osm_nominatim"
|
||||
|
@ -26,7 +26,7 @@ class GeocoderController < ApplicationController
|
|||
@sources.push "osm_nominatim"
|
||||
else
|
||||
@sources.push "osm_nominatim"
|
||||
@sources.push "geonames" if defined?(GEONAMES_USERNAME)
|
||||
@sources.push "geonames" if Settings.key?(:geonames_username)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -93,7 +93,7 @@ class GeocoderController < ApplicationController
|
|||
if response.get_elements("geodata/error").empty?
|
||||
@results.push(:lat => response.text("geodata/latt"),
|
||||
:lon => response.text("geodata/longt"),
|
||||
:zoom => POSTCODE_ZOOM,
|
||||
:zoom => Settings.postcode_zoom,
|
||||
:name => query.upcase)
|
||||
end
|
||||
|
||||
|
@ -118,7 +118,7 @@ class GeocoderController < ApplicationController
|
|||
exclude = "&exclude_place_ids=#{params[:exclude]}" if params[:exclude]
|
||||
|
||||
# ask nominatim
|
||||
response = fetch_xml("#{NOMINATIM_URL}search?format=xml&extratags=1&q=#{escape_query(query)}#{viewbox}#{exclude}&accept-language=#{http_accept_language.user_preferred_languages.join(',')}")
|
||||
response = fetch_xml("#{Settings.nominatim_url}search?format=xml&extratags=1&q=#{escape_query(query)}#{viewbox}#{exclude}&accept-language=#{http_accept_language.user_preferred_languages.join(',')}")
|
||||
|
||||
# extract the results from the response
|
||||
results = response.elements["searchresults"]
|
||||
|
@ -182,7 +182,7 @@ class GeocoderController < ApplicationController
|
|||
@results = []
|
||||
|
||||
# ask geonames.org
|
||||
response = fetch_xml("http://api.geonames.org/search?q=#{escape_query(query)}&lang=#{lang}&maxRows=20&username=#{GEONAMES_USERNAME}")
|
||||
response = fetch_xml("http://api.geonames.org/search?q=#{escape_query(query)}&lang=#{lang}&maxRows=20&username=#{Settings.geonames_username}")
|
||||
|
||||
# parse the response
|
||||
response.elements.each("geonames/geoname") do |geoname|
|
||||
|
@ -192,7 +192,7 @@ class GeocoderController < ApplicationController
|
|||
country = geoname.text("countryName")
|
||||
|
||||
@results.push(:lat => lat, :lon => lon,
|
||||
:zoom => GEONAMES_ZOOM,
|
||||
:zoom => Settings.geonames_zoom,
|
||||
:name => name,
|
||||
:suffix => ", #{country}")
|
||||
end
|
||||
|
@ -213,7 +213,7 @@ class GeocoderController < ApplicationController
|
|||
@results = []
|
||||
|
||||
# ask nominatim
|
||||
response = fetch_xml("#{NOMINATIM_URL}reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{http_accept_language.user_preferred_languages.join(',')}")
|
||||
response = fetch_xml("#{Settings.nominatim_url}reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{http_accept_language.user_preferred_languages.join(',')}")
|
||||
|
||||
# parse the response
|
||||
response.elements.each("reversegeocode/result") do |result|
|
||||
|
@ -247,7 +247,7 @@ class GeocoderController < ApplicationController
|
|||
@results = []
|
||||
|
||||
# ask geonames.org
|
||||
response = fetch_xml("http://api.geonames.org/countrySubdivision?lat=#{lat}&lng=#{lon}&lang=#{lang}&username=#{GEONAMES_USERNAME}")
|
||||
response = fetch_xml("http://api.geonames.org/countrySubdivision?lat=#{lat}&lng=#{lon}&lang=#{lang}&username=#{Settings.geonames_username}")
|
||||
|
||||
# parse the response
|
||||
response.elements.each("geonames/countrySubdivision") do |geoname|
|
||||
|
@ -255,7 +255,7 @@ class GeocoderController < ApplicationController
|
|||
country = geoname.text("countryName")
|
||||
|
||||
@results.push(:lat => lat, :lon => lon,
|
||||
:zoom => GEONAMES_ZOOM,
|
||||
:zoom => Settings.geonames_zoom,
|
||||
:name => name,
|
||||
:suffix => ", #{country}")
|
||||
end
|
||||
|
|
|
@ -26,7 +26,7 @@ class MessagesController < ApplicationController
|
|||
@message.sender = current_user
|
||||
@message.sent_on = Time.now.getutc
|
||||
|
||||
if current_user.sent_messages.where("sent_on >= ?", Time.now.getutc - 1.hour).count >= MAX_MESSAGES_PER_HOUR
|
||||
if current_user.sent_messages.where("sent_on >= ?", Time.now.getutc - 1.hour).count >= Settings.max_messages_per_hour
|
||||
flash[:error] = t ".limit_exceeded"
|
||||
render :action => "new"
|
||||
elsif @message.save
|
||||
|
|
|
@ -39,7 +39,7 @@ class OauthController < ApplicationController
|
|||
end
|
||||
|
||||
def oauth1_authorize
|
||||
override_content_security_policy_directives(:form_action => []) if CSP_ENFORCE || defined?(CSP_REPORT_URL)
|
||||
override_content_security_policy_directives(:form_action => []) if Settings.csp_enforce || Settings.key?(:csp_report_url)
|
||||
|
||||
if @token.invalidated?
|
||||
@message = t "oauth.authorize_failure.invalid"
|
||||
|
|
|
@ -121,7 +121,7 @@ class TracesController < ApplicationController
|
|||
flash[:notice] = t ".trace_uploaded"
|
||||
flash[:warning] = t ".traces_waiting", :count => current_user.traces.where(:inserted => false).count if current_user.traces.where(:inserted => false).count > 4
|
||||
|
||||
TraceImporterJob.perform_later(@trace) if TRACE_USE_JOB_QUEUE
|
||||
TraceImporterJob.perform_later(@trace) if Settings.trace_use_job_queue
|
||||
redirect_to :action => :index, :display_name => current_user.display_name
|
||||
else
|
||||
flash[:error] = t("traces.create.upload_failed") if @trace.valid?
|
||||
|
@ -205,7 +205,7 @@ class TracesController < ApplicationController
|
|||
trace.visible = false
|
||||
trace.save
|
||||
flash[:notice] = t ".scheduled_for_deletion"
|
||||
TraceDestroyerJob.perform_later(trace) if TRACE_USE_JOB_QUEUE
|
||||
TraceDestroyerJob.perform_later(trace) if Settings.trace_use_job_queue
|
||||
redirect_to :action => :index, :display_name => trace.user.display_name
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
|
|
|
@ -16,7 +16,7 @@ class UsersController < ApplicationController
|
|||
before_action :allow_thirdparty_images, :only => [:show, :account]
|
||||
|
||||
def terms
|
||||
@legale = params[:legale] || OSM.ip_to_country(request.remote_ip) || DEFAULT_LEGALE
|
||||
@legale = params[:legale] || OSM.ip_to_country(request.remote_ip) || Settings.default_legale
|
||||
@text = OSM.legal_text_for_country(@legale)
|
||||
|
||||
if request.xhr?
|
||||
|
@ -332,7 +332,7 @@ class UsersController < ApplicationController
|
|||
flash[:error] = t "users.confirm_resend.failure", :name => params[:display_name]
|
||||
else
|
||||
Notifier.signup_confirm(user, user.tokens.create).deliver_later
|
||||
flash[:notice] = t("users.confirm_resend.success", :email => user.email, :sender => SUPPORT_EMAIL).html_safe
|
||||
flash[:notice] = t("users.confirm_resend.success", :email => user.email, :sender => Settings.support_email).html_safe
|
||||
end
|
||||
|
||||
redirect_to :action => "login"
|
||||
|
@ -521,7 +521,7 @@ class UsersController < ApplicationController
|
|||
when "active", "confirmed" then
|
||||
successful_login(user, request.env["omniauth.params"]["referer"])
|
||||
when "suspended" then
|
||||
failed_login t("users.login.account is suspended", :webmaster => "mailto:#{SUPPORT_EMAIL}").html_safe
|
||||
failed_login t("users.login.account is suspended", :webmaster => "mailto:#{Settings.support_email}").html_safe
|
||||
else
|
||||
failed_login t("users.login.auth failure")
|
||||
end
|
||||
|
@ -549,7 +549,7 @@ class UsersController < ApplicationController
|
|||
elsif user = User.authenticate(:username => username, :password => password, :pending => true)
|
||||
unconfirmed_login(user)
|
||||
elsif User.authenticate(:username => username, :password => password, :suspended => true)
|
||||
failed_login t("users.login.account is suspended", :webmaster => "mailto:#{SUPPORT_EMAIL}").html_safe, username
|
||||
failed_login t("users.login.account is suspended", :webmaster => "mailto:#{Settings.support_email}").html_safe, username
|
||||
else
|
||||
failed_login t("users.login.auth failure"), username
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ module NotifierHelper
|
|||
# the <a> but Outlook only on the <strong>
|
||||
:style => "text-decoration: none"
|
||||
),
|
||||
user_url(display_name, :host => SERVER_URL),
|
||||
user_url(display_name, :host => Settings.server_url),
|
||||
:target => "_blank",
|
||||
:rel => "noopener",
|
||||
:style => "text-decoration: none; color: #222"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class Notifier < ActionMailer::Base
|
||||
default :from => EMAIL_FROM,
|
||||
:return_path => EMAIL_RETURN_PATH,
|
||||
default :from => Settings.email_from,
|
||||
:return_path => Settings.email_return_path,
|
||||
:auto_submitted => "auto-generated"
|
||||
helper :application
|
||||
before_action :set_shared_template_vars
|
||||
|
@ -196,14 +196,14 @@ class Notifier < ActionMailer::Base
|
|||
end
|
||||
|
||||
def from_address(name, type, id, digest, user_id = nil)
|
||||
if Object.const_defined?(:MESSAGES_DOMAIN) && domain = MESSAGES_DOMAIN
|
||||
if Settings.key?(:messages_domain) && domain = Settings.messages_domain
|
||||
if user_id
|
||||
"#{name} <#{type}-#{id}-#{user_id}-#{digest[0, 6]}@#{domain}>"
|
||||
else
|
||||
"#{name} <#{type}-#{id}-#{digest[0, 6]}@#{domain}>"
|
||||
end
|
||||
else
|
||||
EMAIL_FROM
|
||||
Settings.email_from
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -67,7 +67,7 @@ class ClientApplication < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def oauth_server
|
||||
@oauth_server ||= OAuth::Server.new("https://" + SERVER_URL)
|
||||
@oauth_server ||= OAuth::Server.new("https://" + Settings.server_url)
|
||||
end
|
||||
|
||||
def credentials
|
||||
|
|
|
@ -77,6 +77,6 @@ class RequestToken < OauthToken
|
|||
end
|
||||
|
||||
def oauth10?
|
||||
(defined? OAUTH_10_SUPPORT) && OAUTH_10_SUPPORT && callback_url.blank?
|
||||
Settings.key?(:oauth_10_support) && Settings.oauth_10_support && callback_url.blank?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -110,15 +110,15 @@ class Trace < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def large_picture_name
|
||||
"#{GPX_IMAGE_DIR}/#{id}.gif"
|
||||
"#{Settings.gpx_image_dir}/#{id}.gif"
|
||||
end
|
||||
|
||||
def icon_picture_name
|
||||
"#{GPX_IMAGE_DIR}/#{id}_icon.gif"
|
||||
"#{Settings.gpx_image_dir}/#{id}_icon.gif"
|
||||
end
|
||||
|
||||
def trace_name
|
||||
"#{GPX_TRACE_DIR}/#{id}.gpx"
|
||||
"#{Settings.gpx_trace_dir}/#{id}.gpx"
|
||||
end
|
||||
|
||||
def mime_type
|
||||
|
|
|
@ -201,7 +201,7 @@ class User < ActiveRecord::Base
|
|||
@preferred_languages = nil
|
||||
end
|
||||
|
||||
def nearby(radius = NEARBY_RADIUS, num = NEARBY_USERS)
|
||||
def nearby(radius = Settings.nearby_radius, num = Settings.nearby_users)
|
||||
if home_lon && home_lat
|
||||
gc = OSM::GreatCircle.new(home_lat, home_lon)
|
||||
sql_for_area = QuadTile.sql_for_area(gc.bounds(radius), "home_")
|
||||
|
@ -300,7 +300,7 @@ class User < ActiveRecord::Base
|
|||
##
|
||||
# perform a spam check on a user
|
||||
def spam_check
|
||||
update(:status => "suspended") if status == "active" && spam_score > SPAM_THRESHOLD
|
||||
update(:status => "suspended") if status == "active" && spam_score > Settings.spam_threshold
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -32,7 +32,7 @@ class UserBlock < ActiveRecord::Base
|
|||
belongs_to :creator, :class_name => "User", :foreign_key => :creator_id
|
||||
belongs_to :revoker, :class_name => "User", :foreign_key => :revoker_id
|
||||
|
||||
PERIODS = USER_BLOCK_PERIODS
|
||||
PERIODS = Settings.user_block_periods
|
||||
|
||||
##
|
||||
# scope to match active blocks
|
||||
|
|
|
@ -206,7 +206,7 @@ class Way < ActiveRecord::Base
|
|||
|
||||
def preconditions_ok?(old_nodes = [])
|
||||
return false if nds.empty?
|
||||
raise OSM::APITooManyWayNodesError.new(id, nds.length, MAX_NUMBER_OF_WAY_NODES) if nds.length > MAX_NUMBER_OF_WAY_NODES
|
||||
raise OSM::APITooManyWayNodesError.new(id, nds.length, Settings.max_number_of_way_nodes) if nds.length > Settings.max_number_of_way_nodes
|
||||
|
||||
# check only the new nodes, for efficiency - old nodes having been checked last time and can't
|
||||
# be deleted when they're in-use.
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
xml.instruct! :xml, :version => "1.0"
|
||||
xml.osm(OSM::API.new.xml_root_attributes) do |osm|
|
||||
osm.api do |api|
|
||||
api.version(:minimum => API_VERSION.to_s, :maximum => API_VERSION.to_s)
|
||||
api.area(:maximum => MAX_REQUEST_AREA.to_s)
|
||||
api.note_area(:maximum => MAX_NOTE_REQUEST_AREA.to_s)
|
||||
api.tracepoints(:per_page => TRACEPOINTS_PER_PAGE.to_s)
|
||||
api.waynodes(:maximum => MAX_NUMBER_OF_WAY_NODES.to_s)
|
||||
api.changesets(:maximum_elements => Changeset::MAX_ELEMENTS.to_s)
|
||||
api.timeout(:seconds => API_TIMEOUT.to_s)
|
||||
api.status(:database => @database_status.to_s,
|
||||
:api => @api_status.to_s,
|
||||
:gpx => @gpx_status.to_s)
|
||||
api.version(:minimum => Settings.api_version, :maximum => Settings.api_version)
|
||||
api.area(:maximum => Settings.max_request_area)
|
||||
api.note_area(:maximum => Settings.max_note_request_area)
|
||||
api.tracepoints(:per_page => Settings.tracepoints_per_page)
|
||||
api.waynodes(:maximum => Settings.max_number_of_way_nodes)
|
||||
api.changesets(:maximum_elements => Changeset::MAX_ELEMENTS)
|
||||
api.timeout(:seconds => Settings.api_timeout)
|
||||
api.status(:database => @database_status,
|
||||
:api => @api_status,
|
||||
:gpx => @gpx_status)
|
||||
end
|
||||
osm.policy do |policy|
|
||||
policy.imagery do |imagery|
|
||||
IMAGERY_BLACKLIST.each do |url_regex|
|
||||
Settings.imagery_blacklist.each do |url_regex|
|
||||
imagery.blacklist(:regex => url_regex.to_s)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
<%= tag("meta", { :name => "msapplication-TileImage", :content => image_path("mstile-144x144.png") }) %>
|
||||
<%= tag("meta", { :name => "theme-color", :content => "#ffffff" }) %>
|
||||
<%= canonical_tag %>
|
||||
<% if defined?(PUBLISHER_URL) -%>
|
||||
<%= tag("link", { :rel => "publisher", :href => PUBLISHER_URL }) %>
|
||||
<% if Settings.key?(:publisher_url) -%>
|
||||
<%= tag("link", { :rel => "publisher", :href => Settings.publisher_url }) %>
|
||||
<% end -%>
|
||||
<%= tag("link", { :rel => "search", :type => "application/opensearchdescription+xml", :title => "OpenStreetMap Search", :href => asset_path("osm.xml") }) %>
|
||||
<%= tag("meta", { :name => "description", :content => "OpenStreetMap is the free wiki world map." }) %>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<p><%= t 'notifier.email_confirm_html.greeting' %></p>
|
||||
|
||||
<p><%= t 'notifier.email_confirm_html.hopefully_you', :server_url => SERVER_URL, :new_address => @address %></p>
|
||||
<p><%= t 'notifier.email_confirm_html.hopefully_you', :server_url => Settings.server_url, :new_address => @address %></p>
|
||||
|
||||
<p><%= t 'notifier.email_confirm_html.click_the_link' %></p>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<%= t 'notifier.email_confirm_plain.greeting' %>
|
||||
|
||||
<%= word_wrap(t 'notifier.email_confirm_plain.hopefully_you', :server_url => SERVER_URL, :new_address => @address) %>
|
||||
<%= word_wrap(t 'notifier.email_confirm_plain.hopefully_you', :server_url => Settings.server_url, :new_address => @address) %>
|
||||
|
||||
<%= t 'notifier.email_confirm_plain.click_the_link' %>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<p><%= t(".greeting") %></p>
|
||||
|
||||
<p><%= t(".created", :site_url => SERVER_URL) %></p>
|
||||
<p><%= t(".created", :site_url => Settings.server_url) %></p>
|
||||
|
||||
<p><%= t(".confirm") %></p>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<%= fp(t(".greeting")) %>
|
||||
|
||||
<%= fp(t(".created", :site_url => SERVER_URL)) %>
|
||||
<%= fp(t(".created", :site_url => Settings.server_url)) %>
|
||||
|
||||
<%= fp(t(".confirm")) %>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<%= javascript_include_tag "edit/id" %>
|
||||
|
||||
<div id="map">
|
||||
<% data = { :key => ID_KEY } -%>
|
||||
<% data = { :key => Settings.id_key } -%>
|
||||
<% data[:lat] = @lat if @lat -%>
|
||||
<% data[:lon] = @lon if @lon -%>
|
||||
<% data[:gpx] = trace_data_url(params[:gpx], :format => :xml) if params[:gpx] -%>
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<% data[:lat] = @lat if @lat -%>
|
||||
<% data[:lon] = @lon if @lon -%>
|
||||
<% data[:zoom] = @zoom if @zoom -%>
|
||||
<% if defined? POTLATCH2_KEY %>
|
||||
<% token = current_user.access_token(POTLATCH2_KEY) %>
|
||||
<% if Settings.key?(:potlatch2_key) %>
|
||||
<% token = current_user.access_token(Settings.potlatch2_key) %>
|
||||
<% data[:token] = token.token -%>
|
||||
<% data[:token_secret] = token.secret -%>
|
||||
<% data[:consumer_key] = token.client_application.key -%>
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
</head>
|
||||
<body>
|
||||
<% data = {} -%>
|
||||
<% if defined? ID_KEY %>
|
||||
<% token = current_user.access_token(ID_KEY) %>
|
||||
<% if Settings.key?(:id_key) %>
|
||||
<% token = current_user.access_token(Settings.id_key) %>
|
||||
<% data[:token] = token.token -%>
|
||||
<% data[:token_secret] = token.secret -%>
|
||||
<% data[:consumer_key] = token.client_application.key -%>
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
</div>
|
||||
<div class="form-row">
|
||||
<label class="standard-label"><%= t '.preferred editor' %></label>
|
||||
<%= f.select :preferred_editor, [[t("editor.default", :name => t("editor.#{DEFAULT_EDITOR}.name")), 'default']] + Editors::ALL_EDITORS.collect { |e| [t("editor.#{e}.description"), e] } %>
|
||||
<%= f.select :preferred_editor, [[t("editor.default", :name => t("editor.#{Settings.default_editor}.name")), 'default']] + Editors::ALL_EDITORS.collect { |e| [t("editor.#{e}.description"), e] } %>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
|
||||
<div class="message">
|
||||
<h1><%= t 'users.new.no_auto_account_create' %></h1>
|
||||
<h2><%= raw t 'users.new.contact_webmaster', :webmaster => "mailto:#{SUPPORT_EMAIL}" %></h2>
|
||||
<h2><%= raw t 'users.new.contact_webmaster', :webmaster => "mailto:#{Settings.support_email}" %></h2>
|
||||
</div>
|
||||
|
|
|
@ -53,19 +53,19 @@
|
|||
|
||||
<ul class='clearfix' id="login_auth_buttons">
|
||||
<li><%= link_to image_tag("openid.png", :alt => t(".auth_providers.openid.title")), "#", :id => "openid_open_url", :title => t(".auth_providers.openid.title") %></li>
|
||||
<% if defined?(GOOGLE_AUTH_ID) -%>
|
||||
<% if Settings.key?(:google_auth_id) -%>
|
||||
<li><%= auth_button "google", "google" %></li>
|
||||
<% end -%>
|
||||
<% if defined?(FACEBOOK_AUTH_ID) -%>
|
||||
<% if Settings.key?(:facebook_auth_id) -%>
|
||||
<li><%= auth_button "facebook", "facebook" %></li>
|
||||
<% end -%>
|
||||
<% if defined?(WINDOWSLIVE_AUTH_ID) -%>
|
||||
<% if Settings.key?(:windowslive_auth_id) -%>
|
||||
<li><%= auth_button "windowslive", "windowslive" %></li>
|
||||
<% end -%>
|
||||
<% if defined?(GITHUB_AUTH_ID) -%>
|
||||
<% if Settings.key?(:github_auth_id) -%>
|
||||
<li><%= auth_button "github", "github" %></li>
|
||||
<% end -%>
|
||||
<% if defined?(WIKIPEDIA_AUTH_ID) -%>
|
||||
<% if Settings.key?(:wikipedia_auth_id) -%>
|
||||
<li><%= auth_button "wikipedia", "wikipedia" %></li>
|
||||
<% end -%>
|
||||
<li><%= auth_button "yahoo", "openid", :openid_url => "yahoo.com" %></li>
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
<h1><%= t ".heading" %></h1>
|
||||
<% end %>
|
||||
|
||||
<%= raw t ".body", :webmaster => link_to(t(".webmaster"), "mailto:#{SUPPORT_EMAIL}") %>
|
||||
<%= raw t ".body", :webmaster => link_to(t(".webmaster"), "mailto:#{Settings.support_email}") %>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue