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 post "changeset/:id/upload" => "changesets#upload", :as => :changeset_upload, :id => /\d+/
21 post "changeset/:id/subscribe" => "changesets#subscribe", :as => :api_changeset_subscribe, :id => /\d+/
22 post "changeset/:id/unsubscribe" => "changesets#unsubscribe", :as => :api_changeset_unsubscribe, :id => /\d+/
23 put "changeset/:id/close" => "changesets#close", :as => :changeset_close, :id => /\d+/
26 namespace :api, :path => "api/0.6" do
27 resources :changesets, :only => [:index, :create]
28 resources :changesets, :path => "changeset", :id => /\d+/, :only => [:show, :update] do
29 resource :download, :module => :changesets, :only => :show
30 resources :changeset_comments, :path => "comment", :only => :create
32 put "changeset/create" => "changesets#create", :as => nil
34 resources :changeset_comments, :id => /\d+/, :only => :index do
35 resource :visibility, :module => :changeset_comments, :only => [:create, :destroy]
37 post "changeset/comment/:changeset_comment_id/unhide" => "changeset_comments/visibilities#create", :changeset_comment_id => /\d+/, :as => nil
38 post "changeset/comment/:changeset_comment_id/hide" => "changeset_comments/visibilities#destroy", :changeset_comment_id => /\d+/, :as => nil
40 resources :nodes, :only => [:index, :create]
41 resources :nodes, :path => "node", :id => /\d+/, :only => [:show, :update, :destroy] do
42 scope :module => :nodes do
43 resources :ways, :only => :index
44 resources :relations, :only => :index
46 resources :versions, :path => "history", :controller => :old_nodes, :only => :index
47 resource :version, :path => ":version", :version => /\d+/, :controller => :old_nodes, :only => :show do
48 resource :redaction, :module => :old_nodes, :only => [:create, :destroy]
51 put "node/create" => "nodes#create", :as => nil
52 post "node/:node_id/:version/redact" => "old_nodes/redactions#create", :node_id => /\d+/, :version => /\d+/, :allow_delete => true, :as => nil
54 resources :ways, :only => [:index, :create]
55 resources :ways, :path => "way", :id => /\d+/, :only => [:show, :update, :destroy] do
57 get :full, :action => :show, :full => true, :as => nil
59 scope :module => :ways do
60 resources :relations, :only => :index
62 resources :versions, :path => "history", :controller => :old_ways, :only => :index
63 resource :version, :path => ":version", :version => /\d+/, :controller => :old_ways, :only => :show do
64 resource :redaction, :module => :old_ways, :only => [:create, :destroy]
67 put "way/create" => "ways#create", :as => nil
68 post "way/:way_id/:version/redact" => "old_ways/redactions#create", :way_id => /\d+/, :version => /\d+/, :allow_delete => true, :as => nil
70 resources :relations, :only => [:index, :create]
71 resources :relations, :path => "relation", :id => /\d+/, :only => [:show, :update, :destroy] do
73 get :full, :action => :show, :full => true, :as => nil
75 scope :module => :relations do
76 resources :relations, :only => :index
78 resources :versions, :path => "history", :controller => :old_relations, :only => :index
79 resource :version, :path => ":version", :version => /\d+/, :controller => :old_relations, :only => :show do
80 resource :redaction, :module => :old_relations, :only => [:create, :destroy]
83 put "relation/create" => "relations#create", :as => nil
84 post "relation/:relation_id/:version/redact" => "old_relations/redactions#create", :relation_id => /\d+/, :version => /\d+/, :allow_delete => true, :as => nil
86 resource :map, :only => :show
88 resources :tracepoints, :path => "trackpoints", :only => :index
90 resources :users, :only => :index
91 resources :users, :path => "user", :id => /\d+/, :only => :show
92 resources :user_traces, :path => "user/gpx_files", :module => :users, :controller => :traces, :only => :index
93 get "user/details" => "users#details"
95 resources :user_preferences, :except => [:new, :create, :edit], :param => :preference_key, :path => "user/preferences" do
97 put "" => "user_preferences#update_all", :as => ""
101 resources :messages, :path => "user/messages", :constraints => { :id => /\d+/ }, :only => [:create, :show, :update, :destroy]
102 namespace :messages, :path => "user/messages" do
103 resource :inbox, :only => :show
104 resource :outbox, :only => :show
106 post "/user/messages/:id" => "messages#update", :as => nil
108 resources :traces, :path => "gpx", :only => [:create, :show, :update, :destroy], :id => /\d+/ do
109 scope :module => :traces do
110 resource :data, :only => :show
113 post "gpx/create" => "traces#create", :id => /\d+/, :as => :trace_create
114 get "gpx/:id/details" => "traces#show", :id => /\d+/, :as => :trace_details
117 resources :notes, :except => [:new, :edit, :update], :id => /\d+/, :controller => "notes" do
120 get "feed", :defaults => { :format => "rss" }
129 resource :subscription, :only => [:create, :destroy], :controller => "note_subscriptions"
132 resources :user_blocks, :only => [:show, :create], :id => /\d+/, :controller => "user_blocks"
133 namespace :user_blocks, :path => "user/blocks" do
134 resource :active_list, :path => "active", :only => :show
139 get "/way/:id" => "ways#show", :id => /\d+/, :as => :way
140 get "/way/:id/history" => "old_ways#index", :id => /\d+/, :as => :way_history
141 resources :old_ways, :path => "/way/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show
142 get "/node/:id" => "nodes#show", :id => /\d+/, :as => :node
143 get "/node/:id/history" => "old_nodes#index", :id => /\d+/, :as => :node_history
144 resources :old_nodes, :path => "/node/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show
145 get "/relation/:id" => "relations#show", :id => /\d+/, :as => :relation
146 get "/relation/:id/history" => "old_relations#index", :id => /\d+/, :as => :relation_history
147 resources :old_relations, :path => "/relation/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show
149 resources :changesets, :path => "changeset", :id => /\d+/, :only => :show do
150 resource :subscription, :controller => :changeset_subscriptions, :only => [:show, :create, :destroy]
151 namespace :changeset_comments, :as => :comments, :path => :comments do
152 resource :feed, :only => :show, :defaults => { :format => "rss" }
155 get "/changeset/:id/subscribe", :id => /\d+/, :to => redirect(:path => "/changeset/%{id}/subscription")
156 get "/changeset/:id/unsubscribe", :id => /\d+/, :to => redirect(:path => "/changeset/%{id}/subscription")
158 resources :notes, :path => "note", :id => /\d+/, :only => [:show, :new]
160 get "/user/:display_name/history" => "changesets#index"
161 get "/user/:display_name/history/feed" => "changesets#feed", :defaults => { :format => :atom }
162 get "/user/:display_name/notes" => "notes#index", :as => :user_notes
163 get "/history/friends" => "changesets#index", :friends => true, :as => "friend_changesets", :defaults => { :format => :html }
164 get "/history/nearby" => "changesets#index", :nearby => true, :as => "nearby_changesets", :defaults => { :format => :html }
166 get "/browse/way/:id", :to => redirect(:path => "/way/%{id}")
167 get "/browse/way/:id/history", :to => redirect(:path => "/way/%{id}/history")
168 get "/browse/node/:id", :to => redirect(:path => "/node/%{id}")
169 get "/browse/node/:id/history", :to => redirect(:path => "/node/%{id}/history")
170 get "/browse/relation/:id", :to => redirect(:path => "/relation/%{id}")
171 get "/browse/relation/:id/history", :to => redirect(:path => "/relation/%{id}/history")
172 get "/browse/changeset/:id", :to => redirect(:path => "/changeset/%{id}")
173 get "/browse/note/:id", :to => redirect(:path => "/note/%{id}")
174 get "/user/:display_name/edits", :to => redirect(:path => "/user/%{display_name}/history")
175 get "/user/:display_name/edits/feed", :to => redirect(:path => "/user/%{display_name}/history/feed")
176 get "/browse/friends", :to => redirect(:path => "/history/friends")
177 get "/browse/nearby", :to => redirect(:path => "/history/nearby")
178 get "/browse/changesets/feed", :to => redirect(:path => "/history/feed")
179 get "/browse/changesets", :to => redirect(:path => "/history")
180 get "/browse", :to => redirect(:path => "/history")
183 root :to => "site#index", :via => [:get, :post]
184 get "/edit" => "site#edit"
185 get "/copyright/:copyright_locale" => "site#copyright"
186 get "/copyright" => "site#copyright"
187 get "/welcome" => "site#welcome"
188 get "/fixthemap" => "site#fixthemap"
189 get "/help" => "site#help"
190 get "/about/:about_locale" => "site#about"
191 get "/about" => "site#about"
192 get "/communities" => "site#communities"
193 get "/history" => "changesets#index"
194 get "/history/feed" => "changesets#feed", :defaults => { :format => :atom }
196 namespace :changeset_comments, :path => :comments, :as => :changesets_comments do
197 resource :feed, :only => :show, :defaults => { :format => "rss" }
200 get "/export" => "site#export"
201 get "/login" => "sessions#new"
202 post "/login" => "sessions#create"
203 match "/logout" => "sessions#destroy", :via => [:get, :post]
204 get "/offline" => "site#offline"
205 get "/key" => "site#key"
206 get "/id" => "site#id"
207 get "/query" => "browse#query"
208 post "/user/:display_name/confirm/resend" => "confirmations#confirm_resend", :as => :user_confirm_resend
209 match "/user/:display_name/confirm" => "confirmations#confirm", :via => [:get, :post]
210 match "/user/confirm" => "confirmations#confirm", :via => [:get, :post]
211 match "/user/confirm-email" => "confirmations#confirm_email", :via => [:get, :post]
212 post "/user/go_public" => "users#go_public"
213 scope :user, :as => "user" do
214 get "forgot-password" => "passwords#new"
215 post "forgot-password" => "passwords#create"
216 get "reset-password" => "passwords#edit"
217 post "reset-password" => "passwords#update"
219 get "/user/suspended" => "users#suspended"
221 get "/index.html", :to => redirect(:path => "/")
222 get "/create-account.html", :to => redirect(:path => "/user/new")
223 get "/forgot-password.html", :to => redirect(:path => "/user/forgot-password")
226 get "/auth/failure" => "users#auth_failure"
227 match "/auth/:provider/callback" => "users#auth_success", :via => [:get, :post], :as => :auth_success
228 match "/auth/:provider" => "users#auth", :via => [:post, :patch], :as => :auth
231 get "/go/:code" => "site#permalink", :code => /[a-zA-Z0-9_@~]+[=-]*/, :as => :permalink
234 post "/preview/:type" => "site#preview", :as => :preview
237 resources :traces, :id => /\d+/, :except => [:show] do
238 resource :data, :module => :traces, :only => :show
240 get "/user/:display_name/traces/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/traces/tag/%{tag}")
241 get "/user/:display_name/traces/tag/:tag" => "traces#index"
242 get "/user/:display_name/traces/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/traces")
243 get "/user/:display_name/traces" => "traces#index"
244 get "/user/:display_name/traces/:id" => "traces#show", :id => /\d+/, :as => "show_trace"
245 scope "/user/:display_name/traces/:trace_id", :module => :traces, :trace_id => /\d+/ do
246 get "picture" => "pictures#show", :as => "trace_picture"
247 get "icon" => "icons#show", :as => "trace_icon"
249 get "/traces/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/tag/%{tag}")
250 get "/traces/tag/:tag" => "traces#index"
251 get "/traces/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces")
252 get "/traces/mine/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/mine/tag/%{tag}")
253 get "/traces/mine/tag/:tag" => "traces#mine"
254 get "/traces/mine/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/mine")
255 get "/traces/mine" => "traces#mine"
256 get "/trace/create", :to => redirect(:path => "/traces/new")
257 get "/trace/:id/data", :format => false, :id => /\d+/, :to => redirect(:path => "/traces/%{id}/data")
258 get "/trace/:id/data.:format", :id => /\d+/, :to => redirect(:path => "/traces/%{id}/data.%{format}")
259 get "/trace/:id/edit", :id => /\d+/, :to => redirect(:path => "/traces/%{id}/edit")
261 namespace :traces, :path => "" do
262 resource :feed, :path => "(/user/:display_name)/traces(/tag/:tag)/rss", :only => :show, :defaults => { :format => :rss }
266 resources :diary_entries, :path => "diary", :only => [:new, :create, :index] do
268 get "friends" => "diary_entries#index", :friends => true
269 get "nearby" => "diary_entries#index", :nearby => true
272 get "/user/:display_name/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss }
273 get "/diary/:language/rss" => "diary_entries#rss", :defaults => { :format => :rss }
274 get "/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss }
275 get "/user/:display_name/diary" => "diary_entries#index"
276 get "/diary/:language" => "diary_entries#index"
277 scope "/user/:display_name" do
278 resources :diary_entries, :path => "diary", :only => [:edit, :update, :show], :id => /\d+/ do
285 match "/user/:display_name/diary/:id/subscribe" => "diary_entries#subscribe", :via => [:get, :post], :as => :diary_entry_subscribe, :id => /\d+/
286 match "/user/:display_name/diary/:id/unsubscribe" => "diary_entries#unsubscribe", :via => [:get, :post], :as => :diary_entry_unsubscribe, :id => /\d+/
287 post "/user/:display_name/diary/:id/comments" => "diary_comments#create", :id => /\d+/, :as => :comment_diary_entry
288 post "/diary_comments/:comment/hide" => "diary_comments#hide", :comment => /\d+/, :as => :hide_diary_comment
289 post "/diary_comments/:comment/unhide" => "diary_comments#unhide", :comment => /\d+/, :as => :unhide_diary_comment
292 get "/user/terms", :to => redirect(:path => "/account/terms")
293 resources :users, :path => "user", :param => :display_name, :only => [:new, :create, :show] do
294 resource :role, :controller => "user_roles", :path => "roles/:role", :only => [:create, :destroy]
295 scope :module => :users do
296 resources :diary_comments, :only => :index
297 resources :changeset_comments, :only => :index
298 resource :issued_blocks, :path => "blocks_by", :only => :show
299 resource :received_blocks, :path => "blocks", :only => [:show, :edit, :destroy]
300 resource :status, :only => :update
303 get "/user/:display_name/account", :to => redirect(:path => "/account")
304 get "/user/:display_name/diary/comments(/:page)", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/diary_comments")
306 resource :account, :only => [:show, :update, :destroy] do
307 scope :module => :accounts do
308 resource :terms, :only => [:show, :update]
309 resource :pd_declaration, :only => [:show, :create]
310 resource :deletion, :only => :show
311 resource :home, :only => :show
314 get "/account/edit", :to => redirect(:path => "/account"), :as => nil
316 resource :dashboard, :only => [:show]
317 resource :preferences, :only => [:show, :update]
318 get "/preferences/edit", :to => redirect(:path => "/preferences")
319 resource :profile, :only => [:edit, :update]
322 scope "/user/:display_name" do
323 resource :follow, :only => [:create, :destroy, :show], :path => "follow"
325 get "make_friend", :to => redirect("/user/%{display_name}/follow")
326 get "remove_friend", :to => redirect("/user/%{display_name}/follow")
331 resource :list, :path => "(:status)", :only => [:show, :update]
335 get "/search" => "geocoder#search"
336 post "/geocoder/search_latlon" => "geocoder#search_latlon"
337 post "/geocoder/search_osm_nominatim" => "geocoder#search_osm_nominatim"
338 post "/geocoder/search_osm_nominatim_reverse" => "geocoder#search_osm_nominatim_reverse"
341 get "/directions" => "directions#search"
344 post "/export/finish" => "export#finish"
345 get "/export/embed" => "export#embed"
348 resources :messages, :path_names => { :new => "new/:display_name" }, :id => /\d+/, :only => [:new, :create, :show, :destroy] do
349 scope :module => :messages do
350 resource :reply, :path_names => { :new => "new" }, :only => :new
351 resource :read_mark, :only => [:create, :destroy]
352 resource :mute, :only => :destroy
355 namespace :messages, :path => "/messages" do
356 resource :inbox, :only => :show
357 resource :muted_inbox, :path => "muted", :only => :show
358 resource :outbox, :only => :show
360 get "/user/:display_name/inbox", :to => redirect(:path => "/messages/inbox")
361 get "/user/:display_name/outbox", :to => redirect(:path => "/messages/outbox")
362 get "/message/new/:display_name", :to => redirect(:path => "/messages/new/%{display_name}")
363 get "/message/read/:message_id", :to => redirect(:path => "/messages/%{message_id}")
364 get "/messages/:message_id/reply", :to => redirect(:path => "/messages/%{message_id}/reply/new")
367 scope "/user/:display_name" do
368 resource :user_mute, :only => [:create, :destroy], :path => "mute"
370 resources :user_mutes, :only => [:index]
373 resources :user_blocks, :path_names => { :new => "new/:display_name" }
377 resources :comments, :controller => :issue_comments
389 resources :redactions
392 match "/400", :to => "errors#bad_request", :via => :all
393 match "/403", :to => "errors#forbidden", :via => :all
394 match "/404", :to => "errors#not_found", :via => :all
395 match "/500", :to => "errors#internal_server_error", :via => :all