1 OpenStreetMap::Application.routes.draw do
2 use_doorkeeper :scope => "oauth2" do
3 controllers :authorizations => "oauth2_authorizations",
4 :applications => "oauth2_applications",
5 :authorized_applications => "oauth2_authorized_applications"
8 use_doorkeeper_openid_connect :scope => "oauth2" if Settings.key?(:doorkeeper_signing_key)
12 get "capabilities" => "capabilities#show" # Deprecated, remove when 0.6 support is removed
13 get "versions" => "versions#show"
16 scope "api/0.6", :module => :api do
17 get "capabilities" => "capabilities#show"
18 get "permissions" => "permissions#show"
20 put "changeset/create" => "changesets#create"
21 post "changeset/:id/upload" => "changesets#upload", :as => :changeset_upload, :id => /\d+/
22 get "changeset/:id/download" => "changesets#download", :as => :changeset_download, :id => /\d+/
23 get "changeset/:id" => "changesets#show", :as => :changeset_show, :id => /\d+/
24 post "changeset/:id/subscribe" => "changesets#subscribe", :as => :api_changeset_subscribe, :id => /\d+/
25 post "changeset/:id/unsubscribe" => "changesets#unsubscribe", :as => :api_changeset_unsubscribe, :id => /\d+/
26 put "changeset/:id" => "changesets#update", :id => /\d+/
27 put "changeset/:id/close" => "changesets#close", :as => :changeset_close, :id => /\d+/
28 get "changesets" => "changesets#index"
29 post "changeset/:id/comment" => "changeset_comments#create", :as => :changeset_comment, :id => /\d+/
30 post "changeset/comment/:id/hide" => "changeset_comments#destroy", :as => :changeset_comment_hide, :id => /\d+/
31 post "changeset/comment/:id/unhide" => "changeset_comments#restore", :as => :changeset_comment_unhide, :id => /\d+/
33 post "node/:node_id/:version/redact" => "old_nodes#redact", :as => :node_version_redact, :version => /\d+/, :node_id => /\d+/
35 post "way/:way_id/:version/redact" => "old_ways#redact", :as => :way_version_redact, :version => /\d+/, :id => /\d+/
37 post "relation/:relation_id/:version/redact" => "old_relations#redact", :as => :relation_version_redact, :version => /\d+/, :id => /\d+/
40 namespace :api, :path => "api/0.6" do
41 resources :nodes, :only => [:index, :create]
42 resources :nodes, :path => "node", :id => /\d+/, :only => [:show, :update, :destroy] do
43 scope :module => :nodes do
44 resources :ways, :only => :index
45 resources :relations, :only => :index
47 resources :versions, :path => "history", :controller => :old_nodes, :only => :index
48 resources :versions, :path => "", :version => /\d+/, :param => :version, :controller => :old_nodes, :only => :show
50 put "node/create" => "nodes#create", :as => nil
52 resources :ways, :only => [:index, :create]
53 resources :ways, :path => "way", :id => /\d+/, :only => [:show, :update, :destroy] do
55 get :full, :action => :show, :full => true, :as => nil
57 scope :module => :ways do
58 resources :relations, :only => :index
60 resources :versions, :path => "history", :controller => :old_ways, :only => :index
61 resources :versions, :path => "", :version => /\d+/, :param => :version, :controller => :old_ways, :only => :show
63 put "way/create" => "ways#create", :as => nil
65 resources :relations, :only => [:index, :create]
66 resources :relations, :path => "relation", :id => /\d+/, :only => [:show, :update, :destroy] do
68 get :full, :action => :show, :full => true, :as => nil
70 scope :module => :relations do
71 resources :relations, :only => :index
73 resources :versions, :path => "history", :controller => :old_relations, :only => :index
74 resources :versions, :path => "", :version => /\d+/, :param => :version, :controller => :old_relations, :only => :show
76 put "relation/create" => "relations#create", :as => nil
78 resource :map, :only => :show
80 resources :tracepoints, :path => "trackpoints", :only => :index
82 resources :users, :only => :index
83 resources :users, :path => "user", :id => /\d+/, :only => :show
84 resources :user_traces, :path => "user/gpx_files", :module => :users, :controller => :traces, :only => :index
85 get "user/details" => "users#details"
87 resources :user_preferences, :except => [:new, :create, :edit], :param => :preference_key, :path => "user/preferences" do
89 put "" => "user_preferences#update_all", :as => ""
93 resources :messages, :path => "user/messages", :constraints => { :id => /\d+/ }, :only => [:create, :show, :update, :destroy]
94 namespace :messages, :path => "user/messages" do
95 resource :inbox, :only => :show
96 resource :outbox, :only => :show
98 post "/user/messages/:id" => "messages#update", :as => nil
100 resources :traces, :path => "gpx", :only => [:create, :show, :update, :destroy], :id => /\d+/ do
101 scope :module => :traces do
102 resource :data, :only => :show
105 post "gpx/create" => "traces#create", :id => /\d+/, :as => :trace_create
106 get "gpx/:id/details" => "traces#show", :id => /\d+/, :as => :trace_details
109 resources :notes, :except => [:new, :edit, :update], :id => /\d+/, :controller => "notes" do
112 get "feed", :defaults => { :format => "rss" }
121 resource :subscription, :only => [:create, :destroy], :controller => "note_subscriptions"
124 resources :user_blocks, :only => :show, :id => /\d+/, :controller => "user_blocks"
125 namespace :user_blocks, :path => "user/blocks" do
126 resource :active_list, :path => "active", :only => :show
131 get "/way/:id" => "ways#show", :id => /\d+/, :as => :way
132 get "/way/:id/history" => "old_ways#index", :id => /\d+/, :as => :way_history
133 resources :old_ways, :path => "/way/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show
134 get "/node/:id" => "nodes#show", :id => /\d+/, :as => :node
135 get "/node/:id/history" => "old_nodes#index", :id => /\d+/, :as => :node_history
136 resources :old_nodes, :path => "/node/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show
137 get "/relation/:id" => "relations#show", :id => /\d+/, :as => :relation
138 get "/relation/:id/history" => "old_relations#index", :id => /\d+/, :as => :relation_history
139 resources :old_relations, :path => "/relation/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show
141 resources :changesets, :path => "changeset", :id => /\d+/, :only => :show do
142 resource :subscription, :controller => :changeset_subscriptions, :only => [:show, :create, :destroy]
143 namespace :changeset_comments, :as => :comments, :path => :comments do
144 resource :feed, :only => :show, :defaults => { :format => "rss" }
147 get "/changeset/:id/subscribe", :id => /\d+/, :to => redirect(:path => "/changeset/%{id}/subscription")
148 get "/changeset/:id/unsubscribe", :id => /\d+/, :to => redirect(:path => "/changeset/%{id}/subscription")
150 resources :notes, :path => "note", :id => /\d+/, :only => [:show, :new]
152 get "/user/:display_name/history" => "changesets#index"
153 get "/user/:display_name/history/feed" => "changesets#feed", :defaults => { :format => :atom }
154 get "/user/:display_name/notes" => "notes#index", :as => :user_notes
155 get "/history/friends" => "changesets#index", :friends => true, :as => "friend_changesets", :defaults => { :format => :html }
156 get "/history/nearby" => "changesets#index", :nearby => true, :as => "nearby_changesets", :defaults => { :format => :html }
158 get "/browse/way/:id", :to => redirect(:path => "/way/%{id}")
159 get "/browse/way/:id/history", :to => redirect(:path => "/way/%{id}/history")
160 get "/browse/node/:id", :to => redirect(:path => "/node/%{id}")
161 get "/browse/node/:id/history", :to => redirect(:path => "/node/%{id}/history")
162 get "/browse/relation/:id", :to => redirect(:path => "/relation/%{id}")
163 get "/browse/relation/:id/history", :to => redirect(:path => "/relation/%{id}/history")
164 get "/browse/changeset/:id", :to => redirect(:path => "/changeset/%{id}")
165 get "/browse/note/:id", :to => redirect(:path => "/note/%{id}")
166 get "/user/:display_name/edits", :to => redirect(:path => "/user/%{display_name}/history")
167 get "/user/:display_name/edits/feed", :to => redirect(:path => "/user/%{display_name}/history/feed")
168 get "/browse/friends", :to => redirect(:path => "/history/friends")
169 get "/browse/nearby", :to => redirect(:path => "/history/nearby")
170 get "/browse/changesets/feed", :to => redirect(:path => "/history/feed")
171 get "/browse/changesets", :to => redirect(:path => "/history")
172 get "/browse", :to => redirect(:path => "/history")
175 root :to => "site#index", :via => [:get, :post]
176 get "/edit" => "site#edit"
177 get "/copyright/:copyright_locale" => "site#copyright"
178 get "/copyright" => "site#copyright"
179 get "/welcome" => "site#welcome"
180 get "/fixthemap" => "site#fixthemap"
181 get "/help" => "site#help"
182 get "/about/:about_locale" => "site#about"
183 get "/about" => "site#about"
184 get "/communities" => "site#communities"
185 get "/history" => "changesets#index"
186 get "/history/feed" => "changesets#feed", :defaults => { :format => :atom }
188 namespace :changeset_comments, :path => :comments, :as => :changesets_comments do
189 resource :feed, :only => :show, :defaults => { :format => "rss" }
192 get "/export" => "site#export"
193 get "/login" => "sessions#new"
194 post "/login" => "sessions#create"
195 match "/logout" => "sessions#destroy", :via => [:get, :post]
196 get "/offline" => "site#offline"
197 get "/key" => "site#key"
198 get "/id" => "site#id"
199 get "/query" => "browse#query"
200 post "/user/:display_name/confirm/resend" => "confirmations#confirm_resend", :as => :user_confirm_resend
201 match "/user/:display_name/confirm" => "confirmations#confirm", :via => [:get, :post]
202 match "/user/confirm" => "confirmations#confirm", :via => [:get, :post]
203 match "/user/confirm-email" => "confirmations#confirm_email", :via => [:get, :post]
204 post "/user/go_public" => "users#go_public"
205 scope :user, :as => "user" do
206 get "forgot-password" => "passwords#new"
207 post "forgot-password" => "passwords#create"
208 get "reset-password" => "passwords#edit"
209 post "reset-password" => "passwords#update"
211 get "/user/suspended" => "users#suspended"
213 get "/index.html", :to => redirect(:path => "/")
214 get "/create-account.html", :to => redirect(:path => "/user/new")
215 get "/forgot-password.html", :to => redirect(:path => "/user/forgot-password")
218 get "/auth/failure" => "users#auth_failure"
219 match "/auth/:provider/callback" => "users#auth_success", :via => [:get, :post], :as => :auth_success
220 match "/auth/:provider" => "users#auth", :via => [:post, :patch], :as => :auth
223 get "/go/:code" => "site#permalink", :code => /[a-zA-Z0-9_@~]+[=-]*/, :as => :permalink
226 post "/preview/:type" => "site#preview", :as => :preview
229 resources :traces, :id => /\d+/, :except => [:show] do
230 resource :data, :module => :traces, :only => :show
232 get "/user/:display_name/traces/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/traces/tag/%{tag}")
233 get "/user/:display_name/traces/tag/:tag" => "traces#index"
234 get "/user/:display_name/traces/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/traces")
235 get "/user/:display_name/traces" => "traces#index"
236 get "/user/:display_name/traces/:id" => "traces#show", :id => /\d+/, :as => "show_trace"
237 scope "/user/:display_name/traces/:trace_id", :module => :traces, :trace_id => /\d+/ do
238 get "picture" => "pictures#show", :as => "trace_picture"
239 get "icon" => "icons#show", :as => "trace_icon"
241 get "/traces/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/tag/%{tag}")
242 get "/traces/tag/:tag" => "traces#index"
243 get "/traces/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces")
244 get "/traces/mine/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/mine/tag/%{tag}")
245 get "/traces/mine/tag/:tag" => "traces#mine"
246 get "/traces/mine/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/mine")
247 get "/traces/mine" => "traces#mine"
248 get "/trace/create", :to => redirect(:path => "/traces/new")
249 get "/trace/:id/data", :format => false, :id => /\d+/, :to => redirect(:path => "/traces/%{id}/data")
250 get "/trace/:id/data.:format", :id => /\d+/, :to => redirect(:path => "/traces/%{id}/data.%{format}")
251 get "/trace/:id/edit", :id => /\d+/, :to => redirect(:path => "/traces/%{id}/edit")
253 namespace :traces, :path => "" do
254 resource :feed, :path => "(/user/:display_name)/traces(/tag/:tag)/rss", :only => :show, :defaults => { :format => :rss }
258 resources :diary_entries, :path => "diary", :only => [:new, :create, :index] do
260 get "friends" => "diary_entries#index", :friends => true
261 get "nearby" => "diary_entries#index", :nearby => true
264 get "/user/:display_name/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss }
265 get "/diary/:language/rss" => "diary_entries#rss", :defaults => { :format => :rss }
266 get "/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss }
267 get "/user/:display_name/diary" => "diary_entries#index"
268 get "/diary/:language" => "diary_entries#index"
269 scope "/user/:display_name" do
270 resources :diary_entries, :path => "diary", :only => [:edit, :update, :show], :id => /\d+/ do
277 match "/user/:display_name/diary/:id/subscribe" => "diary_entries#subscribe", :via => [:get, :post], :as => :diary_entry_subscribe, :id => /\d+/
278 match "/user/:display_name/diary/:id/unsubscribe" => "diary_entries#unsubscribe", :via => [:get, :post], :as => :diary_entry_unsubscribe, :id => /\d+/
279 post "/user/:display_name/diary/:id/comments" => "diary_comments#create", :id => /\d+/, :as => :comment_diary_entry
280 post "/diary_comments/:comment/hide" => "diary_comments#hide", :comment => /\d+/, :as => :hide_diary_comment
281 post "/diary_comments/:comment/unhide" => "diary_comments#unhide", :comment => /\d+/, :as => :unhide_diary_comment
284 get "/user/terms", :to => redirect(:path => "/account/terms")
285 resources :users, :path => "user", :param => :display_name, :only => [:new, :create, :show] do
286 resource :role, :controller => "user_roles", :path => "roles/:role", :only => [:create, :destroy]
287 scope :module => :users do
288 resources :diary_comments, :only => :index
289 resources :changeset_comments, :only => :index
290 resource :issued_blocks, :path => "blocks_by", :only => :show
291 resource :received_blocks, :path => "blocks", :only => [:show, :edit, :destroy]
292 resource :status, :only => :update
295 get "/user/:display_name/account", :to => redirect(:path => "/account/edit")
296 get "/user/:display_name/diary/comments(/:page)", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/diary_comments")
298 resource :account, :only => [:edit, :update, :destroy] do
299 scope :module => :accounts do
300 resource :terms, :only => [:show, :update]
301 resource :pd_declaration, :only => [:show, :create]
302 resource :deletion, :only => :show
306 resource :dashboard, :only => [:show]
307 resource :preferences, :only => [:show, :update]
308 get "/preferences/edit", :to => redirect(:path => "/preferences")
309 resource :profile, :only => [:edit, :update]
312 scope "/user/:display_name" do
313 resource :follow, :only => [:create, :destroy, :show], :path => "follow"
315 get "make_friend", :to => redirect("/user/%{display_name}/follow")
316 get "remove_friend", :to => redirect("/user/%{display_name}/follow")
321 resource :list, :path => "(:status)", :only => [:show, :update]
325 get "/search" => "geocoder#search"
326 post "/geocoder/search_latlon" => "geocoder#search_latlon"
327 post "/geocoder/search_osm_nominatim" => "geocoder#search_osm_nominatim"
328 post "/geocoder/search_osm_nominatim_reverse" => "geocoder#search_osm_nominatim_reverse"
331 get "/directions" => "directions#search"
334 post "/export/finish" => "export#finish"
335 get "/export/embed" => "export#embed"
338 resources :messages, :path_names => { :new => "new/:display_name" }, :id => /\d+/, :only => [:new, :create, :show, :destroy] do
339 scope :module => :messages do
340 resource :reply, :path_names => { :new => "new" }, :only => :new
341 resource :read_mark, :only => [:create, :destroy]
342 resource :mute, :only => :destroy
345 namespace :messages, :path => "/messages" do
346 resource :inbox, :only => :show
347 resource :muted_inbox, :path => "muted", :only => :show
348 resource :outbox, :only => :show
350 get "/user/:display_name/inbox", :to => redirect(:path => "/messages/inbox")
351 get "/user/:display_name/outbox", :to => redirect(:path => "/messages/outbox")
352 get "/message/new/:display_name", :to => redirect(:path => "/messages/new/%{display_name}")
353 get "/message/read/:message_id", :to => redirect(:path => "/messages/%{message_id}")
354 get "/messages/:message_id/reply", :to => redirect(:path => "/messages/%{message_id}/reply/new")
357 scope "/user/:display_name" do
358 resource :user_mute, :only => [:create, :destroy], :path => "mute"
360 resources :user_mutes, :only => [:index]
363 resources :user_blocks, :path_names => { :new => "new/:display_name" }
367 resources :comments, :controller => :issue_comments
379 resources :redactions
382 match "/400", :to => "errors#bad_request", :via => :all
383 match "/403", :to => "errors#forbidden", :via => :all
384 match "/404", :to => "errors#not_found", :via => :all
385 match "/500", :to => "errors#internal_server_error", :via => :all