-log
-config/piwik.yml
+*~
+.DS_Store
+.idea
+.ruby-gemset
+.ruby-version
+.vagrant
app/assets/javascripts/i18n
+config/environments/*.local.yml
+config/piwik.yml
+config/settings.local.yml
+config/settings/*.local.yml
+coverage
+doc
+log
public/assets
public/attachments
public/export
tmp
-.DS_Store
-*~
-doc
-.vagrant
-.ruby-gemset
-.ruby-version
-.idea
-coverage
global:
- OSM_MEMCACHE_SERVERS="127.0.0.1"
before_script:
- - cp config/example.application.yml config/application.yml
- psql -U postgres -c "CREATE DATABASE openstreetmap"
- psql -U postgres -c "CREATE EXTENSION btree_gist" openstreetmap
- make -C db/functions libpgosm.so
- psql -U postgres -c "CREATE FUNCTION tile_for_point(int4, int4) RETURNS int8 AS '/tmp/libpgosm', 'tile_for_point' LANGUAGE C STRICT" openstreetmap
- psql -U postgres -c "CREATE FUNCTION xid_to_int4(xid) RETURNS int4 AS '/tmp/libpgosm', 'xid_to_int4' LANGUAGE C STRICT" openstreetmap
- cp config/travis.database.yml config/database.yml
+ - touch config/settings.local.yml
- bundle exec rake db:migrate
- bundle exec rake i18n:js:export
script:
After [installing](INSTALL.md) this software, you may need to carry out some of these configuration steps, depending on your tasks.
+## Application configuration
+
+Many settings are available in `config/settings.yml`. You can customize your installation of The Rails Port by overriding these values using `config/settings.local.yml`
+
## Populating the database
Your installation comes with no geographic data loaded. You can either create new data using one of the editors (Potlatch 2, iD, JOSM etc) or by loading an OSM extract.
* Everything else can be left with the default blank values.
* Click the "Register" button
* On the next page, copy the "consumer key"
-* Edit config/application.yml in your rails tree
-* Uncomment and change the "potlatch2_key" configuration value
+* Edit config/settings.local.yml in your rails tree
+* Add the "potlatch2_key" configuration key and the consumer key as the value
* Restart your rails server
-An example excerpt from application.yml:
+An example excerpt from settings.local.yml:
```
# Default editor
Follow the same process for registering and configuring iD (`id_key`) and the website/Notes (`oauth_key`), or to save time, simply reuse the same consumer key for each.
-**NOTE:** If you forget to set up OAuth, then you will get an error message similar to `uninitialized constant ActionView::CompiledTemplates::ID_KEY`.
-
## Troubleshooting
Rails has its own log. To inspect the log, do this:
source "https://rubygems.org"
# Require rails
-gem "rails", "5.2.2"
+gem "rails", "5.2.2.1"
# Require things which have moved to gems in ruby 1.9
gem "bigdecimal", "~> 1.1.0", :platforms => :ruby_19
# Load rails plugins
gem "actionpack-page_caching"
gem "active_record_union"
+gem "activerecord-import"
gem "cancancan"
gem "composite_primary_keys", "~> 11.1.0"
+gem "config"
gem "delayed_job_active_record"
gem "dynamic_form"
gem "http_accept_language", "~> 2.0.0"
remote: https://rubygems.org/
specs:
SystemTimer (1.2.3)
- aasm (5.0.1)
+ aasm (5.0.2)
concurrent-ruby (~> 1.0)
- actioncable (5.2.2)
- actionpack (= 5.2.2)
+ actioncable (5.2.2.1)
+ actionpack (= 5.2.2.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
- actionmailer (5.2.2)
- actionpack (= 5.2.2)
- actionview (= 5.2.2)
- activejob (= 5.2.2)
+ actionmailer (5.2.2.1)
+ actionpack (= 5.2.2.1)
+ actionview (= 5.2.2.1)
+ activejob (= 5.2.2.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
- actionpack (5.2.2)
- actionview (= 5.2.2)
- activesupport (= 5.2.2)
+ actionpack (5.2.2.1)
+ actionview (= 5.2.2.1)
+ activesupport (= 5.2.2.1)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionpack-page_caching (1.1.1)
actionpack (>= 4.0.0, < 6)
- actionview (5.2.2)
- activesupport (= 5.2.2)
+ actionview (5.2.2.1)
+ activesupport (= 5.2.2.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_record_union (1.3.0)
activerecord (>= 4.0)
- activejob (5.2.2)
- activesupport (= 5.2.2)
+ activejob (5.2.2.1)
+ activesupport (= 5.2.2.1)
globalid (>= 0.3.6)
- activemodel (5.2.2)
- activesupport (= 5.2.2)
- activerecord (5.2.2)
- activemodel (= 5.2.2)
- activesupport (= 5.2.2)
+ activemodel (5.2.2.1)
+ activesupport (= 5.2.2.1)
+ activerecord (5.2.2.1)
+ activemodel (= 5.2.2.1)
+ activesupport (= 5.2.2.1)
arel (>= 9.0)
- activestorage (5.2.2)
- actionpack (= 5.2.2)
- activerecord (= 5.2.2)
+ activerecord-import (0.28.1)
+ activerecord (>= 3.2)
+ activestorage (5.2.2.1)
+ actionpack (= 5.2.2.1)
+ activerecord (= 5.2.2.1)
marcel (~> 0.3.1)
- activesupport (5.2.2)
+ activesupport (5.2.2.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
bigdecimal (1.1.0)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
- bootsnap (1.4.0)
+ bootsnap (1.4.1)
msgpack (~> 1.0)
browser (2.5.3)
builder (3.2.3)
coffee-script-source (1.12.2)
composite_primary_keys (11.1.0)
activerecord (~> 5.2.1)
- concurrent-ruby (1.1.4)
+ concurrent-ruby (1.1.5)
+ config (1.7.1)
+ activesupport (>= 3.0)
+ deep_merge (~> 1.2.1)
+ dry-validation (>= 0.12.2)
coveralls (0.8.22)
json (>= 1.8, < 3)
simplecov (~> 0.16.1)
crass (1.0.4)
dalli (2.7.9)
debug_inspector (0.0.3)
+ deep_merge (1.2.1)
delayed_job (4.1.5)
activesupport (>= 3.0, < 5.3)
delayed_job_active_record (4.1.3)
activerecord (>= 3.0, < 5.3)
delayed_job (>= 3.0, < 5)
docile (1.3.1)
+ dry-configurable (0.8.2)
+ concurrent-ruby (~> 1.0)
+ dry-core (~> 0.4, >= 0.4.7)
+ dry-container (0.7.0)
+ concurrent-ruby (~> 1.0)
+ dry-configurable (~> 0.1, >= 0.1.3)
+ dry-core (0.4.7)
+ concurrent-ruby (~> 1.0)
+ dry-equalizer (0.2.2)
+ dry-inflector (0.1.2)
+ dry-logic (0.5.0)
+ dry-container (~> 0.2, >= 0.2.6)
+ dry-core (~> 0.2)
+ dry-equalizer (~> 0.2)
+ dry-types (0.14.0)
+ concurrent-ruby (~> 1.0)
+ dry-container (~> 0.3)
+ dry-core (~> 0.4, >= 0.4.4)
+ dry-equalizer (~> 0.2)
+ dry-inflector (~> 0.1, >= 0.1.2)
+ dry-logic (~> 0.5, >= 0.5)
+ dry-validation (0.13.0)
+ concurrent-ruby (~> 1.0)
+ dry-configurable (~> 0.1, >= 0.1.3)
+ dry-core (~> 0.2, >= 0.2.1)
+ dry-equalizer (~> 0.2)
+ dry-logic (~> 0.5, >= 0.5.0)
+ dry-types (~> 0.14, >= 0.14)
dynamic_form (1.1.4)
erubi (1.8.0)
execjs (2.7.0)
exifr (1.3.6)
- factory_bot (5.0.0)
+ factory_bot (5.0.2)
activesupport (>= 4.2.0)
factory_bot_rails (5.0.1)
factory_bot (~> 5.0.0)
railties (>= 4.2.0)
- fakefs (0.19.1)
+ fakefs (0.20.0)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
- ffi (1.9.25)
+ ffi (1.10.0)
fspath (3.1.0)
gd2-ffij (0.3.0)
ffi (>= 1.0.0)
execjs (>= 1.4.0)
multi_json (~> 1.0)
therubyracer (~> 0.12.1)
- json (2.1.0)
+ json (2.2.0)
jsonify (0.3.1)
multi_json (~> 1.0)
jsonify-rails (0.3.2)
mini_mime (1.0.1)
mini_portile2 (2.4.0)
minitest (5.11.3)
- msgpack (1.2.6)
+ msgpack (1.2.9)
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
omniauth-github (1.3.0)
omniauth (~> 1.5)
omniauth-oauth2 (>= 1.4.0, < 2.0)
- omniauth-google-oauth2 (0.6.0)
+ omniauth-google-oauth2 (0.6.1)
jwt (>= 2.0)
omniauth (>= 1.1.1)
omniauth-oauth2 (>= 1.5)
mime-types
mimemagic (~> 0.3.0)
terrapin (~> 0.6.0)
- parallel (1.13.0)
+ parallel (1.14.0)
parser (2.6.0.0)
ast (~> 2.4.0)
pg (0.21.0)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rack-uri_sanitizer (0.0.2)
- rails (5.2.2)
- actioncable (= 5.2.2)
- actionmailer (= 5.2.2)
- actionpack (= 5.2.2)
- actionview (= 5.2.2)
- activejob (= 5.2.2)
- activemodel (= 5.2.2)
- activerecord (= 5.2.2)
- activestorage (= 5.2.2)
- activesupport (= 5.2.2)
+ rails (5.2.2.1)
+ actioncable (= 5.2.2.1)
+ actionmailer (= 5.2.2.1)
+ actionpack (= 5.2.2.1)
+ actionview (= 5.2.2.1)
+ activejob (= 5.2.2.1)
+ activemodel (= 5.2.2.1)
+ activerecord (= 5.2.2.1)
+ activestorage (= 5.2.2.1)
+ activesupport (= 5.2.2.1)
bundler (>= 1.3.0)
- railties (= 5.2.2)
+ railties (= 5.2.2.1)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.4)
actionpack (>= 5.0.1.x)
rails-i18n (4.0.2)
i18n (~> 0.6)
rails (>= 4.0)
- railties (5.2.2)
- actionpack (= 5.2.2)
- activesupport (= 5.2.2)
+ railties (5.2.2.1)
+ actionpack (= 5.2.2.1)
+ activesupport (= 5.2.2.1)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
request_store (1.4.1)
rack (>= 1.4)
rinku (2.0.4)
- rotp (4.0.2)
+ rotp (4.1.0)
addressable (~> 2.5)
- rubocop (0.64.0)
+ rubocop (0.65.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
powerpack (~> 0.1)
+ psych (>= 3.1.0)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.4.0)
ruby-openid (2.7.0)
ruby-progressbar (1.10.0)
ruby_dep (1.5.0)
- safe_yaml (1.0.4)
+ safe_yaml (1.0.5)
sanitize (5.0.0)
crass (~> 1.0.2)
nokogiri (>= 1.8.0)
nokogumbo (~> 2.0)
- sassc (2.0.0)
- ffi (~> 1.9.6)
+ sassc (2.0.1)
+ ffi (~> 1.9)
rake
sassc-rails (2.1.0)
railties (>= 4.0.0)
sprockets (> 3.0)
sprockets-rails
tilt
- secure_headers (6.0.0)
+ secure_headers (6.1.0)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
aasm
actionpack-page_caching
active_record_union
+ activerecord-import
annotate
autoprefixer-rails (~> 8.6.3)
better_errors
capybara (~> 2.13)
coffee-rails (~> 4.2)
composite_primary_keys (~> 11.1.0)
+ config
coveralls
dalli
delayed_job_active_record
r2 (~> 0.2.7)
rack-cors
rack-uri_sanitizer
- rails (= 5.2.2)
+ rails (= 5.2.2.1)
rails-controller-testing
rails-i18n (~> 4.0.0)
record_tag_helper
bundle install
```
-## Application setup
-
-We need to create the `config/application.yml` file from the example template. This contains various configuration options.
-
-```
-cp config/example.application.yml config/application.yml
-```
-
-You can customize your installation of The Rails Port by changing the values in `config/application.yml`
-
## Database setup
The Rails Port uses three databases - one for development, one for testing, and one for production. The database-specific configuration
:changeset, :note, :new_note, :query], :browse
can :show, :capability
can :index, :change
- can [:index, :feed, :show, :download, :query], Changeset
- can :index, ChangesetComment
can :search, :direction
can [:index, :permalink, :edit, :help, :fixthemap, :offline, :export, :about, :preview, :copyright, :key, :id], :site
- can [:index, :rss, :show, :comments], DiaryEntry
can [:finish, :embed], :export
can [:search, :search_latlon, :search_ca_postcode, :search_osm_nominatim,
:search_geonames, :search_osm_nominatim_reverse, :search_geonames_reverse], :geocoder
can :index, :map
- can [:index, :create, :comment, :feed, :show, :search, :mine], Note
can [:token, :request_token, :access_token, :test_request], :oauth
can :show, :permission
- can [:index, :show], Redaction
can [:search_all, :search_nodes, :search_ways, :search_relations], :search
can [:trackpoints], :swf
- can [:index, :show, :data, :georss, :picture, :icon], Trace
- can :index, Tracepoint
- can [:terms, :api_users, :login, :logout, :new, :create, :save, :confirm, :confirm_resend, :confirm_email, :lost_password, :reset_password, :show, :api_read, :auth_success, :auth_failure], User
- can [:index, :show, :blocks_on, :blocks_by], UserBlock
- can [:index, :show], Node
- can [:index, :show, :full, :ways_for_node], Way
- can [:index, :show, :full, :relations_for_node, :relations_for_way, :relations_for_relation], Relation
- can [:history, :version], OldNode
- can [:history, :version], OldWay
- can [:history, :version], OldRelation
+
+ if Settings.status != "database_offline"
+ can [:index, :feed, :show, :download, :query], Changeset
+ can :index, ChangesetComment
+ can [:index, :rss, :show, :comments], DiaryEntry
+ can [:index, :create, :comment, :feed, :show, :search, :mine], Note
+ can [:index, :show], Redaction
+ can [:index, :show, :data, :georss, :picture, :icon], Trace
+ can :index, Tracepoint
+ can [:terms, :api_users, :login, :logout, :new, :create, :save, :confirm, :confirm_resend, :confirm_email, :lost_password, :reset_password, :show, :api_read, :auth_success, :auth_failure], User
+ can [:index, :show, :blocks_on, :blocks_by], UserBlock
+ can [:index, :show], Node
+ can [:index, :show, :full, :ways_for_node], Way
+ can [:index, :show, :full, :relations_for_node, :relations_for_way, :relations_for_relation], Relation
+ can [:history, :version], OldNode
+ can [:history, :version], OldWay
+ can [:history, :version], OldRelation
+ end
if user
can :welcome, :site
- can [:index, :new, :create, :show, :edit, :update, :destroy], ClientApplication
- can [:create, :edit, :comment, :subscribe, :unsubscribe], DiaryEntry
- can [:new, :create, :reply, :show, :inbox, :outbox, :mark, :destroy], Message
- can [:close, :reopen], Note
can [:revoke, :authorize], :oauth
- can [:new, :create], Report
- can [:mine, :new, :create, :edit, :update, :delete, :api_create, :api_read, :api_update, :api_delete, :api_data], Trace
- can [:account, :go_public, :make_friend, :remove_friend, :api_details, :api_gpx_files], User
- can [:read, :read_one, :update, :update_one, :delete_one], UserPreference
- if user.terms_agreed?
- can [:create, :update, :upload, :close, :subscribe, :unsubscribe, :expand_bbox], Changeset
- can :create, ChangesetComment
- can [:create, :update, :delete], Node
- can [:create, :update, :delete], Way
- can [:create, :update, :delete], Relation
- end
+ if Settings.status != "database_offline"
+ can [:index, :new, :create, :show, :edit, :update, :destroy], ClientApplication
+ can [:create, :edit, :comment, :subscribe, :unsubscribe], DiaryEntry
+ can [:new, :create, :reply, :show, :inbox, :outbox, :mark, :destroy], Message
+ can [:close, :reopen], Note
+ can [:new, :create], Report
+ can [:mine, :new, :create, :edit, :update, :delete, :api_create, :api_read, :api_update, :api_delete, :api_data], Trace
+ can [:account, :go_public, :make_friend, :remove_friend, :api_details, :api_gpx_files], User
+ can [:read, :read_one, :update, :update_one, :delete_one], UserPreference
- if user.moderator?
- can [:destroy, :restore], ChangesetComment
- can [:index, :show, :resolve, :ignore, :reopen], Issue
- can :create, IssueComment
- can :destroy, Note
- can [:new, :create, :edit, :update, :destroy], Redaction
- can [:new, :edit, :create, :update, :revoke], UserBlock
if user.terms_agreed?
- can :redact, OldNode
- can :redact, OldWay
- can :redact, OldRelation
+ can [:create, :update, :upload, :close, :subscribe, :unsubscribe, :expand_bbox], Changeset
+ can :create, ChangesetComment
+ can [:create, :update, :delete], Node
+ can [:create, :update, :delete], Way
+ can [:create, :update, :delete], Relation
end
- end
- if user.administrator?
- can [:hide, :hidecomment], [DiaryEntry, DiaryComment]
- can [:index, :show, :resolve, :ignore, :reopen], Issue
- can :create, IssueComment
- can [:set_status, :delete, :index], User
- can [:grant, :revoke], UserRole
+ if user.moderator?
+ can [:destroy, :restore], ChangesetComment
+ can [:index, :show, :resolve, :ignore, :reopen], Issue
+ can :create, IssueComment
+ can :destroy, Note
+ can [:new, :create, :edit, :update, :destroy], Redaction
+ can [:new, :edit, :create, :update, :revoke], UserBlock
+
+ if user.terms_agreed?
+ can :redact, OldNode
+ can :redact, OldWay
+ can :redact, OldRelation
+ end
+ end
+
+ if user.administrator?
+ can [:hide, :hidecomment], [DiaryEntry, DiaryComment]
+ can [:index, :show, :resolve, :ignore, :reopen], Issue
+ can :create, IssueComment
+ can [:set_status, :delete, :index], User
+ can [:grant, :revoke], UserRole
+ end
end
end
include CanCan::Ability
def initialize(token)
- can [:create, :comment, :close, :reopen], Note if capability?(token, :allow_write_notes)
- can [:api_read, :api_data], Trace if capability?(token, :allow_read_gpx)
- can [:api_create, :api_update, :api_delete], Trace if capability?(token, :allow_write_gpx)
- can [:api_details], User if capability?(token, :allow_read_prefs)
- can [:api_gpx_files], User if capability?(token, :allow_read_gpx)
- can [:read, :read_one], UserPreference if capability?(token, :allow_read_prefs)
- can [:update, :update_one, :delete_one], UserPreference if capability?(token, :allow_write_prefs)
+ if Settings.status != "database_offline"
+ can [:create, :comment, :close, :reopen], Note if capability?(token, :allow_write_notes)
+ can [:api_read, :api_data], Trace if capability?(token, :allow_read_gpx)
+ can [:api_create, :api_update, :api_delete], Trace if capability?(token, :allow_write_gpx)
+ can [:api_details], User if capability?(token, :allow_read_prefs)
+ can [:api_gpx_files], User if capability?(token, :allow_read_gpx)
+ can [:read, :read_one], UserPreference if capability?(token, :allow_read_prefs)
+ can [:update, :update_one, :delete_one], UserPreference if capability?(token, :allow_write_prefs)
- if token&.user&.terms_agreed?
- can [:create, :update, :upload, :close, :subscribe, :unsubscribe, :expand_bbox], Changeset if capability?(token, :allow_write_api)
- can :create, ChangesetComment if capability?(token, :allow_write_api)
- can [:create, :update, :delete], Node if capability?(token, :allow_write_api)
- can [:create, :update, :delete], Way if capability?(token, :allow_write_api)
- can [:create, :update, :delete], Relation if capability?(token, :allow_write_api)
- end
-
- if token&.user&.moderator?
- can [:destroy, :restore], ChangesetComment if capability?(token, :allow_write_api)
- can :destroy, Note if capability?(token, :allow_write_notes)
if token&.user&.terms_agreed?
- can :redact, OldNode if capability?(token, :allow_write_api)
- can :redact, OldWay if capability?(token, :allow_write_api)
- can :redact, OldRelation if capability?(token, :allow_write_api)
+ can [:create, :update, :upload, :close, :subscribe, :unsubscribe, :expand_bbox], Changeset if capability?(token, :allow_write_api)
+ can :create, ChangesetComment if capability?(token, :allow_write_api)
+ can [:create, :update, :delete], Node if capability?(token, :allow_write_api)
+ can [:create, :update, :delete], Way if capability?(token, :allow_write_api)
+ can [:create, :update, :delete], Relation if capability?(token, :allow_write_api)
+ end
+
+ if token&.user&.moderator?
+ can [:destroy, :restore], ChangesetComment if capability?(token, :allow_write_api)
+ can :destroy, Note if capability?(token, :allow_write_notes)
+ if token&.user&.terms_agreed?
+ can :redact, OldNode if capability?(token, :allow_write_api)
+ can :redact, OldWay if capability?(token, :allow_write_api)
+ can :redact, OldRelation if capability?(token, :allow_write_api)
+ end
end
end
end
}
var thunderforestOptions = {
-<% if defined?(THUNDERFOREST_KEY) %>
- apikey: <%= THUNDERFOREST_KEY.to_json %>
+<% if Settings.key?(:thunderforest_key) %>
+ apikey: <%= Settings.thunderforest_key.to_json %>
<% end %>
};
-//= depend_on application.yml
+//= depend_on settings.yml
+//= depend_on settings.local.yml
OSM = {
<% if defined?(PIWIK) %>
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 %>,
- 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_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: <%= Settings.status.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 %>,
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)
));
}
# * version conflict when POIs and ways are reverted
module Api
- class AmfController < ApplicationController
+ class AmfController < ApiController
include Potlatch
- skip_before_action :verify_authenticity_token
before_action :check_api_writable
# AMF Controller implements its own authentication and authorization checks
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
module Api
- class CapabilitiesController < ApplicationController
- skip_before_action :verify_authenticity_token
- before_action :api_deny_access_handler
-
+ class CapabilitiesController < ApiController
authorize_resource :class => false
around_action :api_call_handle_error, :api_call_timeout
module Api
- class ChangesController < ApplicationController
- skip_before_action :verify_authenticity_token
- before_action :api_deny_access_handler
-
+ class ChangesController < ApiController
authorize_resource :class => false
before_action :check_api_readable
module Api
- class ChangesetCommentsController < ApplicationController
- skip_before_action :verify_authenticity_token
+ class ChangesetCommentsController < ApiController
before_action :authorize
- before_action :api_deny_access_handler
authorize_resource
changeset.subscribers << current_user unless changeset.subscribers.exists?(current_user.id)
# Return a copy of the updated changeset
- render :xml => changeset.to_xml.to_s
+ @changeset = changeset
+ render "api/changesets/changeset"
end
##
comment.update(:visible => false)
# Return a copy of the updated changeset
- render :xml => comment.changeset.to_xml.to_s
+ @changeset = comment.changeset
+ render "api/changesets/changeset"
end
##
comment.update(:visible => true)
# Return a copy of the updated changeset
- render :xml => comment.changeset.to_xml.to_s
+ @changeset = comment.changeset
+ render "api/changesets/changeset"
end
end
end
# The ChangesetController is the RESTful interface to Changeset objects
module Api
- class ChangesetsController < ApplicationController
+ class ChangesetsController < ApiController
layout "site"
require "xml/libxml"
- skip_before_action :verify_authenticity_token
before_action :authorize, :only => [:create, :update, :upload, :close, :subscribe, :unsubscribe]
- before_action :api_deny_access_handler, :only => [:create, :update, :upload, :close, :subscribe, :unsubscribe, :expand_bbox]
authorize_resource
before_action :require_public_data, :only => [:create, :update, :upload, :close, :subscribe, :unsubscribe]
before_action :check_api_writable, :only => [:create, :update, :upload, :subscribe, :unsubscribe]
before_action :check_api_readable, :except => [:create, :update, :upload, :download, :query, :subscribe, :unsubscribe]
- before_action(:only => [:index, :feed]) { |c| c.check_database_readable(true) }
around_action :api_call_handle_error
around_action :api_call_timeout, :except => [:upload]
# Return XML giving the basic info about the changeset. Does not
# return anything about the nodes, ways and relations in the changeset.
def show
- changeset = Changeset.find(params[:id])
-
- render :xml => changeset.to_xml(params[:include_discussion].presence).to_s
+ @changeset = Changeset.find(params[:id])
+ @include_discussion = params[:include_discussion].presence
+ render "changeset"
end
##
# save the larger bounding box and return the changeset, which
# will include the bigger bounding box.
cs.save!
- render :xml => cs.to_xml.to_s
+ @changeset = cs
+ render "changeset"
end
##
# sort and limit the changesets
changesets = changesets.order("created_at DESC").limit(100)
- # preload users, tags and comments
- changesets = changesets.preload(:user, :changeset_tags, :comments)
-
- # create the results document
- results = OSM::API.new.get_xml_doc
-
- # add all matching changesets to the XML results document
- changesets.order("created_at DESC").limit(100).each do |cs|
- results.root << cs.to_xml_node
- end
-
- render :xml => results.to_s
+ # preload users, tags and comments, and render result
+ @changesets = changesets.preload(:user, :changeset_tags, :comments)
+ render "changesets"
end
##
# request *must* be a PUT.
assert_method :put
- changeset = Changeset.find(params[:id])
+ @changeset = Changeset.find(params[:id])
new_changeset = Changeset.from_xml(request.raw_post)
- check_changeset_consistency(changeset, current_user)
- changeset.update_from(new_changeset, current_user)
- render :xml => changeset.to_xml.to_s
+ check_changeset_consistency(@changeset, current_user)
+ @changeset.update_from(new_changeset, current_user)
+ render "changeset"
end
##
changeset.subscribers << current_user
# Return a copy of the updated changeset
- render :xml => changeset.to_xml.to_s
+ @changeset = changeset
+ render "changeset"
end
##
changeset.subscribers.delete(current_user)
# Return a copy of the updated changeset
- render :xml => changeset.to_xml.to_s
+ @changeset = changeset
+ render "changeset"
end
private
module Api
- class MapController < ApplicationController
- skip_before_action :verify_authenticity_token
- before_action :api_deny_access_handler
-
+ class MapController < ApiController
authorize_resource :class => false
before_action :check_api_readable
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
# The NodeController is the RESTful interface to Node objects
module Api
- class NodesController < ApplicationController
+ class NodesController < ApiController
require "xml/libxml"
- skip_before_action :verify_authenticity_token
before_action :authorize, :only => [:create, :update, :delete]
- before_action :api_deny_access_handler
authorize_resource
module Api
- class NotesController < ApplicationController
+ class NotesController < ApiController
layout "site", :only => [:mine]
- skip_before_action :verify_authenticity_token
before_action :check_api_readable
before_action :setup_user_auth, :only => [:create, :comment, :show]
before_action :authorize, :only => [:close, :reopen, :destroy]
- before_action :api_deny_access_handler
authorize_resource
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)
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
# into one place. as it turns out, the API methods for historical
# nodes, ways and relations are basically identical.
module Api
- class OldController < ApplicationController
+ class OldController < ApiController
require "xml/libxml"
- skip_before_action :verify_authenticity_token
before_action :setup_user_auth, :only => [:history, :version]
- before_action :api_deny_access_handler
before_action :authorize, :only => [:redact]
authorize_resource
module Api
- class PermissionsController < ApplicationController
- skip_before_action :verify_authenticity_token
- before_action :api_deny_access_handler
-
+ class PermissionsController < ApiController
authorize_resource :class => false
before_action :check_api_readable
module Api
- class RelationsController < ApplicationController
+ class RelationsController < ApiController
require "xml/libxml"
- skip_before_action :verify_authenticity_token
before_action :authorize, :only => [:create, :update, :delete]
- before_action :api_deny_access_handler
authorize_resource
module Api
- class SearchController < ApplicationController
+ class SearchController < ApiController
# Support searching for nodes, ways, or all
# Can search by tag k, v, or both (type->k,value->v)
# Can search by name (k=name,v=....)
- skip_before_action :verify_authenticity_token
authorize_resource :class => false
def search_all
module Api
- class SwfController < ApplicationController
- skip_before_action :verify_authenticity_token
+ class SwfController < ApiController
before_action :check_api_readable
authorize_resource :class => false
module Api
- class TracepointsController < ApplicationController
- skip_before_action :verify_authenticity_token
- before_action :api_deny_access_handler
-
+ class TracepointsController < ApiController
authorize_resource
before_action :check_api_readable
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
# 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
module Api
- class TracesController < ApplicationController
+ class TracesController < ApiController
layout "site", :except => :georss
- skip_before_action :verify_authenticity_token
before_action :authorize_web
before_action :set_locale
before_action :authorize
- before_action :api_deny_access_handler
authorize_resource
end
def offline_redirect
- redirect_to :action => :offline if STATUS == :gpx_offline
+ redirect_to :action => :offline if Settings.status == "gpx_offline"
end
end
end
# Update and read user preferences, which are arbitrayr key/val pairs
module Api
- class UserPreferencesController < ApplicationController
- skip_before_action :verify_authenticity_token
+ class UserPreferencesController < ApiController
before_action :authorize
authorize_resource
module Api
- class UsersController < ApplicationController
+ class UsersController < ApiController
layout "site", :except => [:api_details]
- skip_before_action :verify_authenticity_token
before_action :disable_terms_redirect, :only => [:api_details]
before_action :authorize, :only => [:api_details, :api_gpx_files]
- before_action :api_deny_access_handler
authorize_resource
module Api
- class WaysController < ApplicationController
+ class WaysController < ApiController
require "xml/libxml"
- skip_before_action :verify_authenticity_token
before_action :authorize, :only => [:create, :update, :delete]
- before_action :api_deny_access_handler
authorize_resource
--- /dev/null
+class ApiController < ApplicationController
+ skip_before_action :verify_authenticity_token
+
+ private
+
+ def authorize(realm = "Web Password", errormessage = "Couldn't authenticate you")
+ # make the current_user object from any auth sources we have
+ setup_user_auth
+
+ # handle authenticate pass/fail
+ unless current_user
+ # no auth, the user does not exist or the password was wrong
+ response.headers["WWW-Authenticate"] = "Basic realm=\"#{realm}\""
+ render :plain => errormessage, :status => :unauthorized
+ return false
+ end
+ end
+
+ def deny_access(_exception)
+ if current_token
+ set_locale
+ report_error t("oauth.permissions.missing"), :forbidden
+ elsif current_user
+ head :forbidden
+ else
+ realm = "Web Password"
+ errormessage = "Couldn't authenticate you"
+ response.headers["WWW-Authenticate"] = "Basic realm=\"#{realm}\""
+ render :plain => errormessage, :status => :unauthorized
+ end
+ end
+
+ def gpx_status
+ status = database_status
+ status = "offline" if status == "online" && Settings.status == "gpx_offline"
+ status
+ end
+
+ ##
+ # sets up the current_user for use by other methods. this is mostly called
+ # from the authorize method, but can be called elsewhere if authorisation
+ # is optional.
+ def setup_user_auth
+ # try and setup using OAuth
+ unless Authenticator.new(self, [:token]).allow?
+ username, passwd = get_auth_data # parse from headers
+ # authenticate per-scheme
+ self.current_user = if username.nil?
+ nil # no authentication provided - perhaps first connect (client should retry after 401)
+ elsif username == "token"
+ User.authenticate(:token => passwd) # preferred - random token for user from db, passed in basic auth
+ else
+ User.authenticate(:username => username, :password => passwd) # basic auth
+ end
+ end
+
+ # have we identified the user?
+ if current_user
+ # check if the user has been banned
+ user_block = current_user.blocks.active.take
+ unless user_block.nil?
+ set_locale
+ if user_block.zero_hour?
+ report_error t("application.setup_user_auth.blocked_zero_hour"), :forbidden
+ else
+ report_error t("application.setup_user_auth.blocked"), :forbidden
+ end
+ end
+
+ # if the user hasn't seen the contributor terms then don't
+ # allow editing - they have to go to the web site and see
+ # (but can decline) the CTs to continue.
+ if !current_user.terms_seen && flash[:skip_terms].nil?
+ set_locale
+ report_error t("application.setup_user_auth.need_to_see_terms"), :forbidden
+ end
+ end
+ end
+end
attr_accessor :current_user
helper_method :current_user
+ private
+
def authorize_web
if session[:user]
self.current_user = User.where(:id => session[:user]).where("status IN ('active', 'confirmed', 'suspended')").first
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
##
end
end
- ##
- # sets up the current_user for use by other methods. this is mostly called
- # from the authorize method, but can be called elsewhere if authorisation
- # is optional.
- def setup_user_auth
- # try and setup using OAuth
- unless Authenticator.new(self, [:token]).allow?
- username, passwd = get_auth_data # parse from headers
- # authenticate per-scheme
- self.current_user = if username.nil?
- nil # no authentication provided - perhaps first connect (client should retry after 401)
- elsif username == "token"
- User.authenticate(:token => passwd) # preferred - random token for user from db, passed in basic auth
- else
- User.authenticate(:username => username, :password => passwd) # basic auth
- end
- end
-
- # have we identified the user?
- if current_user
- # check if the user has been banned
- user_block = current_user.blocks.active.take
- unless user_block.nil?
- set_locale
- if user_block.zero_hour?
- report_error t("application.setup_user_auth.blocked_zero_hour"), :forbidden
- else
- report_error t("application.setup_user_auth.blocked"), :forbidden
- end
- end
-
- # if the user hasn't seen the contributor terms then don't
- # allow editing - they have to go to the web site and see
- # (but can decline) the CTs to continue.
- if !current_user.terms_seen && flash[:skip_terms].nil?
- set_locale
- report_error t("application.setup_user_auth.need_to_see_terms"), :forbidden
- end
- end
- end
-
- def authorize(realm = "Web Password", errormessage = "Couldn't authenticate you")
- # make the current_user object from any auth sources we have
- setup_user_auth
-
- # handle authenticate pass/fail
- unless current_user
- # no auth, the user does not exist or the password was wrong
- response.headers["WWW-Authenticate"] = "Basic realm=\"#{realm}\""
- render :plain => errormessage, :status => :unauthorized
- return false
- end
- end
-
def check_database_readable(need_api = false)
- if STATUS == :database_offline || (need_api && STATUS == :api_offline)
+ if Settings.status == "database_offline" || (need_api && Settings.status == "api_offline")
if request.xhr?
report_error "Database offline for maintenance", :service_unavailable
else
end
def check_database_writable(need_api = false)
- if STATUS == :database_offline || STATUS == :database_readonly ||
- (need_api && (STATUS == :api_offline || STATUS == :api_readonly))
+ if Settings.status == "database_offline" || Settings.status == "database_readonly" ||
+ (need_api && (Settings.status == "api_offline" || Settings.status == "api_readonly"))
if request.xhr?
report_error "Database offline for maintenance", :service_unavailable
else
end
def check_api_readable
- if api_status == :offline
+ if api_status == "offline"
report_error "Database offline for maintenance", :service_unavailable
false
end
end
def check_api_writable
- unless api_status == :online
+ unless api_status == "online"
report_error "Database offline for maintenance", :service_unavailable
false
end
end
def database_status
- if STATUS == :database_offline
- :offline
- elsif STATUS == :database_readonly
- :readonly
+ if Settings.status == "database_offline"
+ "offline"
+ elsif Settings.status == "database_readonly"
+ "readonly"
else
- :online
+ "online"
end
end
def api_status
status = database_status
- if status == :online
- if STATUS == :api_offline
- status = :offline
- elsif STATUS == :api_readonly
- status = :readonly
+ if status == "online"
+ if Settings.status == "api_offline"
+ status = "offline"
+ elsif Settings.status == "api_readonly"
+ status = "readonly"
end
end
status
end
- def gpx_status
- status = database_status
- status = :offline if status == :online && STATUS == :gpx_offline
- status
- end
-
def require_public_data
unless current_user.data_public?
report_error "You must make your edits public to upload new data", :forbidden
##
# 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
##
# 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
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']
)
- if STATUS == :database_offline || STATUS == :api_offline
+ if Settings.status == "database_offline" || Settings.status == "api_offline"
flash.now[:warning] = t("layouts.osm_offline")
- elsif STATUS == :database_readonly || STATUS == :api_readonly
+ elsif Settings.status == "database_readonly" || Settings.status == "api_readonly"
flash.now[:warning] = t("layouts.osm_read_only")
end
elsif current_user&.preferred_editor
current_user.preferred_editor
else
- DEFAULT_EDITOR
+ Settings.default_editor
end
editor
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
}
end
end
- def deny_access(exception)
- if @api_deny_access_handling
- api_deny_access(exception)
- else
- web_deny_access(exception)
- end
- end
-
- def web_deny_access(_exception)
+ def deny_access(_exception)
if current_token
set_locale
report_error t("oauth.permissions.missing"), :forbidden
end
end
- def api_deny_access(_exception)
- if current_token
- set_locale
- report_error t("oauth.permissions.missing"), :forbidden
- elsif current_user
- head :forbidden
- else
- realm = "Web Password"
- errormessage = "Couldn't authenticate you"
- response.headers["WWW-Authenticate"] = "Basic realm=\"#{realm}\""
- render :plain => errormessage, :status => :unauthorized
- end
- end
-
- attr_accessor :api_access_handling
-
- def api_deny_access_handler
- @api_deny_access_handling = true
- end
-
- private
-
# extract authorisation credentials from headers, returns user = nil if none
def get_auth_data
if request.env.key? "X-HTTP_AUTHORIZATION" # where mod_rewrite might have put it
before_action :authorize_web
before_action :set_locale
- before_action(:except => [:query]) { |c| c.check_database_readable(true) }
+ before_action -> { check_database_readable(true) }
before_action :require_oauth
around_action :web_timeout
authorize_resource :class => false
authorize_resource
- before_action(:only => [:index]) { |c| c.check_database_readable(true) }
+ before_action -> { check_database_readable(true) }
around_action :web_timeout
##
skip_before_action :verify_authenticity_token, :except => [:index]
before_action :authorize_web
before_action :set_locale
+ before_action -> { check_database_readable(true) }, :only => [:index, :feed]
authorize_resource
- before_action(:only => [:index, :feed]) { |c| c.check_database_readable(true) }
around_action :web_timeout
# Helper methods for checking consistency
before_action :authorize_web
before_action :set_locale
+ before_action :check_database_readable
authorize_resource
before_action :lookup_user, :only => [:show, :comments]
- before_action :check_database_readable
before_action :check_database_writable, :only => [:new, :edit, :comment, :hide, :hidecomment, :subscribe, :unsubscribe]
before_action :allow_thirdparty_images, :only => [:new, :edit, :index, :show, :comments]
@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
@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
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].match?(/^\d{5}(-\d{4})?$/)
@sources.push "osm_nominatim"
@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
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
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"]
@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|
country = geoname.text("countryName")
@results.push(:lat => lat, :lon => lon,
- :zoom => GEONAMES_ZOOM,
+ :zoom => Settings.geonames_zoom,
:name => name,
:suffix => ", #{country}")
end
@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|
@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|
country = geoname.text("countryName")
@results.push(:lat => lat, :lon => lon,
- :zoom => GEONAMES_ZOOM,
+ :zoom => Settings.geonames_zoom,
:name => name,
:suffix => ", #{country}")
end
@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
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"
authorize_resource :class => false
def index
- session[:location] ||= OSM.ip_location(request.env["REMOTE_ADDR"]) unless STATUS == :database_readonly || STATUS == :database_offline
+ session[:location] ||= OSM.ip_location(request.env["REMOTE_ADDR"]) unless Settings.status == "database_readonly" || Settings.status == "database_offline"
end
def permalink
before_action :authorize_web
before_action :set_locale
+ before_action :check_database_readable
authorize_resource
- before_action :check_database_readable
before_action :check_database_writable, :only => [:new, :create, :edit, :delete]
before_action :offline_warning, :only => [:mine, :show]
before_action :offline_redirect, :only => [:new, :create, :edit, :delete, :data]
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?
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
end
def offline_warning
- flash.now[:warning] = t "traces.offline_warning.message" if STATUS == :gpx_offline
+ flash.now[:warning] = t "traces.offline_warning.message" if Settings.status == "gpx_offline"
end
def offline_redirect
- redirect_to :action => :offline if STATUS == :gpx_offline
+ redirect_to :action => :offline if Settings.status == "gpx_offline"
end
def default_visibility
before_action :disable_terms_redirect, :only => [:terms, :save, :logout]
before_action :authorize_web
before_action :set_locale
+ before_action :check_database_readable
authorize_resource
before_action :require_self, :only => [:account]
- before_action :check_database_readable, :except => [:login]
before_action :check_database_writable, :only => [:new, :account, :confirm, :confirm_email, :lost_password, :reset_password, :go_public, :make_friend, :remove_friend]
before_action :require_cookies, :only => [:new, :login, :confirm]
before_action :lookup_user_by_name, :only => [:set_status, :delete]
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?
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"
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
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
# 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"
class TraceDestroyerJob < ApplicationJob
- queue_as :default
+ queue_as :traces
def perform(trace)
trace.destroy
class TraceImporterJob < ApplicationJob
- queue_as :default
+ queue_as :traces
def perform(trace)
gpx = trace.import
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
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
end
end
- def to_xml(include_discussion = false)
- doc = OSM::API.new.get_xml_doc
- doc.root << to_xml_node(nil, include_discussion)
- doc
- end
-
- def to_xml_node(user_display_name_cache = nil, include_discussion = false)
- el1 = XML::Node.new "changeset"
- el1["id"] = id.to_s
-
- user_display_name_cache = {} if user_display_name_cache.nil?
-
- if user_display_name_cache&.key?(user_id)
- # use the cache if available
- elsif user.data_public?
- user_display_name_cache[user_id] = user.display_name
- else
- user_display_name_cache[user_id] = nil
- end
-
- el1["user"] = user_display_name_cache[user_id] unless user_display_name_cache[user_id].nil?
- el1["uid"] = user_id.to_s if user.data_public?
-
- tags.each do |k, v|
- el2 = XML::Node.new("tag")
- el2["k"] = k.to_s
- el2["v"] = v.to_s
- el1 << el2
- end
-
- el1["created_at"] = created_at.xmlschema
- el1["closed_at"] = closed_at.xmlschema unless is_open?
- el1["open"] = is_open?.to_s
-
- bbox.to_unscaled.add_bounds_to(el1, "_") if bbox.complete?
-
- el1["comments_count"] = comments.length.to_s
- el1["changes_count"] = num_changes.to_s
-
- if include_discussion
- el2 = XML::Node.new("discussion")
- comments.includes(:author).each do |comment|
- el3 = XML::Node.new("comment")
- el3["date"] = comment.created_at.xmlschema
- el3["uid"] = comment.author.id.to_s if comment.author.data_public?
- el3["user"] = comment.author.display_name.to_s if comment.author.data_public?
- el4 = XML::Node.new("text")
- el4.content = comment.body.to_s
- el3 << el4
- el2 << el3
- end
- el1 << el2
- end
-
- # NOTE: changesets don't include the XML of the changes within them,
- # they are just structures for tagging. to get the osmChange of a
- # changeset, see the download method of the controller.
-
- el1
- end
-
##
# update this instance from another instance given and the user who is
# doing the updating. note that this method is not for updating the
end
def oauth_server
- @oauth_server ||= OAuth::Server.new("https://" + SERVER_URL)
+ @oauth_server ||= OAuth::Server.new("https://" + Settings.server_url)
end
def credentials
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
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
# If there are any existing points for this trace then delete them
Tracepoint.where(:gpx_id => id).delete_all
- gpx.points do |point|
- if first
- f_lat = point.latitude
- f_lon = point.longitude
- first = false
+ gpx.points.each_slice(1_000) do |points|
+ # Gather the trace points together for a bulk import
+ tracepoints = []
+
+ points.each do |point|
+ if first
+ f_lat = point.latitude
+ f_lon = point.longitude
+ first = false
+ end
+
+ tp = Tracepoint.new
+ tp.lat = point.latitude
+ tp.lon = point.longitude
+ tp.altitude = point.altitude
+ tp.timestamp = point.timestamp
+ tp.gpx_id = id
+ tp.trackid = point.segment
+ tracepoints << tp
end
- tp = Tracepoint.new
- tp.lat = point.latitude
- tp.lon = point.longitude
- tp.altitude = point.altitude
- tp.timestamp = point.timestamp
- tp.gpx_id = id
- tp.trackid = point.segment
- tp.save!
+ # Run the before_save and before_create callbacks, and then import them in bulk with activerecord-import
+ tracepoints.each do |tp|
+ tp.run_callbacks(:save) { false }
+ tp.run_callbacks(:create) { false }
+ end
+
+ Tracepoint.import!(tracepoints)
end
if gpx.actual_points.positive?
@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_")
##
# 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
##
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
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.
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
--- /dev/null
+# basic attributes
+
+attrs = {
+ "id" => changeset.id,
+ "created_at" => changeset.created_at.xmlschema,
+ "open" => changeset.is_open?,
+ "comments_count" => changeset.comments.length,
+ "changes_count" => changeset.num_changes
+}
+attrs["closed_at"] = changeset.closed_at unless changeset.is_open?
+changeset.bbox.to_unscaled.add_bounds_to(attrs, "_") if changeset.bbox.complete?
+
+# user attributes
+
+if changeset.user.data_public?
+ attrs["uid"] = changeset.user_id
+ attrs["user"] = changeset.user.display_name
+end
+
+xml.changeset(attrs) do |changeset_xml_node|
+ changeset.tags.each do |k, v|
+ changeset_xml_node.tag(:k => k, :v => v)
+ end
+
+ # include discussion if requested
+
+ if @include_discussion
+ changeset_xml_node.discussion do |discussion_xml_node|
+ changeset.comments.includes(:author).each do |comment|
+ cattrs = {
+ "date" => comment.created_at.xmlschema
+ }
+ if comment.author.data_public?
+ cattrs["uid"] = comment.author.id
+ cattrs["user"] = comment.author.display_name
+ end
+ discussion_xml_node.comment(cattrs) do |comment_xml_node|
+ comment_xml_node.text(comment.body)
+ end
+ end
+ end
+ end
+end
--- /dev/null
+xml.instruct! :xml, :version => "1.0"
+
+# basic attributes
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+ osm << render(:partial => "api/changesets/changeset.builder", :locals => { :changeset => @changeset })
+end
--- /dev/null
+xml.instruct! :xml, :version => "1.0"
+
+# basic attributes
+
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
+ @changesets.each do |changeset|
+ osm << render(:partial => "api/changesets/changeset.builder", :locals => { :changeset => changeset })
+ end
+end
<%= 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." }) %>
<li id="compact-secondary-nav" class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><%= t 'layouts.more' %> <b class="caret"></b></a>
<ul class="dropdown-menu">
- <% if can? :index, Issue %>
+ <% if Settings.status != "database_offline" && can?(:index, Issue) %>
<li class="<%= current_page_class(issues_path) %>">
<%= link_to issues_path(:status => 'open') do %>
<%= open_issues_count %>
<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>
<%= 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' %>
<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>
<%= fp(t(".greeting")) %>
-<%= fp(t(".created", :site_url => SERVER_URL)) %>
+<%= fp(t(".created", :site_url => Settings.server_url)) %>
<%= fp(t(".confirm")) %>
<%= 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] -%>
<% 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 -%>
<li><%= t ".legal_babble.contributors_nl_html", :locale => @locale %></li>
<li><%= t ".legal_babble.contributors_nz_html", :locale => @locale %></li>
<li><%= t ".legal_babble.contributors_si_html", :locale => @locale %></li>
+ <li><%= t ".legal_babble.contributors_es_html", :locale => @locale %></li>
<li><%= t ".legal_babble.contributors_za_html", :locale => @locale %></li>
<li><%= t ".legal_babble.contributors_gb_html", :locale => @locale %></li>
</ul>
<% content_for :content do %>
- <% if STATUS == :database_offline or STATUS == :api_offline %>
+ <% if Settings.status == "database_offline" or Settings.status == "api_offline" %>
<p><%= t 'layouts.osm_offline' %></p>
- <% elsif STATUS == :database_readonly or STATUS == :api_readonly %>
+ <% elsif Settings.status == "database_readonly" or Settings.status == "api_readonly" %>
<p><%= t 'layouts.osm_read_only' %></p>
<% elsif !current_user.data_public? %>
<p><%= t '.not_public' %></p>
</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 -%>
-<% if STATUS == :database_offline %>
+<% if Settings.status == "database_offline" %>
<p><%= t 'layouts.osm_offline' %>
</p>
<% else %>
<tr>
<% cl = cycle('table0', 'table1') %>
<td class="<%= cl %>">
- <% if STATUS != :gpx_offline %>
+ <% if Settings.status != "gpx_offline" %>
<% if trace.inserted %>
<a href="<%= url_for :controller => 'traces', :action => 'show', :id => trace.id, :display_name => trace.user.display_name %>"><img src="<%= url_for :controller => 'traces', :action => 'icon', :id => trace.id, :display_name => trace.user.display_name %>" border="0" alt="" /></a>
<% else %>
<h2><%= t '.heading', :name => h(@trace.name) %></h2>
<% end %>
-<% if STATUS != :gpx_offline %>
+<% if Settings.status != "gpx_offline" %>
<% if @trace.inserted %>
<img src="<%= url_for :controller => 'traces', :action => 'picture', :id => @trace.id, :display_name => @trace.user.display_name %>">
<% else %>
</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>
<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>
<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>
<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}") %>
-application.yml
database.yml
require_relative "boot"
-require_relative "preinitializer"
-
-if STATUS == :database_offline
+if ENV["OPENSTREETMAP_STATUS"] == "database_offline"
+ require "active_model/railtie"
+ require "active_job/railtie"
+ require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
- require "active_model/railtie"
+ require "action_view/railtie"
+ require "action_cable/engine"
require "sprockets/railtie"
require "rails/test_unit/railtie"
else
# This defaults to true from rails 5.0 but our code doesn't comply
# with it at all so we turn it off
- config.active_record.belongs_to_required_by_default = false
+ config.active_record.belongs_to_required_by_default = false unless Settings.status == "database_offline"
# Use SQL instead of Active Record's schema dumper when creating the database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
- config.active_record.schema_format = :sql unless STATUS == :database_offline
+ config.active_record.schema_format = :sql unless Settings.status == "database_offline"
# Don't eager load models when the database is offline
- config.paths["app/models"].skip_eager_load! if STATUS == :database_offline
+ config.paths["app/models"].skip_eager_load! if Settings.status == "database_offline"
# Use memcached for caching if required
- config.cache_store = :mem_cache_store, MEMCACHE_SERVERS, { :namespace => "rails:cache" } if defined?(MEMCACHE_SERVERS)
+ config.cache_store = :mem_cache_store, Settings.memcache_servers, { :namespace => "rails:cache" } if Settings.key?(:memcache_servers)
# Use logstash for logging if required
- if defined?(LOGSTASH_PATH)
+ if Settings.key?(:logstash_path)
config.logstasher.enabled = true
config.logstasher.suppress_app_log = false
- config.logstasher.logger_path = LOGSTASH_PATH
+ config.logstasher.logger_path = Settings.logstash_path
config.logstasher.log_controller_parameters = true
end
end
link: https://2018.stateofthemap.org/
img: banners/sotm2018.png
enddate: 2018-jul-30
+saveyourinternet:
+ id: saveyourinternet
+ alt: "The EU Copyright Directive threatens free content on the Internet and OpenStreetMap. Demonstrations in various European cities on 23 March. https://savetheinternet.info/demos"
+ link: https://savetheinternet.info/demos
+ img: banners/saveyourinternet.png
+ enddate: 2019-mar-26
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
- config.active_record.migration_error = :page_load unless STATUS == :database_offline
+ config.active_record.migration_error = :page_load unless Settings.status == "database_offline"
# Highlight code that triggered database queries in logs.
- config.active_record.verbose_query_logs = true
+ config.active_record.verbose_query_logs = true unless Settings.status == "database_offline"
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
config.log_tags = [:request_id]
# Use a different log path in production.
- config.paths["log"] = LOG_PATH if defined?(LOG_PATH)
+ config.paths["log"] = Settings.log_path if Settings.key?(:log_path)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
end
# Do not dump schema after migrations.
- config.active_record.dump_schema_after_migration = false unless STATUS == :database_offline
+ config.active_record.dump_schema_after_migration = false unless Settings.status == "database_offline"
# Enable autoloading of dependencies.
config.enable_dependency_loading = true
+++ /dev/null
-defaults: &defaults
- # The server protocol and host
- server_protocol: "http"
- server_url: "openstreetmap.example.com"
- # Publisher
- #publisher_url: ""
- # The generator
- generator: "OpenStreetMap server"
- copyright_owner: "OpenStreetMap and contributors"
- attribution_url: "http://www.openstreetmap.org/copyright"
- license_url: "http://opendatacommons.org/licenses/odbl/1-0/"
- # Support email address
- support_email: "openstreetmap@example.com"
- # Sender addresses for emails
- email_from: "OpenStreetMap <openstreetmap@example.com>"
- email_return_path: "openstreetmap@example.com"
- # API version
- api_version: "0.6"
- # Application status - possible values are:
- # :online - online and operating normally
- # :api_readonly - site online but API in read-only mode
- # :api_offline - site online but API offline
- # :database_readonly - database and site in read-only mode
- # :database_offline - database offline with site in emergency mode
- # :gpx_offline - gpx storage offline
- status: :online
- # The maximum area you're allowed to request, in square degrees
- max_request_area: 0.25
- # Number of GPS trace/trackpoints returned per-page
- tracepoints_per_page: 5000
- # Maximum number of nodes that will be returned by the api in a map request
- max_number_of_nodes: 50000
- # Maximum number of nodes that can be in a way (checked on save)
- max_number_of_way_nodes: 2000
- # The maximum area you're allowed to request notes from, in square degrees
- max_note_request_area: 25
- # Zoom level to use for postcode results from the geocoder
- postcode_zoom: 15
- # Zoom level to use for geonames results from the geocoder
- geonames_zoom: 12
- # Timeout for API calls in seconds
- api_timeout: 300
- # Timeout for web pages in seconds
- web_timeout: 30
- # Periods (in hours) which are allowed for user blocks
- user_block_periods: [0, 1, 3, 6, 12, 24, 48, 96]
- # Rate limit for message sending
- max_messages_per_hour: 60
- # Domain for handling message replies
- #messages_domain: "messages.openstreetmap.org"
- # Geonames authentication details
- #geonames_username: ""
- # GeoIP database
- #geoip_database: ""
- # Users to show as being nearby
- nearby_users: 30
- # Max radius, in km, for nearby users
- nearby_radius: 50
- # Spam threshold
- spam_threshold: 50
- # Default legale (jurisdiction location) for contributor terms
- default_legale: GB
- # Use the built-in jobs queue for importing traces
- # Leave as false if you are using the external high-speed gpx importer
- # https://github.com/openstreetmap/gpx-import
- trace_use_job_queue: false
- # Location of GPX traces and images
- gpx_trace_dir: "/home/osm/traces"
- gpx_image_dir: "/home/osm/images"
- # Location of data for attachments
- attachments_dir: ":rails_root/public/attachments"
- # Log file to use
- #log_path: ""
- # Log file to use for logstash
- #logstash_path: ""
- # List of memcache servers to use for caching
- #memcache_servers: []
- # Enable legacy OAuth 1.0 support
- oauth_10_support: true
- # URL of Nominatim instance to use for geocoding
- nominatim_url: "https://nominatim.openstreetmap.org/"
- # Default editor
- default_editor: "id"
- # OAuth consumer key for Potlatch 2
- #potlatch2_key: ""
- # OAuth consumer key for the web site
- #oauth_key: ""
- # OAuth consumer key for iD
- #id_key: ""
- # Imagery to return in capabilities as blacklisted
- imagery_blacklist:
- # Current Google imagery URLs have google or googleapis in the domain
- # with a vt or kh endpoint, and x, y and z query parameters
- - ".*\\.google(apis)?\\..*/(vt|kh)[\\?/].*([xyz]=.*){3}.*"
- # Blacklist VWorld
- - "http://xdworld\\.vworld\\.kr:8080/.*"
- # Blacklist here
- - ".*\\.here\\.com[/:].*"
- # URL of Overpass instance to use for feature queries
- overpass_url: "https://overpass-api.de/api/interpreter"
- # Routing endpoints
- graphhopper_url: "https://graphhopper.com/api/1/route"
- fossgis_osrm_url: "https://routing.openstreetmap.de/"
- # External authentication credentials
- #google_auth_id: ""
- #google_auth_secret: ""
- #google_openid_realm: ""
- #facebook_auth_id: ""
- #facebook_auth_secret: ""
- #windowslive_auth_id: ""
- #windowslive_auth_secret: ""
- #github_auth_id: ""
- #github_auth_secret: ""
- #wikipedia_auth_id: ""
- #wikipedia_auth_secret: ""
- # Thunderforest authentication details
- #thunderforest_key: ""
- # Key for generating TOTP tokens
- #totp_key: ""
- # Enforce Content-Security-Policy
- csp_enforce: false
- # URL for reporting Content-Security-Policy violations
- #csp_report_url: ""
-
-development:
- <<: *defaults
-
-production:
- <<: *defaults
-
-test:
- <<: *defaults
- # Geonames credentials for testing
- geonames_username: "dummy"
- # External authentication credentials for testing
- google_auth_id: "dummy"
- google_auth_secret: "dummy"
- google_openid_realm: "https://www.openstreetmap.org"
- facebook_auth_id: "dummy"
- facebook_auth_secret: "dummy"
- windowslive_auth_id: "dummy"
- windowslive_auth_secret: "dummy"
- github_auth_id: "dummy"
- github_auth_secret: "dummy"
- wikipedia_auth_id: "dummy"
- wikipedia_auth_secret: "dummy"
# Set the host and protocol for all ActionMailer URLs
ActionMailer::Base.default_url_options = {
- :host => SERVER_URL,
- :protocol => SERVER_PROTOCOL
+ :host => Settings.server_url,
+ :protocol => Settings.server_protocol
}
CanonicalRails.setup do |config|
# Force the protocol. If you do not specify, the protocol will be based on the incoming request's protocol.
- config.protocol = "#{SERVER_PROTOCOL}://"
+ config.protocol = "#{Settings.server_protocol}://"
# This is the main host, not just the TLD, omit slashes and protocol. If you have more than one, pick the one you want to rank in search results.
- config.host = SERVER_URL
- config.port = SERVER_PROTOCOL == "https" ? 443 : 80
+ config.host = Settings.server_url
+ config.port = Settings.server_protocol == "https" ? 443 : 80
# http://en.wikipedia.org/wiki/URL_normalization
# Trailing slash represents semantics of a directory, ie a collection view - implying an :index get route;
--- /dev/null
+# Guard against deployments with old-style application.yml configurations
+# Otherwise, admins might not be aware that they are now silently ignored
+# and major problems could occur
+# rubocop:disable Rails/Output, Rails/Exit
+if File.exist?(Rails.root.join("config", "application.yml"))
+ puts "The config/application.yml file is no longer supported."
+ puts ""
+ puts "Default settings are now found in config/settings.yml and you"
+ puts "can override these in config/settings.local.yml."
+ puts ""
+ puts "To prevent unexpected behaviour, please copy any custom"
+ puts "settings to config/settings.local.yml and then remove"
+ puts "your config/application.yml file."
+ exit!
+end
+# rubocop:enable Rails/Output, Rails/Exit
+
+# Allowed status values
+ALLOWED_STATUS ||= [
+ "online", # online and operating normally
+ "api_readonly", # site online but API in read-only mode
+ "api_offline", # site online but API offline
+ "database_readonly", # database and site in read-only mode
+ "database_offline", # database offline with site in emergency mode
+ "gpx_offline" # gpx storage offline
+].freeze
+
+Config.setup do |config|
+ # Name of the constant exposing loaded settings
+ config.const_name = "Settings"
+
+ # Ability to remove elements of the array set in earlier loaded settings file. For example value: '--'.
+ #
+ # config.knockout_prefix = nil
+
+ # Overwrite an existing value when merging a `nil` value.
+ # When set to `false`, the existing value is retained after merge.
+ #
+ # config.merge_nil_values = true
+
+ # Overwrite arrays found in previously loaded settings file. When set to `false`, arrays will be merged.
+ #
+ # config.overwrite_arrays = true
+
+ # Load environment variables from the `ENV` object and override any settings defined in files.
+ #
+ config.use_env = true
+
+ # Define ENV variable prefix deciding which variables to load into config.
+ #
+ config.env_prefix = "OPENSTREETMAP"
+
+ # What string to use as level separator for settings loaded from ENV variables. Default value of '.' works well
+ # with Heroku, but you might want to change it for example for '__' to easy override settings from command line, where
+ # using dots in variable names might not be allowed (eg. Bash).
+ #
+ config.env_separator = "_"
+
+ # Ability to process variables names:
+ # * nil - no change
+ # * :downcase - convert to lower case
+ #
+ config.env_converter = :downcase
+
+ # Parse numeric values as integers instead of strings.
+ #
+ # config.env_parse_values = true
+
+ # Validate presence and type of specific config values. Check https://github.com/dry-rb/dry-validation for details.
+ #
+ config.schema do
+ required(:api_version).filled(:str?)
+ required(:max_request_area).filled(:number?)
+ required(:max_note_request_area).filled(:number?)
+ required(:tracepoints_per_page).filled(:int?)
+ required(:max_number_of_way_nodes).filled(:int?)
+ required(:api_timeout).filled(:int?)
+ required(:imagery_blacklist).maybe(:array?)
+ required(:status).filled(:str?, :included_in? => ALLOWED_STATUS)
+ end
+end
OmniAuth.config.logger = Rails.logger
OmniAuth.config.failure_raise_out_environments = []
-if defined?(MEMCACHE_SERVERS)
+if Settings.key?(:memcache_servers)
require "openid/store/memcache"
- openid_store = OpenID::Store::Memcache.new(Dalli::Client.new(MEMCACHE_SERVERS, :namespace => "rails"))
+ openid_store = OpenID::Store::Memcache.new(Dalli::Client.new(Settings.memcache_servers, :namespace => "rails"))
else
require "openid/store/filesystem"
github_options = { :name => "github", :scope => "user:email" }
wikipedia_options = { :name => "wikipedia", :client_options => { :site => "https://meta.wikimedia.org" } }
-google_options[:openid_realm] = GOOGLE_OPENID_REALM if defined?(GOOGLE_OPENID_REALM)
+google_options[:openid_realm] = Settings.google_openid_realm if Settings.key?(:google_openid_realm)
Rails.application.config.middleware.use OmniAuth::Builder do
provider :openid, openid_options
- provider :google_oauth2, GOOGLE_AUTH_ID, GOOGLE_AUTH_SECRET, google_options if defined?(GOOGLE_AUTH_ID)
- provider :facebook, FACEBOOK_AUTH_ID, FACEBOOK_AUTH_SECRET, facebook_options if defined?(FACEBOOK_AUTH_ID)
- provider :windowslive, WINDOWSLIVE_AUTH_ID, WINDOWSLIVE_AUTH_SECRET, windowslive_options if defined?(WINDOWSLIVE_AUTH_ID)
- provider :github, GITHUB_AUTH_ID, GITHUB_AUTH_SECRET, github_options if defined?(GITHUB_AUTH_ID)
- provider :mediawiki, WIKIPEDIA_AUTH_ID, WIKIPEDIA_AUTH_SECRET, wikipedia_options if defined?(WIKIPEDIA_AUTH_ID)
+ provider :google_oauth2, Settings.google_auth_id, Settings.google_auth_secret, google_options if Settings.key?(:google_auth_id)
+ provider :facebook, Settings.facebook_auth_id, Settings.facebook_auth_secret, facebook_options if Settings.key?(:facebook_auth_id)
+ provider :windowslive, Settings.windowslive_auth_id, Settings.windowslive_auth_secret, windowslive_options if Settings.key?(:windowslive_auth_id)
+ provider :github, Settings.github_auth_id, Settings.github_auth_secret, github_options if Settings.key?(:github_auth_id)
+ provider :mediawiki, Settings.wikipedia_auth_id, Settings.wikipedia_auth_secret, wikipedia_options if Settings.key?(:wikipedia_auth_id)
end
end
Paperclip::Attachment.default_options[:url] = "/attachments/:class/:attachment/:id_partition/:style/:fingerprint.:extension"
-Paperclip::Attachment.default_options[:path] = "#{ATTACHMENTS_DIR}/:class/:attachment/:id_partition/:style/:fingerprint.:extension"
+Paperclip::Attachment.default_options[:path] = "#{Settings.attachments_dir}/:class/:attachment/:id_partition/:style/:fingerprint.:extension"
Paperclip::Attachment.default_options[:url_generator] = Paperclip::AssetUrlGenerator
csp_policy[:connect_src] << PIWIK["location"] if defined?(PIWIK)
csp_policy[:img_src] << PIWIK["location"] if defined?(PIWIK)
csp_policy[:script_src] << PIWIK["location"] if defined?(PIWIK)
-csp_policy[:report_uri] << CSP_REPORT_URL if defined?(CSP_REPORT_URL)
+csp_policy[:report_uri] << Settings.csp_report_url if Settings.key?(:csp_report_url)
cookie_policy = {
:secure => SecureHeaders::OPT_OUT,
SecureHeaders::Configuration.default do |config|
config.hsts = SecureHeaders::OPT_OUT
- if CSP_ENFORCE
+ if Settings.csp_enforce
config.csp = csp_policy
config.csp_report_only = SecureHeaders::OPT_OUT
- elsif defined?(CSP_REPORT_URL)
+ elsif Settings.key?(:csp_report_url)
config.csp = SecureHeaders::OPT_OUT
config.csp_report_only = csp_policy
else
# Be sure to restart your server when you modify this file.
-if defined?(MEMCACHE_SERVERS)
- Rails.application.config.session_store :mem_cache_store, :memcache_server => MEMCACHE_SERVERS, :namespace => "rails:session", :key => "_osm_session"
+if Settings.key?(:memcache_servers)
+ Rails.application.config.session_store :mem_cache_store, :memcache_server => Settings.memcache_servers, :namespace => "rails:session", :key => "_osm_session"
else
Rails.application.config.session_store :cache_store, :key => "_osm_session", :cache => ActiveSupport::Cache::MemoryStore.new
end
<a href="http://www.gu.gov.si/en/"> Authority Survey and Mapping Authority </a> and
<a href="http://www.mkgp.gov.si/en/"> وزارة الزراعة والغابات والأغذية </a>
(معلومات عامة من سلوفينيا).
+ contributors_es_html: |-
+ <strong>es </strong>: تحتوي على بيانات مصدرها
+ المعهد الجغرافي الوطني الإسباني (<a href="http://www.ign.es/">IGN</a>) و
+ النظام الوطني لرسم الخرائط (<a href="http://www.scne.es/">SCNE</a>)
+ مرخصة لإعادة الاستخدام بموجب <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.
contributors_za_html: |-
<strong> جنوب إفريقيا </ strong>: يحتوي على بيانات مصدرها
<a href="http://www.ngi.gov.za/"> المديرية العامة:
logo:
alt_text: شعار خريطه الشارع المفتوحة
home: روح للصفحه الرئيسيه
- logout: اخرج
+ logout: خرÙ\88ج
log_in: تسجيل الدخول
log_in_tooltip: سجّل الدخول مع حساب موجود
sign_up: اعمل حساب
National Geo-Spatial Information</a>, State copyright reserved.
contributors_gb_html: |-
<strong>Rouantelezh-Unanet</strong> : Ennañ roadennoù eus Ordnance
- Survey data © Crown copyright and database right 2010-12.
+ Survey data © Crown copyright and database right 2010-19.
contributors_footer_1_html: |-
↓Evit muioc'h a vunudoù diwar-benn ar re-se, hag ar mammennoù all a zo bet implijet da sikour da wellaat OpenStreetMap, sellit ouzh ar <a
href="https://wiki.openstreetmap.org/wiki/Contributors">Bajenn Skoazellerien</a> e Wiki OpenStreetMap.
contributors_si_html: '<strong>Slovinsko</strong>: Obsahuje data <a href="http://www.gu.gov.si/">Zeměměřického
a mapovacího úřadu</a> a <a href="http://www.mkgp.gov.si/">Ministerstva
zemědělství, lesnictví a potravin</a> (veřejné informace o Slovinsku).'
+ contributors_es_html: '<strong>Španělsko</strong>: Obsahuje data od španělského
+ Národního geografického institutu (<a href="http://www.ign.es/">IGN</a>
+ a Národního kartografického systému (<a href="http://www.scne.es/">SCNE</a>),
+ licencovaná pod <a href="https://creativecommons.org/licenses/by/4.0/deed.cs">CC
+ BY 4.0</a>.'
contributors_za_html: |-
<strong>Jihoafrická republika</strong>: Obsahuje data pocházející z <a href="http://www.ngi.gov.za/">Chief Directorate:
National Geo-Spatial Information</a>, State copyright reserved.
contributors_gb_html: '<strong>Spojené království</strong>: Obsahuje data
- Ordnance Survey © Crown copyright a právo k databázi 2010–12.'
+ Ordnance Survey © Crown copyright a právo k databázi 2010–19.'
contributors_footer_1_html: |-
Další podrobnosti o těchto a dalších zdrojích, které se používaly pro vylepšení OpenStreetMap, najdete na <a
href="https://wiki.openstreetmap.org/wiki/Contributors">stránce Contributors</a> na wiki OpenStreetMap.
activerecord:
errors:
messages:
- invalid_email_address: scheint keine gültige E-Mail-Adresse zu sein
+ invalid_email_address: Die eingegebene E-Mail-Adresse scheint nicht gültig
+ zu sein.
email_address_not_routable: ist nicht routbar
models:
acl: Zugangskontrollliste
<a href="http://www.gu.gov.si/en/">Vermessungs- und Kartierungsbehörde</a> sowie dem
<a href="http://www.mkgp.gov.si/en/">Ministerium für Landwirtschaft, Forsten und Ernährung</a>
(öffentliche Informationen von Slowenien).
+ contributors_es_html: |-
+ <strong>Spanien</strong>: Enthält Daten des
+ spanischen nationalen geografischen Instituts (<a href="http://www.ign.es/">IGN</a>) und
+ nationalen kartografischen Systems (<a href="http://www.scne.es/">SCNE</a>),
+ lizenziert zur Weiterverwendung unter <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.
contributors_za_html: '<strong>Südafrika</strong>: Enthält Daten von <i><a
href="http://www.ngi.gov.za/">Chief Directorate: National Geo-Spatial Information</a></i>,
Staatliches Urheberrecht vorbehalten.'
continue: Qeyd be
terms:
consider_pd_why: no çıko?
- agree: Qebul kena
+ agree: Qebul ke
decline: Red kerê
legale_names:
france: Fransa
<a href="http://www.gu.gov.si/en/">Surveying and Mapping Authority</a> and
<a href="http://www.mkgp.gov.si/en/">Ministry of Agriculture, Forestry and Food</a>
(public information of Slovenia).
+ contributors_es_html: |
+ <strong>Spain</strong>: Contains data sourced from the
+ Spanish National Geographic Institute (<a href="http://www.ign.es/">IGN</a>) and
+ National Cartographic System (<a href="http://www.scne.es/">SCNE</a>)
+ licensed for reuse under <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.
contributors_za_html: |
<strong>South Africa</strong>: Contains data sourced from
<a href="http://www.ngi.gov.za/">Chief Directorate:
<strong>Slovenujo</strong>: enhavas datumojn el <a href="http://www.gu.gov.si/">Ofico de Termezurado kaj Kartografio</a> kaj
<a href="http://www.mkgp.gov.si/">Ministerio pri Terkulturo, Arbarkulturo kaj Proviantado</a>
(publikaj informoj de Slovenujo).
+ contributors_es_html: '<strong>Hispanujo</strong>: enhavas datumojn el la
+ Hispana Nacia Geografia Instituto (<a href="http://www.ign.es/">IGN</a>
+ kaj Nacia Kartografia Sistemo (<a href="http://www.scne.es/">SCNE</a>) uzeblaj
+ laŭ la permesilo <a href="https://creativecommons.org/licenses/by/4.0/deed.eo">CC
+ BY 4.0</a>.'
contributors_za_html: |-
<strong>Sud-Afriko</strong>: enhavas datumojn ricevitajn el <a href="http://www.ngi.gov.za/">Chief Directorate:
National Geo-Spatial Information</a>, landaj kopirajtoj rezervitaj.
contributors_gb_html: |-
<strong>Unuiĝinta Reĝlando</strong>: enhavas datumojn el 'Ordnance
Survey' © Crown copyright and database right
- 2010-12.
+ 2010 - 2019.
contributors_footer_1_html: |-
Por pli da detaloj pri tiuj ĉi kaj aliaj fontoj uzitaj por plibonigi OpenStreetMap, bonvolu viziti la <a
href="https://wiki.openstreetmap.org/wiki/Contributors">paĝon pri kontribuintoj</a> en la OpenStreetMap-vikio.
# Author: Johnarupire
# Author: Jynus
# Author: KATRINE1992
+# Author: Kresp0
# Author: Ktranz
# Author: La Mantis
# Author: Larjona
<a href="http://www.gu.gov.si/en/">Surveying and Mapping Authority</a> y
<a href="http://www.mkgp.gov.si/en/">Ministry of Agriculture, Forestry and Food</a>
(información pública de Eslovenia).
+ contributors_es_html: '<strong>España</strong>: Contiene datos provenientes
+ del Instituto Geográfico Nacional (<a href="http://www.ign.es/">IGN</a>)
+ y del Sistema Cartográfico Nacional (<a href="http://www.scne.es/">SCNE</a>),
+ licenciados para su reutilización bajo la <a href="https://creativecommons.org/licenses/by/4.0/">CC
+ BY 4.0</a>.'
contributors_za_html: |-
<strong>Sudáfrica</strong>: Contiene datos extraídos de
<a href="http://www.ngi.gov.za/">Chief Directorate: Información
Nacional Geoespacial</a>, State copyright reserved.
contributors_gb_html: |-
<strong>Reino Unido</strong>: Contiene datos de Ordnance Survey © Crown copyright and database right
- 2010-12.
+ 2010-19.
contributors_footer_1_html: Para obtener más detalles sobre estas y otras
fuentes que se han utilizado para ayudar a mejorar OpenStreetMap, véase
la <a href="https://wiki.openstreetmap.org/wiki/Contributors">página de
# Author: Asieriko
# Author: EukeneFL
# Author: Gorkaazk
+# Author: Ibai
# Author: Iñaki LL
# Author: Maite
# Author: Mikel Ibaiba
formats:
friendly: '%e %B %Y %H:%M-ean'
activerecord:
+ errors:
+ messages:
+ invalid_email_address: badirudi ez dela e-posta helbide egoki bat
+ email_address_not_routable: ezin da biderik kalkulatu
models:
acl: Kontrol zerrendara sartu
changeset: Aldaketak
- changeset_tag: Etiketa aldaketa
+ changeset_tag: Aldaketa Etiketa
country: Herrialdea
diary_comment: Eguneroko iruzkina
diary_entry: Eguneroko sarrera
user_preference: Erabiltzaile hobespenak
user_token: Erabiltzaile token-a
way: Bidea
- way_node: Nodo bidea
+ way_node: Bidearen nodoa
way_tag: Bidearen etiketa
attributes:
diary_comment:
latitude: Latitude
longitude: Longitude
public: Publikoa
- description: Deskribapen
+ description: Deskribapena
message:
sender: Igorlea
title: Gaia
email: Eposta
active: Aktibo
display_name: Erakusteko izena
- description: Deskribapen
+ description: Deskribapena
languages: Hizkuntzak
pass_crypt: Pasahitza
editor:
title: 'Aldaketa: %{id}'
belongs_to: Egilea
node: Nodoak (%{count})
- node_paginated: (%{count}ren) %{x}-%{y} nodoak
+ node_paginated: Nodoak (%{x}-%{y} %{count}-tik)
way: Bideak (%{count})
- way_paginated: Bideak (%{count}ren %{x}-%{y})
+ way_paginated: Bideak (%{x}-%{y} %{count}-tik)
relation: Erlazioak (%{count})
- relation_paginated: Erlazioak (%{count}ren %{x}-%{y})
+ relation_paginated: Erlazioak (%{x}-%{y} %{count}-tik)
comment: Iruzkinak (%{count})
- hidden_commented_by: '%{user} erabiltzaileak egindako duela <abbr title=''%{exact_time}''>%{when}</abbr>
- iruzkin ezkutua'
+ hidden_commented_by: '%{user} erabiltzaileak egindako iruzkin ezkutua duela
+ <abbr title=''%{exact_time}''>%{when}</abbr>'
commented_by: '%{user} erabiltzaileak egindako iruzkina duela <abbr title=''%{exact_time}''>%{when}</abbr>'
- changesetxml: XML aldaketak
- osmchangexml: XML osm-aldaketa
+ changesetxml: Aldaketaren XML kodea
+ osmchangexml: osmChange XML kodea
feed:
title: '%{id} aldaketak'
- title_comment: '%{id} - %{comment} aldaketak'
+ title_comment: '%{id} aldaketa - %{comment}'
join_discussion: Hasi saioa eztabaidan parte hartzeko
discussion: Eztabaida
still_open: Aldaketak oraindik zabalik - eztabaida aldaketak itxi ondoren irekiko
history_title: 'Bidearen historia: %{name}'
nodes: Nodoak
also_part_of:
- one: bidearen zatia %{related_ways}
- other: bideen zatia %{related_ways}
+ one: '%{related_ways} bidearen zatia'
+ other: '%{related_ways} bideen zatia'
relation:
title: 'Erlazioa: %{name}'
history_title: 'Erlazioaren historia: %{name}'
changeset: aldaketak
note: oharra
timeout:
- sorry: Barkatu, %{id} daukan %{type}rako datuak berreskuratzeko denbora asko
+ sorry: Barkatu, %{id} daukan %{type}rako datuak berreskuratzeko denbora gehiegi
behar izan da.
type:
node: nodo
way: bide
relation: erlazio
start_rjs:
- feature_warning: '%{num_features} funtzioak kargatzen, zure arakatzailea motela
- edo erantzungabekoa izan ez dadin. Ziur datuak bistaratu nahi dituzula?'
+ feature_warning: '%{num_features} ezaugarri kargatzen, zure arakatzailea motela
+ edo erantzungabekoa bihur daiteke. Ziur datuak bistaratu nahi dituzula?'
load_data: Kargatu datuak
loading: Kargatzen...
tag_details:
sortua'
open_by_anonymous: Erabiltzaile ezezagun batek duela <abbr title='%{exact_time}'>%{when}</abbr>
sortua
- commented_by: '%{user} duela <abbr title=''%{exact_time}''>%{when} </abbr> egindako
- iruzkina'
+ commented_by: '%{user} erabiltzaileak duela <abbr title=''%{exact_time}''>%{when}</abbr>
+ egindako iruzkina'
commented_by_anonymous: Erabiltzaile ezezagun batek duela <abbr title='%{exact_time}'>%{when}
</abbr> egindako iruzkina
closed_by: '%{user} erabiltzaileak duela <abbr title=''%{exact_time}''>%{when}
enclosing: Bildutako ezaugarriak
changesets:
changeset_paging_nav:
- showing_page: '%{page}. orrialdea'
+ showing_page: '%{page} orrialdea'
next: Hurrengoa »
previous: « Aurrekoa
changeset:
behar izan da.
changeset_comments:
comment:
- comment: '%{changeset_id} aldaketan %{author} iruzkin berria egin du'
+ comment: '%{changeset_id} aldaketan %{author} erabiltzaileak iruzkin berria
+ egin du'
commented_at_by_html: '%{user} erabiltzaileak duela %{when} eguneratua'
+ comments:
+ comment: '%{changeset_id} aldaketan %{author}k iruzkin berria egin du'
index:
title_all: OpenStreetMap aldaketen eztabaida
- title_particular: 'OpenStreetMap #%{changeset_id} eztabaida aldatu egin du.'
+ title_particular: 'OpenStreetMap #%{changeset_id} aldaketen eztabaida.'
+ timeout:
+ sorry: Barkatu, zuk eskatutako aldaketen zerrenda berreskuratzeko denbora gehiegi
+ behar izan da.
diary_entries:
new:
title: Eguneroko Sarrera Berria
longitude: 'Longitudea:'
use_map_link: erabili mapa
save_button: Gorde
- marker_text: Eguneroko sarrera helbidea
+ marker_text: Eguneroko sarrera kokapena
show:
title: '%{user}(r)en egunerokoa | %{title}'
user_title: '%{user}(r)en egunerokoa'
intro_text: OpenStreetMap munduko mapa da, zu bezalako jendeak sortutakoa eta
doako lizentzia irekiarekin erabiltzeko dagoena.
intro_2_create_account: Erabiltzaile kontua sortu
+ hosting_partners_html: '%{ucl}, %{bytemark} eta beste %{partners}-k babestua.'
partners_ucl: UCLa
partners_bytemark: Bytemark Ostatua
partners_partners: bazkideak
<a href="http://www.gu.gov.si/en/"> Burutzea eta Mapping Agintaritzatik </a> eta
<a href="http://www.mkgp.gov.si/en/"> Nekazaritza, Basogintza eta Elikadura Ministeriotik</a>
(Esloveniako informazio publikoa).
+ contributors_es_html: |-
+ <strong>Espainia</strong>: Espainiako Institutu Geografiko Nazionaletik (<a href="http://www.ign.es/">IGN</a>) eta
+ Sistema Kartografiko Nazionaletik (<a href="http://www.scne.es/">SCNE</a>) jasotako datuak daude, berrerabiltzeko baimendua <a href="https://creativecommons.org/licenses/by/4.0/deed.eu">CC BY 4.0</a> lizentziapean.
contributors_za_html: |-
<strong> Hego Afrika </strong>:
<a href="http://www.ngi.gov.za/"> Zuzendaritza Nagusia datuen jatorria:
Geo-Lurralde Informazio Nazionala </a>, Estatuko copyright erreserbatuta.
contributors_gb_html: |-
<strong>Erresuma Batua</strong>: Ordnance
- Inkestaren datuak eta kopiak biltzen ditu; Crown copyright eta datu-basearen eskubidea 2010-12.
+ Inkestaren datuak eta kopiak biltzen ditu; Crown copyright eta datu-basearen eskubidea 2010-19.
contributors_footer_1_html: |-
OpenStreetMap hobetzen laguntzeko lagundu dutenen xehetasun gehiago eta erabilitako beste iturri batzuk ezagutzeko, mesedez OpenStreetMap Wikian ikusi <a
href="http://wiki.openstreetmap.org/wiki/Contributors">Contributors
title: switch2osm
description: Laguntza enpresei eta erakundeei OpenStreetMap-en oinarritutako
mapetara eta beste zerbitzuetara aldatzeko.
+ welcomemat:
+ url: https://welcome.openstreetmap.org/
+ title: Erakundeentzat
+ description: OpenStreetMap-entzat planak egiten ari den erakunde batekin?
+ Aurkitu jakin beharrekoa Ongietorri Lanpasean.
wiki:
url: http://wiki.openstreetmap.org/wiki/Eu:Main_Page
title: wiki.openstreetmap.org
edit: Aldatu
preview: Aurrikusi
markdown_help:
- title_html: Honekin analizatua:<a href="https://daringfireball.net/projects/markdown/">Markdown</a>
+ title_html: Honekin analizatua:<a href="https://kramdown.gettalong.org/quickref.html">kramdown</a>
headings: Atalburuak
heading: Goiburua
subheading: Azpi-goiburua
title: Galderarik?
paragraph_1_html: |-
OpenStreetMap-ek proiektuari buruz ikasteko baliabideak ditu, galdetuz eta erantzunez, eta mapping gaiak eztabaidatu eta dokumentatuz lankidetzan.
- <a href='%{help_url}'>Jaso laguntza hemen</a>.
+ <a href='%{help_url}'>Jaso laguntza hemen</a>. OpenStreetMap-entzat planak egiten ari den erakunde batekin? <a href='https://welcome.openstreetmap.org/'>Aurkitu jakin beharrekoa Ongietorri Lanpasean</a>.
start_mapping: Hasi mapeatzen
add_a_note:
title: Editatzeko denborarik ez? Gehitu ohar bat!
other: '%{user} %{count} puntuak dituen GPX fitxategia'
description_without_count: '%{user}ren GPX fitxategia'
application:
+ permission_denied: Ez duzu baimenik ekintza hori burutzeko
require_cookies:
cookies_needed: Cookieak desgaituta dituzu - gaitu cookie-ak zure nabigatzailean
jarraitu aurretik mesedez.
terms accepted: Eskerrik asko laguntzaileen termino berriak onartzeagatik!
terms declined: Sentitzen dugu Kolaboratzaileen baldintza berriak onartu ez
dituzula. Informazio gehiagorako, ikus <a href="%{url}"> wiki orri hau </a>.
+ terms declined url: https://wiki.openstreetmap.org/wiki/Contributor_Terms_Declined
terms:
title: Kolaboratzaile terminoak
heading: Kolaboratzaile terminoak
consider_pd: Goiko hitzarmenaz gain, nire ekarpenak Domeinu Publikoan egon behar
direla uste dut
consider_pd_why: zer da hau?
+ consider_pd_why_url: https://www.osmfoundation.org/wiki/License/Why_would_I_want_my_contributions_to_be_public_domain
guidance: 'Termino hauek ulertzeko informazioa: <a href="%{summary}"> giza laburpen
irakurgarria </a> eta batzuk <a href="%{translations}"> itzulpen informalak
</a>'
agree: Ados
+ declined: https://wiki.openstreetmap.org/wiki/Contributor_Terms_Declined
decline: Ez onartu
you need to accept or decline: Irakurri eta gero, onartu edo ezetsi Kolaboratzaileen
termino berriak jarraitzeko.
review link text: Mesedez, jarraitu esteka hau zure Kolaboratzaile Terminoaen
erosotasuna berrikusteko eta onartzeko.
agreed_with_pd: Zure aldaketak domeinu publikoan egongo direla adierazi duzu.
+ link: https://www.osmfoundation.org/wiki/License/Contributor_Terms
link text: zer da hau?
profile description: 'Profilaren Deskribapena:'
preferred languages: 'Hobetsitako hizkuntzak:'
image: 'Irudia:'
gravatar:
gravatar: Gravatar erabili
+ link: https://wiki.openstreetmap.org/wiki/Gravatar
link text: zer da hau?
disabled: Gravatar desgaitu egin da.
enabled: Zure Gravatar bistaratzea gaitu da.
directions:
ascend: Igo
engines:
+ fossgis_osrm_bike: Bizikleta (OSRM)
fossgis_osrm_car: Autoz (OSRM)
+ fossgis_osrm_foot: Oinez (OSRM)
graphhopper_bicycle: Bizikletaz (GraphHopper)
graphhopper_car: Autoz(GraphHopper)
graphhopper_foot: Oinez (GraphHopper)
aurretik.
flash: Erredakzioa suntsitu egin da.
error: Erredakzio hau suntsitzerakoan akats bat egon da.
+ validations:
+ leading_whitespace: zuriunea du hasieran
+ trailing_whitespace: zuriunea du amaieran
+ invalid_characters: karaktere ezegokiak ditu
+ url_characters: URL karaktere bereziak (%{characters}) ditu
...
second_hand: سمساری
shoes: فروشگاه کفش
sports: فروشگاه ورزشی
- stationery: Ù\81رÙ\88شگاÙ\87 Ù\84Ù\88ازÙ\85 اÙ\84تØرÛ\8cر
+ stationery: Ù\81رÙ\88شگاÙ\87 Ù\86Ù\88شتâ\80\8cاÙ\81زار
supermarket: سوپرمارکت
tailor: خیاطی
ticket: فروشگاه بلیط
about:
next: بعدی
copyright_html: <span>©</span>مشارکتکنندگان<br>OpenStreetMap
- used_by: صدها وبسایت، برنامهٔ موبایل و دستگاه سختافزاری از دادههای نقشهٔ %{name}
+ used_by: صدها وبسایت، برنامهٔ موبایل و دستگاه سختافزاری از دادههای %{name}
نیرو گرفتهاند.
lede_text: OpenStreetMap را جامعهای از نقشهکشان ساختهاند که در ایجاد و نگهداری
دادههای مربوط به جادهها، مسیرهای تریل، کافهها، ایستگاههای راهآهن و بسیاری
visibility_help_url: https://wiki.openstreetmap.org/wiki/Fa:Visibility_of_GPS_traces
upload_button: بارگذاری
help: کمک
- help_url: https://wiki.openstreetmap.org/wiki/Upload
+ help_url: https://wiki.openstreetmap.org/wiki/Fa:Upload
create:
upload_trace: بارگذاری رد جیپیاس
trace_uploaded: فایل GPX شما بارگذاری شده و در انتظار درج در پایگاهداده است.
l’<a href="http://www.gu.gov.si/en/">Autorité de Planification et de Cartographie</a>
et du <a href="http://www.mkgp.gov.si/en/">Ministère de l’Agriculture, de
la Forêt et de l’Alimentation</a> (information publique de la Slovénie).'
+ contributors_es_html: '<strong>Espagne</strong>: contient des données fournies
+ par l''Institut Géographique National Espagnol (<a href="http://www.ign.es/">IGN</a>)
+ et le Système Cartographique National (<a href="http://www.scne.es/">SCNE</a>)
+ sous licence <a href="https://creativecommons.org/licenses/by/4.0/">CC BY
+ 4.0</a> pour la réutilisation .'
contributors_za_html: |-
<strong>Afrique du Sud</strong> : contient des données issues de la <a href="http://www.ngi.gov.za/">Direction principale des
Informations Géospatiales Nationales</a>, copyright de l’État réservé.
contributors_gb_html: '<strong>Royaume-Uni</strong> : contient des données
- issues de l’<em>Ordnance Survey</em> © 2010-2012 Droits d’auteurs et de
- la base de données de la Couronne.'
+ issues de l’<em>Ordnance Survey</em> © 2010-2019 Droits d’auteurs et
+ de la base de données de la Couronne.'
contributors_footer_1_html: Pour plus de détails sur celles-ci et sur les
autres sources utilisées pour aider à améliorer OpenStreetMap, consultez
la page des <a href="https://wiki.openstreetmap.org/wiki/Contributors">contributeurs</a>
datos baixo licenzas abertas de axencias nacionais de cartografía
e outras fontes, entre elas:
contributors_at_html: |-
- <strong>Austria:</strong> Contén datos de
- <a href="https://data.wien.gv.at/">Stadt Wien</a> (baixo a licenza
+ <strong>Austria:</strong> Contén datos de <a href="https://data.wien.gv.at/">Stadt Wien</a> (baixo a licenza
<a href="https://creativecommons.org/licenses/by/3.0/at/deed.de">CC BY</a>),
<a href="https://www.vorarlberg.at/vorarlberg/bauen_wohnen/bauen/vermessung_geoinformation/weitereinformationen/services/wmsdienste.htm">Land Vorarlberg</a> e
Land Tirol (baixo a licenza <a href="https://www.tirol.gv.at/applikationen/e-government/data/nutzungsbedingungen/">CC-BY AT con emendas</a>).
contributors_au_html: |-
- <strong>Australia:</strong> Contén datos de barrios baseados
- nos datos do Australian Bureau of Statistics.
+ <strong>Australia</strong>: Contén datos orixinarios de
+ <a href="https://www.psma.com.au/psma-data-copyright-and-disclaimer">PSMA Australia Limited</a> con licenza polo Commonwealth de Australia baixo <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.
contributors_ca_html: |-
<strong>Canadá:</strong> Contén datos de
GeoBase®, GeoGratis (© Department of Natural
<strong>Países Baixos:</strong> Contén datos de © AND, 2007
(<a href="https://www.and.com">www.and.com</a>)
contributors_nz_html: |-
- <strong>Nova Zelandia</strong>: Contén fontes de datos do<a href="https://data.linz.govt.nz/">Servizo de datos LINZ</a> e ten unha licenza para o seu emprego que é a
+ <strong>Nova Zelandia</strong>: Contén fontes de datos do <a href="https://data.linz.govt.nz/">Servizo de datos LINZ</a> e ten unha licenza para o seu emprego que é a
<a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.
contributors_si_html: |-
<strong>Eslovenia</strong>: Contén datos da
<a href="http://www.gu.gov.si/en/">Autoridade de Planificación e de Cartografía</a> e do
<a href="http://www.mkgp.gov.si/en/">Ministerio de Agricultura, Bosques e Alimentación</a>
(información pública de Eslovenia).
+ contributors_es_html: |-
+ <strong>España</strong>: Contén datos orixinarios do Instituto Nacional Xeográfico Español (<a href="http://www.ign.es/">IGN</a>) e o
+ Sistema Cartográfico Nacional (<a href="http://www.scne.es/">SCNE</a>)
+ con licenza para a súa reutilización baixo <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.
contributors_za_html: |-
<strong>Suráfrica:</strong> Contén datos con orixe no
<a href="http://www.ngi.gov.za/">Chief Directorate:
contributors_gb_html: |-
<strong>Reino Unido:</strong> Contén datos da Ordnance
Survey © Dereitos de autor da coroa e dereito da base de datos
- 2010-12.
+ 2010-19.
contributors_footer_1_html: |-
Para obter máis información sobre estas e outras fontes usadas
para axudar na mellora do OpenStreetMap, bote unha ollada á <a
href="http://www.mkgp.gov.si/en/">農林食料省</a>(スロベニアの公開情報)による。'
contributors_za_html: '<strong>南アフリカ</strong>: <a href="http://www.ngi.gov.za/">Chief
Directorate: National Geo-Spatial Information</a>,政府によるデータを含み、著作権を保持します。'
- contributors_gb_html: '<strong>イギリス</strong>: 陸地測量データ ©著作権はクラウン・コピーライト及びdatabase
- right 2010-12 を含みます。'
+ contributors_gb_html: "<strong>イギリス</strong>: 陸地測量\nデータ © クラウン・コピーライト及びデータベース権限
+ database right \n2010-19 を含みます。"
contributors_footer_1_html: |-
これらの詳細について、またOpenStreetMapの向上に使用されたその他のソースについては、OpenStreetMap Wikiの<a
href="https://wiki.openstreetmap.org/wiki/Contributors">協力者ページ</a>をご覧ください。
trace_uploaded: GPX ファイルをアップロードしました。データベースへの登録に多少時間がかかります。通常この作業は 30 分以内に完了し、それをお知らせするメールをお送りします。
upload_failed: 申し訳ありませんが、GPXのアップロードに失敗しました。管理者にエラーが通知されました。もう一度やり直してください
traces_waiting:
- one: You は%{count} 件のトレースがアップロード待ちです。これらが完了するまで、アップロードはお控えください。さもなければ他のユーザーのアップロードが制限されてしまいます。
- other: You have %{count}件のトレースがアップロード待ちです。これらが完了するまでアップロードはお控えください。さもなければ他のユーザーのアップロードが制限されてしまいます。
+ other: あなたの %{count} 件のトレースがアップロード待ち中です。これらのアップロードが完了するまでお待ちください。さもなければ他のユーザーのアップロードが制限されてしまいます。
edit:
title: トレース %{name} の編集
heading: トレース %{name} の編集
<a href="http://www.gu.gov.si/en/">Геодетската управа</a> и
<a href="http://www.mkgp.gov.si/en/">Министерството за земјоделство, шумарство и храна</a>
(јавни информации од Словенија).
+ contributors_es_html: |-
+ <strong>Шпанија</strong>: Содржи податоци преземени од
+ Националниот географски институт на Шпанија (<a href="http://www.ign.es/">IGN</a>) и
+ Националниот картографски систем (<a href="http://www.scne.es/">SCNE</a>)
+ достапни за употреба под лиценцата <a href="https://creativecommons.org/licenses/by/4.0/deed.mk">CC BY 4.0</a>.
contributors_za_html: |-
<strong>ЈАР</strong>: Содржи податоци од
<a href="http://www.ngi.gov.za/">Главната управа:
contributors_gb_html: |-
<strong>Велика Британија</strong>: Содржи податоци
од Картографскиот завод на Обединетото Кралство© Крунски авторски права и
- права на базата 2010-12.
+ права на базата 2010-19 г.
contributors_footer_1_html: |-
Повеќе информации за овие и други извори искористени
за подобрување на OpenStreetMap ќе најдете на страницата <a
show:
comment: Kommentar
subscribe: Abonner
- unsubscribe: Avbestill
+ unsubscribe: Avslutt abonnement
hide_comment: skjul
unhide_comment: vis
notes:
de Levantamento e Mapeamento</a> e do <a href="http://www.mkgp.gov.si/en/">Ministério
de Agricultura, Silvicultura e Alimentação</a> (informações públicas da
Eslovênia).'
+ contributors_es_html: |-
+ <strong>Espanha</strong>: Contém dados provenientes do
+ Instituto Geográfico Nacional da Espanha (<a href="http://www.ign.es/">IGN</a>) e
+ Sistema Cartográfico Nacional (<a href="http://www.scne.es/">SCNE</a>)
+ licenciado para reutilização sob <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.
contributors_za_html: |-
<strong>Africa do Sul</strong>: contém dados originários de
<a href="http://www.ngi.gov.za/">Chief Directorate:
National Geo-Spatial Information</a>, com direitos autorais reservados àquele Estado.
- contributors_gb_html: |-
- <strong>Reino Unido</strong>: Contém dados da Ordnance
- Survey © Direitos da base e autorais da Crown 2010.
+ contributors_gb_html: '<strong>Reino Unido</strong>: Contém dados do Ordnance
+ Survey © Crown copyright and database right 2010-2019.'
contributors_footer_1_html: Para mais informações sobre estas e outras fontes
utilizadas para melhorar o OpenStreetMap, consulte a <a href="https://wiki.openstreetmap.org/wiki/Contributors">página
de contribuidores</a> (em inglês) na wiki do OpenStreetMap.
<a href="http://www.gu.gov.si/en/">Autoridade de Cartografia e Topografia (Geodetska uprava Republike Slovenije)</a> e do
<a href="http://www.mkgp.gov.si/en/">Ministério da Agricultura, Floresta e Alimentação (Ministrstvo za kmetijstvo, gozdarstvo in prehrano)</a>
(informação pública da Eslovénia).
+ contributors_es_html: |-
+ <strong>Espanha</strong>: Contém dados provenientes do Instituto Geográfico Nacional (<a href="http://www.ign.es/">IGN</a>) e do Sistema cartográfico Nacional (<a href="http://www.scne.es/">SCNE</a>) de Espanha
+ licenciado para reutilização com a <a href="https://creativecommons.org/licenses/by/4.0/deed.pt">CC BY 4.0</a>.
contributors_za_html: '<strong>África do Sul</strong>: Contém dados provenientes
de <a href="http://www.ngi.gov.za/">Chief Directorate: National Geo-Spatial
Information</a>, State copyright reserved.'
contributors_gb_html: '<strong>Reino Unido</strong>: Contém dados do Ordnance
- Survey © Crown copyright and database right 2010-2012.'
+ Survey © Crown copyright and database right 2010-2019.'
contributors_footer_1_html: Para mais informações sobre estas e outras fontes
utilizadas para melhorar o OpenStreetMap, consulte a <a href="https://wiki.openstreetmap.org/wiki/Contributors">página
de contribuidores</a> (em inglês) na wiki do OpenStreetMap.
note: notă
timeout:
sorry: Ne pare rău, dar durata recepționării datelor pentru %{type} cu identificatorul
- %{id} a fost prea mare.
+ %{id} este prea mare.
type:
node: nodul
way: calea
relation: relații
start_rjs:
feature_warning: Se încarcă %{num_features} caracteristici, ceea care ar putea
- încetini sau bloca navigatorul dumneavoastră. Sigur doriți afișarea acestor
- date?
+ încetini sau bloca navigatorul dumneavoastră. Doriți afișarea acestor date?
load_data: Încărcare date
loading: Se încarcă...
tag_details:
despre drumuri, trasee, cafenele, stații de cale ferată și multe altele din întreaga lume.
local_knowledge_title: Cunoaștere locală
local_knowledge_html: |-
- OpenStreetMap accentuează cunoștințele locale. Colaboratorii folosesc
- imaginile aeriene, dispozitivele GPS și hărțile câmpurilor de joasă tehnologie pentru a verifica faptul că OSM
+ OpenStreetMap accentuează cunoștințele locale. Colaboratorii folosesc imaginile aeriene, dispozitivele GPS și hărțile câmpurilor de joasă tehnologie pentru a verifica faptul că OSM
este exactă și actualizată.
community_driven_title: Condusă de comunitate
community_driven_html: |-
href="https://opendatacommons.org/licenses/odbl/">Open Data
Commons Open Database License</a> (ODbL) by the <a
href="https://osmfoundation.org/">Fundația OpenStreetMap</a> (OSMF).
- intro_2_html: |-
- Sunteți liber să copiați, să distribuiți, să transmiteți și să vă adaptați datele,
- atâta timp cât vă credit OpenStreetMap și ei
- contribuitori. Dacă modificați sau construiți datele noastre, vă
- poate distribui rezultatul numai sub aceeași licență.
- complete <a href="https://opendatacommons.org/licenses/odbl/1.0/">legal
- code</a> vă explică drepturile și responsabilitățile.
+ intro_2_html: Sunteți liber să copiați, să distribuiți, să transmiteți și
+ să vă adaptați datele, atâta timp cât creditați OpenStreetMap și contribuitorii
+ ei. Dacă modificați sau folosiți datele noastre, puteți distribui rezultatul
+ doar sub aceeași licență. Aici <a href="https://opendatacommons.org/licenses/odbl/1.0/">codul
+ legal</a> sunt explicate drepturile și responsabilitățile.
intro_3_html: |-
Cartografia din hărțile noastre și documentația noastră sunt
licențiat sub <a href="https://creativecommons.org/licenses/by-sa/2.0/">Creative
credit_1_html: Noi cerem să utilizați creditul© contribuitori OpenStreetMap&
rdquo;.
credit_2_html: |-
- De asemenea, trebuie să clarificați faptul că datele sunt disponibile în cadrul opțiunii Deschiderea Licenței bazei de date și, dacă folosim plăcile de pe hartă, că cartografia este licențiat ca CC BY-SA. Puteți face acest lucru prin conectarea la
+ De asemenea, trebuie să clarificați faptul că datele sunt disponibile în cadrul licenței libere a bazei de date și, dacă folosim bucăți de hartă, atunci cartografierea este licențiată de CC BY-SA. Puteți face acest lucru prin conectarea la
<a href="https://www.openstreetmap.org/copyright"> această pagină de copyright</a>.
- Alternativ și ca o cerință dacă distribuim OSM într-un
- formularul de date, puteți numi și să vă conectați direct la licența (licențele). În mass-media
- unde legăturile nu sunt posibile (de exemplu lucrări tipărite), vă sugerăm
- direcționați cititorii dvs. la openstreetmap.org (probabil prin extinderea "OpenStreetMap" la această adresă completă), la opendatacommons.org și dacă este cazul, la creativecommons.org.
+ Alternativ, și ca o cerință dacă distribuim OSM într-un
+ formularul de date, puteți numi și să vă conectați direct la licența (licențele). Acolo unde legăturile nu sunt posibile (de exemplu lucrări tipărite), vă sugerăm să direcționați cititorii dvs. la openstreetmap.org (probabil prin extinderea "OpenStreetMap" la această adresă completă), la opendatacommons.org, și dacă este cazul, la creativecommons.org.
credit_3_html: |-
Pentru o hartă electronică care poate fi răsfoită, creditul ar trebui să apară în colțul hărții.
De exemplu:
get_directions_title: Găsiți direcții între două puncte
from: De la
to: Către
- where_am_i: Unde este asta?
+ where_am_i: Unde mă aflu?
where_am_i_title: Descrie locaţia curentă folosind motorul de căutare
submit_text: Mergi
reverse_directions_text: Inversează direcția
settings_link_text: setări
my friends: Prietenii mei
no friends: Nu ați adăugat încă niciun prieten.
- km away: '%{count}km depărtare'
- m away: '%{count}m depărtare'
+ km away: '%{count} km depărtare'
+ m away: '%{count} m depărtare'
nearby users: Alți utilizatori din apropriere
no nearby users: Nu există alți utilizatori care să admită cartografiere în
apropiere.
edit_help: Deplasați harta și măriți o locație pe care doriți să o editați, apoi
faceți click aici.
directions:
- ascend: Urcă
+ ascend: Urcare
engines:
fossgis_osrm_bike: Bicicletă (OSRM)
fossgis_osrm_car: Mașină (OSRM)
graphhopper_bicycle: Bicicletă (GraphHopper)
graphhopper_car: Mașină (GraphHopper)
graphhopper_foot: Mers (GraphHopper)
- descend: Coborî
+ descend: Coborâre
directions: Direcții
- distance: Distanţă
+ distance: Distanță
errors:
no_route: Nu s-a putut găsi un traseu între cele două locuri.
no_place: Ne pare rău - nu am găsit locația '%{place}'.
turn_right_without_exit: Virează la dreapta pe %{name}
sharp_right_without_exit: Strângeți dreapta spre %{name}
uturn_without_exit: Fă o întoarcere în U %{name}
- sharp_left_without_exit: Strângeți stânga spre %{name}
+ sharp_left_without_exit: Brusc stânga spre %{name}
turn_left_without_exit: Virează la stânga pe %{name}
offramp_left: Abordați ieșirea de pe partea stângă
offramp_left_with_exit: Urmează ieșirea %{exit} prin stânga
merge_left_without_exit: Strângeți stânga spre %{name}
fork_left_without_exit: La intersecția în formă de furculiță (Y) fă stânga
pe %{name}
- slight_left_without_exit: Strângeți stânga pe %{name}
+ slight_left_without_exit: Ușor stânga pe %{name}
via_point_without_exit: (prin via)
follow_without_exit: Urmarește %{name}
roundabout_without_exit: La sensul giratoriu, ieșiți pe %{name}
eighth: Locul 8
ninth: Locul 9
tenth: Locul 10
- time: Data
+ time: Durată
query:
node: Nod
way: Cale
# Author: Chilin
# Author: D1g
# Author: DCamer
+# Author: Diralik
# Author: Dmitry-s93
# Author: Dr&mx
# Author: Edible Melon
signup_confirm:
subject: '[OpenStreetMap] Добро пожаловать в OpenStreetMap'
greeting: Привет!
- created: Кто-то (надеемся, что Вы) только что создал учетную запись на %{site_url}.
+ created: Кто-то (надеемся, что Вы) только что создал учётную запись на %{site_url}.
confirm: 'Прежде, чем мы сможем что-либо сделать, мы должны убедиться, что эта
просьба исходит от вас, и если это так, то, пожалуйста, нажмите на ссылку
- ниже для подтверждения вашей учетной записи:'
+ ниже для подтверждения вашей учётной записи:'
welcome: После подтверждения вашей учётной записи, мы предоставим вам немного
дополнительной информации для начального ознакомления.
email_confirm:
<a href="http://www.ngi.gov.za/">Главное управление:
Национальная геоинформационная система</a>, права принадлежат государству.
contributors_gb_html: <strong>Великобритания.</strong> Данные Ordnance Survey
- © Crown copyright и права на базы данных 2010-12.
+ © Crown copyright и права на базы данных 2010-19.
contributors_footer_1_html: Более подробную информацию об этих и других источниках,
использованных для наполнения OpenStreetMap, смотрите на <a href="https://wiki.openstreetmap.org/wiki/Contributors">странице
Contributors</a> вики-сервера OpenStreetMap.
с <a href="https://wiki.osmfoundation.org/wiki/Trademark_Policy">Политикой
в области товарных знаков</a>.
index:
- js_1: Вы используете браузер, в котором не поддерживается или отключен JavaScript.
+ js_1: Вы используете браузер, в котором не поддерживается или отключён JavaScript.
js_2: OpenStreetMap использует JavaScript для отображения карт.
permalink: Постоянная ссылка
shortlink: Короткая ссылка
# Author: Sawa
# Author: Srdjan m
# Author: Stalker
+# Author: Zoranzoki21
# Author: Жељко Тодоровић
# Author: Милан Јелисавчић
# Author: Обрадовић Горан
Национална катастарска служба</a>, државна ауторска права задржана.
contributors_gb_html: |-
<strong>Уједињено Краљевство</strong>: Садржи податке
- Картографског завода Уједињеног Краљевства© Крунска ауторска права и
- права базе 2010-12.
+ Картографског завода Уједињеног Краљевства© Крунска ауторска права и права базе података
+ 2010-19.
contributors_footer_1_html: |-
Више информација о овим и другим изворима коришћеним
за побољшавање Опенстритмапа можете наћи на страници <a
<a href="http://www.mkgp.gov.si/en/">Ministry of Agriculture, Forestry and Food</a>
(Slovenya'nın halka açık bilgileri) sayfalarından
edinilen verileri içermektedir.
+ contributors_es_html: |-
+ <strong>İspanya</strong>: İspanya Ulusal Coğrafya Enstitüsü (<a href="http://www.ign.es/">IGN</a>) ile
+ Ulusal Kartografik Sistem'den (<a href="http://www.scne.es/">SCNE</a>) elde edilen verileri içerir ve tekrar kullanım amacıyla <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a> ile lisanslanmıştır.
contributors_za_html: |-
<strong>Güney Afrika</strong>: <a href="http://www.ngi.gov.za/">Chief Directorate:
National Geo-Spatial Information</a> kaynaklı verileri içermektedir, Devlet telif hakkı saklıdır.
<strong>斯洛維尼亞</strong>:包含來自<a href="http://www.gu.gov.si/en/">Surveying and Mapping Authority</a>和
<a href="http://www.mkgp.gov.si/en/">Ministry of Agriculture, Forestry and Food</a>
(斯洛維尼亞公開資訊).
+ contributors_es_html: |-
+ <strong>西班牙</strong>:包含來自西班牙國家地理研究所(<a href="http://www.ign.es/">IGN</a>)以及國家製圖系統<a href="http://www.scne.es/">SCNE</a>)的資料來源,並依據
+ <a href="https://creativecommons.org/licenses/by/4.0/deed.zh_TW">姓名標示 4.0 國際</a>條款授權。
contributors_za_html: |-
<strong>南非</strong>: 包含來自
<a href="http://www.ngi.gov.za/">Chief Directorate:
+++ /dev/null
-require "yaml"
-
-env = if defined?(Rake.application) && Rake.application.top_level_tasks.grep(/^(default$|test(:|$))/).any?
- "test"
- else
- ENV["RAILS_ENV"] || "development"
- end
-
-config = YAML.load_file(File.expand_path(env == "test" ? "../example.application.yml" : "../application.yml", __FILE__))
-
-ENV.each do |key, value|
- Object.const_set(Regexp.last_match(1).upcase, value) if key =~ /^OSM_(.*)$/
-end
-
-config[env].each do |key, value|
- Object.const_set(key.upcase, value) unless Object.const_defined?(key.upcase)
-end
--- /dev/null
+# The server protocol and host
+server_protocol: "http"
+server_url: "openstreetmap.example.com"
+# Publisher
+#publisher_url: ""
+# The generator
+generator: "OpenStreetMap server"
+copyright_owner: "OpenStreetMap and contributors"
+attribution_url: "http://www.openstreetmap.org/copyright"
+license_url: "http://opendatacommons.org/licenses/odbl/1-0/"
+# Support email address
+support_email: "openstreetmap@example.com"
+# Sender addresses for emails
+email_from: "OpenStreetMap <openstreetmap@example.com>"
+email_return_path: "openstreetmap@example.com"
+# API version
+api_version: "0.6"
+# Application status - possible values are:
+# online - online and operating normally
+# api_readonly - site online but API in read-only mode
+# api_offline - site online but API offline
+# database_readonly - database and site in read-only mode
+# database_offline - database offline with site in emergency mode
+# gpx_offline - gpx storage offline
+status: "online"
+# The maximum area you're allowed to request, in square degrees
+max_request_area: 0.25
+# Number of GPS trace/trackpoints returned per-page
+tracepoints_per_page: 5000
+# Maximum number of nodes that will be returned by the api in a map request
+max_number_of_nodes: 50000
+# Maximum number of nodes that can be in a way (checked on save)
+max_number_of_way_nodes: 2000
+# The maximum area you're allowed to request notes from, in square degrees
+max_note_request_area: 25
+# Zoom level to use for postcode results from the geocoder
+postcode_zoom: 15
+# Zoom level to use for geonames results from the geocoder
+geonames_zoom: 12
+# Timeout for API calls in seconds
+api_timeout: 300
+# Timeout for web pages in seconds
+web_timeout: 30
+# Periods (in hours) which are allowed for user blocks
+user_block_periods: [0, 1, 3, 6, 12, 24, 48, 96]
+# Rate limit for message sending
+max_messages_per_hour: 60
+# Domain for handling message replies
+#messages_domain: "messages.openstreetmap.org"
+# Geonames authentication details
+#geonames_username: ""
+# GeoIP database
+#geoip_database: ""
+# Users to show as being nearby
+nearby_users: 30
+# Max radius, in km, for nearby users
+nearby_radius: 50
+# Spam threshold
+spam_threshold: 50
+# Default legale (jurisdiction location) for contributor terms
+default_legale: GB
+# Use the built-in jobs queue for importing traces
+# Leave as false if you are using the external high-speed gpx importer
+# https://github.com/openstreetmap/gpx-import
+trace_use_job_queue: false
+# Location of GPX traces and images
+gpx_trace_dir: "/home/osm/traces"
+gpx_image_dir: "/home/osm/images"
+# Location of data for attachments
+attachments_dir: ":rails_root/public/attachments"
+# Log file to use
+#log_path: ""
+# Log file to use for logstash
+#logstash_path: ""
+# List of memcache servers to use for caching
+#memcache_servers: []
+# Enable legacy OAuth 1.0 support
+oauth_10_support: true
+# URL of Nominatim instance to use for geocoding
+nominatim_url: "https://nominatim.openstreetmap.org/"
+# Default editor
+default_editor: "id"
+# OAuth consumer key for Potlatch 2
+#potlatch2_key: ""
+# OAuth consumer key for the web site
+#oauth_key: ""
+# OAuth consumer key for iD
+#id_key: ""
+# Imagery to return in capabilities as blacklisted
+imagery_blacklist:
+ # Current Google imagery URLs have google or googleapis in the domain
+ # with a vt or kh endpoint, and x, y and z query parameters
+ - ".*\\.google(apis)?\\..*/(vt|kh)[\\?/].*([xyz]=.*){3}.*"
+ # Blacklist VWorld
+ - "http://xdworld\\.vworld\\.kr:8080/.*"
+ # Blacklist here
+ - ".*\\.here\\.com[/:].*"
+# URL of Overpass instance to use for feature queries
+overpass_url: "https://overpass-api.de/api/interpreter"
+# Routing endpoints
+graphhopper_url: "https://graphhopper.com/api/1/route"
+fossgis_osrm_url: "https://routing.openstreetmap.de/"
+# External authentication credentials
+#google_auth_id: ""
+#google_auth_secret: ""
+#google_openid_realm: ""
+#facebook_auth_id: ""
+#facebook_auth_secret: ""
+#windowslive_auth_id: ""
+#windowslive_auth_secret: ""
+#github_auth_id: ""
+#github_auth_secret: ""
+#wikipedia_auth_id: ""
+#wikipedia_auth_secret: ""
+# Thunderforest authentication details
+#thunderforest_key: ""
+# Key for generating TOTP tokens
+#totp_key: ""
+# Enforce Content-Security-Policy
+csp_enforce: false
+# URL for reporting Content-Security-Policy violations
+#csp_report_url: ""
--- /dev/null
+# Trace directories for testing
+gpx_trace_dir: <%= Rails.root.join("test", "gpx", "traces") %>
+gpx_image_dir: <%= Rails.root.join("test", "gpx", "images") %>
+# Geonames credentials for testing
+geonames_username: "dummy"
+# External authentication credentials for testing
+google_auth_id: "dummy"
+google_auth_secret: "dummy"
+google_openid_realm: "https://www.openstreetmap.org"
+facebook_auth_id: "dummy"
+facebook_auth_secret: "dummy"
+windowslive_auth_id: "dummy"
+windowslive_auth_secret: "dummy"
+github_auth_id: "dummy"
+github_auth_secret: "dummy"
+wikipedia_auth_id: "dummy"
+wikipedia_auth_secret: "dummy"
module Auth
PROVIDERS = { "None" => "", "OpenID" => "openid" }.tap do |providers|
- providers["Google"] = "google" if defined?(GOOGLE_AUTH_ID)
- providers["Facebook"] = "facebook" if defined?(FACEBOOK_AUTH_ID)
- providers["Windows Live"] = "windowslive" if defined?(WINDOWSLIVE_AUTH_ID)
- providers["GitHub"] = "github" if defined?(GITHUB_AUTH_ID)
- providers["Wikipedia"] = "wikipedia" if defined?(WIKIPEDIA_AUTH_ID)
+ providers["Google"] = "google" if Settings.key?(:google_auth_id)
+ providers["Facebook"] = "facebook" if Settings.key?(:facebook_auth_id)
+ providers["Windows Live"] = "windowslive" if Settings.key?(:windowslive_auth_id)
+ providers["GitHub"] = "github" if Settings.key?(:github_auth_id)
+ providers["Wikipedia"] = "wikipedia" if Settings.key?(:wikipedia_auth_id)
end.freeze
end
self
end
- def check_size(max_area = MAX_REQUEST_AREA)
+ def check_size(max_area = Settings.max_request_area)
# check the bbox isn't too large
if area > max_area
raise OSM::APIBadBoundingBox, "The maximum bbox size is " + max_area.to_s +
end
def points
+ return enum_for(:points) unless block_given?
+
@possible_points = 0
@actual_points = 0
@tracksegs = 0
end
def xml_root_attributes
- { "version" => API_VERSION.to_s,
- "generator" => GENERATOR,
- "copyright" => COPYRIGHT_OWNER,
- "attribution" => ATTRIBUTION_URL,
- "license" => LICENSE_URL }
+ { "version" => Settings.api_version,
+ "generator" => Settings.generator,
+ "copyright" => Settings.copyright_owner,
+ "attribution" => Settings.attribution_url,
+ "license" => Settings.license_url }
end
end
def self.ip_to_country(ip_address)
- ipinfo = geoip_database.country(ip_address) if defined?(GEOIP_DATABASE)
+ ipinfo = geoip_database.country(ip_address) if Settings.key?(:geoip_database)
if ipinfo
country = ipinfo.country_code2
# Return the terms and conditions text for a given country
def self.legal_text_for_country(country_code)
file_name = Rails.root.join("config", "legales", country_code.to_s + ".yml")
- file_name = Rails.root.join("config", "legales", DEFAULT_LEGALE + ".yml") unless File.exist? file_name
+ file_name = Rails.root.join("config", "legales", Settings.default_legale + ".yml") unless File.exist? file_name
YAML.load_file(file_name)
end
# Return the GeoIP database handle
def self.geoip_database
- @geoip_database ||= GeoIP.new(GEOIP_DATABASE) if defined?(GEOIP_DATABASE)
+ @geoip_database ||= GeoIP.new(Settings.geoip_database) if Settings.key?(:geoip_database)
end
end
def test_capabilities
get :show
assert_response :success
- assert_select "osm[version='#{API_VERSION}'][generator='#{GENERATOR}']", :count => 1 do
+ assert_select "osm[version='#{Settings.api_version}'][generator='#{Settings.generator}']", :count => 1 do
assert_select "api", :count => 1 do
- assert_select "version[minimum='#{API_VERSION}'][maximum='#{API_VERSION}']", :count => 1
- assert_select "area[maximum='#{MAX_REQUEST_AREA}']", :count => 1
- assert_select "note_area[maximum='#{MAX_NOTE_REQUEST_AREA}']", :count => 1
- assert_select "tracepoints[per_page='#{TRACEPOINTS_PER_PAGE}']", :count => 1
+ assert_select "version[minimum='#{Settings.api_version}'][maximum='#{Settings.api_version}']", :count => 1
+ assert_select "area[maximum='#{Settings.max_request_area}']", :count => 1
+ assert_select "note_area[maximum='#{Settings.max_note_request_area}']", :count => 1
+ assert_select "tracepoints[per_page='#{Settings.tracepoints_per_page}']", :count => 1
assert_select "changesets[maximum_elements='#{Changeset::MAX_ELEMENTS}']", :count => 1
assert_select "status[database='online']", :count => 1
assert_select "status[api='online']", :count => 1
assert_response :success
now = Time.now.getutc
hourago = now - 1.hour
- assert_select "osm[version='#{API_VERSION}'][generator='#{GENERATOR}']", :count => 1 do
+ assert_select "osm[version='#{Settings.api_version}'][generator='#{Settings.generator}']", :count => 1 do
assert_select "changes[starttime='#{hourago.xmlschema}'][endtime='#{now.xmlschema}']", :count => 1 do
assert_select "tile", :count => 0
end
# changes at the time we have frozen at
now = Time.now.getutc
hourago = now - 1.hour
- assert_select "osm[version='#{API_VERSION}'][generator='#{GENERATOR}']", :count => 1 do
+ assert_select "osm[version='#{Settings.api_version}'][generator='#{Settings.generator}']", :count => 1 do
assert_select "changes[starttime='#{hourago.xmlschema}'][endtime='#{now.xmlschema}']", :count => 1 do
assert_select "tile", :count => 6
end
assert_response :success
# NOTE: there was a test here for the timing, but it was too sensitive to be a good test
# and it was annoying.
- assert_select "osm[version='#{API_VERSION}'][generator='#{GENERATOR}']", :count => 1 do
+ assert_select "osm[version='#{Settings.api_version}'][generator='#{Settings.generator}']", :count => 1 do
assert_select "changes", :count => 1
end
end
get :show, :params => { :id => changeset_id }
assert_response :success, "cannot get first changeset"
- assert_select "osm[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1
+ assert_select "osm[version='#{Settings.api_version}'][generator='OpenStreetMap server']", 1
assert_select "osm>changeset[id='#{changeset_id}']", 1
assert_select "osm>changeset>discussion", 0
get :show, :params => { :id => changeset_id, :include_discussion => true }
assert_response :success, "cannot get first changeset with comments"
- assert_select "osm[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1
+ assert_select "osm[version='#{Settings.api_version}'][generator='OpenStreetMap server']", 1
assert_select "osm>changeset[id='#{changeset_id}']", 1
assert_select "osm>changeset>discussion", 1
assert_select "osm>changeset>discussion>comment", 0
get :show, :params => { :id => changeset_id, :include_discussion => true }
assert_response :success, "cannot get closed changeset with comments"
- assert_select "osm[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1
+ assert_select "osm[version='#{Settings.api_version}'][generator='OpenStreetMap server']", 1
assert_select "osm>changeset[id='#{changeset_id}']", 1
assert_select "osm>changeset>discussion", 1
assert_select "osm>changeset>discussion>comment", 3
"can't upload a simple valid creation to changeset: #{@response.body}"
# check the returned payload
- assert_select "diffResult[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1
+ assert_select "diffResult[version='#{Settings.api_version}'][generator='OpenStreetMap server']", 1
assert_select "diffResult>node", 1
assert_select "diffResult>way", 1
assert_select "diffResult>relation", 1
"can't do a conditional delete of in use objects: #{@response.body}"
# check the returned payload
- assert_select "diffResult[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1
+ assert_select "diffResult[version='#{Settings.api_version}'][generator='OpenStreetMap server']", 1
assert_select "diffResult>node", 1
assert_select "diffResult>way", 1
assert_select "diffResult>relation", 1
"can't upload a complex diff to changeset: #{@response.body}"
# check the returned payload
- assert_select "diffResult[version='#{API_VERSION}'][generator='#{GENERATOR}']", 1
+ assert_select "diffResult[version='#{Settings.api_version}'][generator='#{Settings.generator}']", 1
assert_select "diffResult>node", 1
assert_select "diffResult>way", 1
assert_select "diffResult>relation", 1
"failed to return error in XML format"
# check the returned payload
- assert_select "osmError[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1
+ assert_select "osmError[version='#{Settings.api_version}'][generator='OpenStreetMap server']", 1
assert_select "osmError>status", 1
assert_select "osmError>message", 1
end
assert_template nil
# print @response.body
# FIXME: needs more assert_select tests
- assert_select "osmChange[version='#{API_VERSION}'][generator='#{GENERATOR}']" do
+ assert_select "osmChange[version='#{Settings.api_version}'][generator='#{Settings.generator}']" do
assert_select "create", :count => 5
assert_select "create>node[id='#{node.id}'][visible='#{node.visible?}'][version='#{node.version}']" do
assert_select "tag[k='#{tag.k}'][v='#{tag.v}']"
changeset = create(:changeset, :user => user)
## First try with a non-public user
- new_changeset = private_changeset.to_xml
+ new_changeset = create_changeset_xml(:user => private_user)
new_tag = XML::Node.new "tag"
new_tag["k"] = "tagtesting"
new_tag["v"] = "valuetesting"
assert_require_public_data "user with their data non-public, shouldn't be able to edit their changeset"
## Now try with the public user
- create(:changeset_tag, :changeset => changeset)
- new_changeset = changeset.to_xml
+ new_changeset = create_changeset_xml(:id => 1)
new_tag = XML::Node.new "tag"
new_tag["k"] = "tagtesting"
new_tag["v"] = "valuetesting"
assert_response :success
assert_select "osm>changeset[id='#{changeset.id}']", 1
- assert_select "osm>changeset>tag", 2
+ assert_select "osm>changeset>tag", 1
assert_select "osm>changeset>tag[k='tagtesting'][v='valuetesting']", 1
end
basic_authorization create(:user).email, "test"
changeset = create(:changeset)
- new_changeset = changeset.to_xml
+ new_changeset = create_changeset_xml(:user => changeset.user, :id => changeset.id)
new_tag = XML::Node.new "tag"
new_tag["k"] = "testing"
new_tag["v"] = "testing"
xml.find("//osm/way").first[name] = value.to_s
xml
end
+
+ ##
+ # build XML for changesets
+ def create_changeset_xml(user: nil, id: nil)
+ root = XML::Document.new
+ root.root = XML::Node.new "osm"
+ cs = XML::Node.new "changeset"
+ if user
+ cs["user"] = user.display_name
+ cs["uid"] = user.id.to_s
+ end
+ cs["id"] = id.to_s if id
+ root.root << cs
+ root
+ end
end
end
print @response.body
end
assert_response :success, "Expected scucess with the map call"
- assert_select "osm[version='#{API_VERSION}'][generator='#{GENERATOR}']", :count => 1 do
+ assert_select "osm[version='#{Settings.api_version}'][generator='#{Settings.generator}']", :count => 1 do
assert_select "bounds[minlon='#{format('%.7f', minlon)}'][minlat='#{format('%.7f', minlat)}'][maxlon='#{format('%.7f', maxlon)}'][maxlat='#{format('%.7f', maxlat)}']", :count => 1
assert_select "node[id='#{node.id}'][lat='#{format('%.7f', node.lat)}'][lon='#{format('%.7f', node.lon)}'][version='#{node.version}'][changeset='#{node.changeset_id}'][visible='#{node.visible}'][timestamp='#{node.timestamp.xmlschema}']", :count => 1 do
# This should really be more generic
bbox = "#{node.lon},#{node.lat},#{node.lon},#{node.lat}"
get :index, :params => { :bbox => bbox }
assert_response :success, "The map call should have succeeded"
- assert_select "osm[version='#{API_VERSION}'][generator='#{GENERATOR}']", :count => 1 do
+ assert_select "osm[version='#{Settings.api_version}'][generator='#{Settings.generator}']", :count => 1 do
assert_select "bounds[minlon='#{node.lon}'][minlat='#{node.lat}'][maxlon='#{node.lon}'][maxlat='#{node.lat}']", :count => 1
assert_select "node[id='#{node.id}'][lat='#{format('%.7f', node.lat)}'][lon='#{format('%.7f', node.lon)}'][version='#{node.version}'][changeset='#{node.changeset_id}'][visible='#{node.visible}'][timestamp='#{node.timestamp.xmlschema}']", :count => 1 do
# This should really be more generic
bbox = "#{node.lon},#{node.lat},#{node.lon},#{node.lat}"
get :index, :params => { :bbox => bbox }
assert_response :success, "The map call should have succeeded"
- assert_select "osm[version='#{API_VERSION}'][generator='#{GENERATOR}']", :count => 1 do
+ assert_select "osm[version='#{Settings.api_version}'][generator='#{Settings.generator}']", :count => 1 do
assert_select "bounds[minlon='#{node.lon}'][minlat='#{node.lat}'][maxlon='#{node.lon}'][maxlat='#{node.lat}']", :count => 1
assert_select "node", :count => 3
assert_select "node[id='#{node.id}']", :count => 1
def test_map_empty
get :index, :params => { :bbox => "179.998,89.998,179.999.1,89.999" }
assert_response :success, "The map call should have succeeded"
- assert_select "osm[version='#{API_VERSION}'][generator='#{GENERATOR}']", :count => 1 do
+ assert_select "osm[version='#{Settings.api_version}'][generator='#{Settings.generator}']", :count => 1 do
assert_select "bounds[minlon='179.9980000'][minlat='89.9980000'][maxlon='179.9990000'][maxlat='89.9990000']", :count => 1
assert_select "node", :count => 0
assert_select "way", :count => 0
@badbigbbox.each do |bbox|
get :index, :params => { :bbox => bbox }
assert_response :bad_request, "The bbox:#{bbox} was expected to be too big"
- assert_equal "The maximum bbox size is #{MAX_REQUEST_AREA}, and your request was too large. Either request a smaller area, or use planet.osm", @response.body, "bbox: #{bbox}"
+ assert_equal "The maximum bbox size is #{Settings.max_request_area}, and your request was too large. Either request a smaller area, or use planet.osm", @response.body, "bbox: #{bbox}"
end
end
assert_response :success
# count one osm element
- assert_select "osm[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1
+ assert_select "osm[version='#{Settings.api_version}'][generator='OpenStreetMap server']", 1
# we should have only the expected number of relations
assert_select "osm>relation", expected_relations.size
@badbigbbox.each do |bbox|
get :index, :params => { :bbox => bbox }
assert_response :bad_request, "The bbox:#{bbox} was expected to be too big"
- assert_equal "The maximum bbox size is #{MAX_REQUEST_AREA}, and your request was too large. Either request a smaller area, or use planet.osm", @response.body, "bbox: #{bbox}"
+ assert_equal "The maximum bbox size is #{Settings.max_request_area}, and your request was too large. Either request a smaller area, or use planet.osm", @response.body, "bbox: #{bbox}"
end
end
module Api
class TracesControllerTest < ActionController::TestCase
- def setup
- @gpx_trace_dir = Object.send("remove_const", "GPX_TRACE_DIR")
- Object.const_set("GPX_TRACE_DIR", Rails.root.join("test", "gpx", "traces"))
-
- @gpx_image_dir = Object.send("remove_const", "GPX_IMAGE_DIR")
- Object.const_set("GPX_IMAGE_DIR", Rails.root.join("test", "gpx", "images"))
- end
-
def teardown
- File.unlink(*Dir.glob(File.join(GPX_TRACE_DIR, "*.gpx")))
- File.unlink(*Dir.glob(File.join(GPX_IMAGE_DIR, "*.gif")))
-
- Object.send("remove_const", "GPX_TRACE_DIR")
- Object.const_set("GPX_TRACE_DIR", @gpx_trace_dir)
-
- Object.send("remove_const", "GPX_IMAGE_DIR")
- Object.const_set("GPX_IMAGE_DIR", @gpx_image_dir)
+ File.unlink(*Dir.glob(File.join(Settings.gpx_trace_dir, "*.gpx")))
+ File.unlink(*Dir.glob(File.join(Settings.gpx_image_dir, "*.gif")))
end
##
assert_equal "[OpenStreetMap] Test Message", e.subject
assert_match(/Test message body/, e.text_part.decoded)
assert_match(/Test message body/, e.html_part.decoded)
- assert_match %r{#{SERVER_URL}/messages/[0-9]+}, e.text_part.decoded
+ assert_match %r{#{Settings.server_url}/messages/[0-9]+}, e.text_part.decoded
ActionMailer::Base.deliveries.clear
m = Message.last
assert_equal user.id, m.from_user_id
private
def with_message_limit(value)
- max_messages_per_hour = Object.send("remove_const", "MAX_MESSAGES_PER_HOUR")
- Object.const_set("MAX_MESSAGES_PER_HOUR", value)
+ max_messages_per_hour = Settings.max_messages_per_hour
+ Settings.max_messages_per_hour = value
yield
- Object.send("remove_const", "MAX_MESSAGES_PER_HOUR")
- Object.const_set("MAX_MESSAGES_PER_HOUR", max_messages_per_hour)
+ Settings.max_messages_per_hour = max_messages_per_hour
end
end
##
# setup oauth keys
def setup
- Object.const_set("ID_KEY", create(:client_application).key)
- Object.const_set("POTLATCH2_KEY", create(:client_application).key)
+ Settings.id_key = create(:client_application).key
+ Settings.potlatch2_key = create(:client_application).key
stub_hostip_requests
end
##
# clear oauth keys
def teardown
- Object.send("remove_const", "ID_KEY")
- Object.send("remove_const", "POTLATCH2_KEY")
+ Settings.id_key = nil
+ Settings.potlatch2_key = nil
end
##
get :edit, :session => { :user => create(:user) }
assert_response :success
assert_template "edit"
- assert_template :partial => "_#{DEFAULT_EDITOR}", :count => 1
+ assert_template :partial => "_#{Settings.default_editor}", :count => 1
end
# Test the right editor gets used when the user has set a preference
require "minitest/mock"
class TracesControllerTest < ActionController::TestCase
- def setup
- @gpx_trace_dir = Object.send("remove_const", "GPX_TRACE_DIR")
- Object.const_set("GPX_TRACE_DIR", Rails.root.join("test", "gpx", "traces"))
-
- @gpx_image_dir = Object.send("remove_const", "GPX_IMAGE_DIR")
- Object.const_set("GPX_IMAGE_DIR", Rails.root.join("test", "gpx", "images"))
- end
-
def teardown
- File.unlink(*Dir.glob(File.join(GPX_TRACE_DIR, "*.gpx")))
- File.unlink(*Dir.glob(File.join(GPX_IMAGE_DIR, "*.gif")))
-
- Object.send("remove_const", "GPX_TRACE_DIR")
- Object.const_set("GPX_TRACE_DIR", @gpx_trace_dir)
-
- Object.send("remove_const", "GPX_IMAGE_DIR")
- Object.const_set("GPX_IMAGE_DIR", @gpx_image_dir)
+ File.unlink(*Dir.glob(File.join(Settings.gpx_trace_dir, "*.gpx")))
+ File.unlink(*Dir.glob(File.join(Settings.gpx_image_dir, "*.gif")))
end
##
def test_api_blocked
blocked_user = create(:user)
- get "/api/#{API_VERSION}/user/details"
+ get "/api/#{Settings.api_version}/user/details"
assert_response :unauthorized
- get "/api/#{API_VERSION}/user/details", :headers => auth_header(blocked_user.display_name, "test")
+ get "/api/#{Settings.api_version}/user/details", :headers => auth_header(blocked_user.display_name, "test")
assert_response :success
# now block the user
:reason => "testing",
:ends_at => Time.now.getutc + 5.minutes
)
- get "/api/#{API_VERSION}/user/details", :headers => auth_header(blocked_user.display_name, "test")
+ get "/api/#{Settings.api_version}/user/details", :headers => auth_header(blocked_user.display_name, "test")
assert_response :forbidden
end
:reason => "testing",
:ends_at => Time.now.getutc + 5.minutes
)
- get "/api/#{API_VERSION}/user/details", :headers => auth_header(blocked_user.display_name, "test")
+ get "/api/#{Settings.api_version}/user/details", :headers => auth_header(blocked_user.display_name, "test")
assert_response :forbidden
# revoke the ban
reset!
# access the API again. this time it should work
- get "/api/#{API_VERSION}/user/details", :headers => auth_header(blocked_user.display_name, "test")
+ get "/api/#{Settings.api_version}/user/details", :headers => auth_header(blocked_user.display_name, "test")
assert_response :success
end
end
def test_api_blocked
user = create(:user, :terms_seen => false, :terms_agreed => nil)
- get "/api/#{API_VERSION}/user/preferences", :headers => auth_header(user.display_name, "test")
+ get "/api/#{Settings.api_version}/user/preferences", :headers => auth_header(user.display_name, "test")
assert_response :forbidden
# touch it so that the user has seen the terms
user.terms_seen = true
user.save
- get "/api/#{API_VERSION}/user/preferences", :headers => auth_header(user.display_name, "test")
+ get "/api/#{Settings.api_version}/user/preferences", :headers => auth_header(user.display_name, "test")
assert_response :success
end
require "minitest/mock"
class TraceTest < ActiveSupport::TestCase
- def setup
- @gpx_trace_dir = Object.send("remove_const", "GPX_TRACE_DIR")
- Object.const_set("GPX_TRACE_DIR", Rails.root.join("test", "gpx", "traces"))
-
- @gpx_image_dir = Object.send("remove_const", "GPX_IMAGE_DIR")
- Object.const_set("GPX_IMAGE_DIR", Rails.root.join("test", "gpx", "images"))
- end
-
def teardown
- File.unlink(*Dir.glob(File.join(GPX_TRACE_DIR, "*.gpx")))
- File.unlink(*Dir.glob(File.join(GPX_IMAGE_DIR, "*.gif")))
-
- Object.send("remove_const", "GPX_TRACE_DIR")
- Object.const_set("GPX_TRACE_DIR", @gpx_trace_dir)
-
- Object.send("remove_const", "GPX_IMAGE_DIR")
- Object.const_set("GPX_IMAGE_DIR", @gpx_image_dir)
+ File.unlink(*Dir.glob(File.join(Settings.gpx_trace_dir, "*.gpx")))
+ File.unlink(*Dir.glob(File.join(Settings.gpx_image_dir, "*.gif")))
end
def test_visible
trace.reload
assert_equal 1, Tracepoint.where(:gpx_id => trace.id).count
+
+ # Check that the tile has been set prior to the bulk import
+ # i.e. that the callbacks have been run correctly
+ assert_equal 3221331576, Tracepoint.where(:gpx_id => trace.id).first.tile
end
end
FakeFS do
FakeFS::FileSystem.clone(Rails.root.join("test", "gpx"))
trace = create(:trace, :fixture => "a")
- icon_path = File.join(GPX_IMAGE_DIR, "#{trace.id}_icon.gif")
+ icon_path = File.join(Settings.gpx_image_dir, "#{trace.id}_icon.gif")
FileUtils.rm(icon_path)
assert_equal false, File.exist?(icon_path)
FakeFS do
FakeFS::FileSystem.clone(Rails.root.join("test", "gpx"))
trace = create(:trace, :fixture => "a")
- large_picture_path = File.join(GPX_IMAGE_DIR, "#{trace.id}.gif")
+ large_picture_path = File.join(Settings.gpx_image_dir, "#{trace.id}.gif")
FileUtils.rm(large_picture_path)
assert_equal false, File.exist?(large_picture_path)
# Take one of the current ways and add nodes to it until we are near the limit
assert way.valid?
# it already has 1 node
- 1.upto(MAX_NUMBER_OF_WAY_NODES / 2) do
+ 1.upto(Settings.max_number_of_way_nodes / 2) do
way.add_nd_num(node_a.id)
way.add_nd_num(node_b.id)
end