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"
17 get "capabilities" => "api/capabilities#show"
18 get "permissions" => "api/permissions#show"
20 put "changeset/create" => "api/changesets#create"
21 post "changeset/:id/upload" => "api/changesets#upload", :as => :changeset_upload, :id => /\d+/
22 get "changeset/:id/download" => "api/changesets#download", :as => :changeset_download, :id => /\d+/
23 get "changeset/:id" => "api/changesets#show", :as => :changeset_show, :id => /\d+/
24 post "changeset/:id/subscribe" => "api/changesets#subscribe", :as => :changeset_subscribe, :id => /\d+/
25 post "changeset/:id/unsubscribe" => "api/changesets#unsubscribe", :as => :changeset_unsubscribe, :id => /\d+/
26 put "changeset/:id" => "api/changesets#update", :id => /\d+/
27 put "changeset/:id/close" => "api/changesets#close", :as => :changeset_close, :id => /\d+/
28 get "changesets" => "api/changesets#query"
29 post "changeset/:id/comment" => "api/changeset_comments#create", :as => :changeset_comment, :id => /\d+/
30 post "changeset/comment/:id/hide" => "api/changeset_comments#destroy", :as => :changeset_comment_hide, :id => /\d+/
31 post "changeset/comment/:id/unhide" => "api/changeset_comments#restore", :as => :changeset_comment_unhide, :id => /\d+/
33 put "node/create" => "api/nodes#create"
34 get "node/:id/ways" => "api/ways#ways_for_node", :as => :node_ways, :id => /\d+/
35 get "node/:id/relations" => "api/relations#relations_for_node", :as => :node_relations, :id => /\d+/
36 get "node/:id/history" => "api/old_nodes#history", :as => :api_node_history, :id => /\d+/
37 post "node/:id/:version/redact" => "api/old_nodes#redact", :as => :node_version_redact, :version => /\d+/, :id => /\d+/
38 get "node/:id/:version" => "api/old_nodes#version", :as => :node_version, :id => /\d+/, :version => /\d+/
39 get "node/:id" => "api/nodes#show", :as => :api_node, :id => /\d+/
40 put "node/:id" => "api/nodes#update", :id => /\d+/
41 delete "node/:id" => "api/nodes#delete", :id => /\d+/
42 get "nodes" => "api/nodes#index"
44 put "way/create" => "api/ways#create"
45 get "way/:id/history" => "api/old_ways#history", :as => :api_way_history, :id => /\d+/
46 get "way/:id/full" => "api/ways#full", :as => :way_full, :id => /\d+/
47 get "way/:id/relations" => "api/relations#relations_for_way", :as => :way_relations, :id => /\d+/
48 post "way/:id/:version/redact" => "api/old_ways#redact", :as => :way_version_redact, :version => /\d+/, :id => /\d+/
49 get "way/:id/:version" => "api/old_ways#version", :as => :way_version, :id => /\d+/, :version => /\d+/
50 get "way/:id" => "api/ways#show", :as => :api_way, :id => /\d+/
51 put "way/:id" => "api/ways#update", :id => /\d+/
52 delete "way/:id" => "api/ways#delete", :id => /\d+/
53 get "ways" => "api/ways#index"
55 put "relation/create" => "api/relations#create"
56 get "relation/:id/relations" => "api/relations#relations_for_relation", :as => :relation_relations, :id => /\d+/
57 get "relation/:id/history" => "api/old_relations#history", :as => :api_relation_history, :id => /\d+/
58 get "relation/:id/full" => "api/relations#full", :as => :relation_full, :id => /\d+/
59 post "relation/:id/:version/redact" => "api/old_relations#redact", :as => :relation_version_redact, :version => /\d+/, :id => /\d+/
60 get "relation/:id/:version" => "api/old_relations#version", :as => :relation_version, :id => /\d+/, :version => /\d+/
61 get "relation/:id" => "api/relations#show", :as => :api_relation, :id => /\d+/
62 put "relation/:id" => "api/relations#update", :id => /\d+/
63 delete "relation/:id" => "api/relations#delete", :id => /\d+/
64 get "relations" => "api/relations#index"
66 get "map" => "api/map#index"
68 get "trackpoints" => "api/tracepoints#index"
70 get "user/:id" => "api/users#show", :id => /\d+/, :as => :api_user
71 get "user/details" => "api/users#details"
72 get "user/gpx_files" => "api/users#gpx_files"
73 get "users" => "api/users#index", :as => :api_users
75 resources :user_preferences, :except => [:new, :create, :edit], :param => :preference_key, :path => "user/preferences", :controller => "api/user_preferences" do
77 put "" => "api/user_preferences#update_all", :as => ""
81 post "gpx/create" => "api/traces#create"
82 get "gpx/:id" => "api/traces#show", :as => :api_trace, :id => /\d+/
83 put "gpx/:id" => "api/traces#update", :id => /\d+/
84 delete "gpx/:id" => "api/traces#destroy", :id => /\d+/
85 get "gpx/:id/details" => "api/traces#show", :id => /\d+/
86 get "gpx/:id/data" => "api/traces#data", :as => :api_trace_data
89 resources :notes, :except => [:new, :edit, :update], :constraints => { :id => /\d+/ }, :controller => "api/notes", :as => :api_notes do
92 get "feed", :defaults => { :format => "rss" }
102 post "notes/addPOIexec" => "api/notes#create"
103 post "notes/closePOIexec" => "api/notes#close"
104 post "notes/editPOIexec" => "api/notes#comment"
105 get "notes/getGPX" => "api/notes#index", :format => "gpx"
106 get "notes/getRSSfeed" => "api/notes#feed", :format => "rss"
108 resources :user_blocks, :only => [:show], :constraints => { :id => /\d+/ }, :controller => "api/user_blocks", :as => :api_user_blocks
112 get "/way/:id" => "browse#way", :id => /\d+/, :as => :way
113 get "/way/:id/history" => "browse#way_history", :id => /\d+/, :as => :way_history
114 get "/node/:id" => "browse#node", :id => /\d+/, :as => :node
115 get "/node/:id/history" => "browse#node_history", :id => /\d+/, :as => :node_history
116 get "/relation/:id" => "browse#relation", :id => /\d+/, :as => :relation
117 get "/relation/:id/history" => "browse#relation_history", :id => /\d+/, :as => :relation_history
118 get "/changeset/:id" => "browse#changeset", :as => :changeset, :id => /\d+/
119 get "/changeset/:id/comments/feed" => "changeset_comments#index", :as => :changeset_comments_feed, :id => /\d*/, :defaults => { :format => "rss" }
120 resources :notes, :path => "note", :only => [:show, :new]
122 get "/user/:display_name/history" => "changesets#index"
123 get "/user/:display_name/history/feed" => "changesets#feed", :defaults => { :format => :atom }
124 get "/user/:display_name/notes" => "notes#index", :as => :user_notes
125 get "/history/friends" => "changesets#index", :friends => true, :as => "friend_changesets", :defaults => { :format => :html }
126 get "/history/nearby" => "changesets#index", :nearby => true, :as => "nearby_changesets", :defaults => { :format => :html }
128 get "/browse/way/:id", :to => redirect(:path => "/way/%{id}")
129 get "/browse/way/:id/history", :to => redirect(:path => "/way/%{id}/history")
130 get "/browse/node/:id", :to => redirect(:path => "/node/%{id}")
131 get "/browse/node/:id/history", :to => redirect(:path => "/node/%{id}/history")
132 get "/browse/relation/:id", :to => redirect(:path => "/relation/%{id}")
133 get "/browse/relation/:id/history", :to => redirect(:path => "/relation/%{id}/history")
134 get "/browse/changeset/:id", :to => redirect(:path => "/changeset/%{id}")
135 get "/browse/note/:id", :to => redirect(:path => "/note/%{id}")
136 get "/user/:display_name/edits", :to => redirect(:path => "/user/%{display_name}/history")
137 get "/user/:display_name/edits/feed", :to => redirect(:path => "/user/%{display_name}/history/feed")
138 get "/browse/friends", :to => redirect(:path => "/history/friends")
139 get "/browse/nearby", :to => redirect(:path => "/history/nearby")
140 get "/browse/changesets/feed", :to => redirect(:path => "/history/feed")
141 get "/browse/changesets", :to => redirect(:path => "/history")
142 get "/browse", :to => redirect(:path => "/history")
145 root :to => "site#index", :via => [:get, :post]
146 get "/edit" => "site#edit"
147 get "/copyright/:copyright_locale" => "site#copyright"
148 get "/copyright" => "site#copyright"
149 get "/welcome" => "site#welcome"
150 get "/fixthemap" => "site#fixthemap"
151 get "/help" => "site#help"
152 get "/about/:about_locale" => "site#about"
153 get "/about" => "site#about"
154 get "/communities" => "site#communities"
155 get "/history" => "changesets#index"
156 get "/history/feed" => "changesets#feed", :defaults => { :format => :atom }
157 get "/history/comments/feed" => "changeset_comments#index", :as => :changesets_comments_feed, :defaults => { :format => "rss" }
158 get "/export" => "site#export"
159 get "/login" => "sessions#new"
160 post "/login" => "sessions#create"
161 match "/logout" => "sessions#destroy", :via => [:get, :post]
162 get "/offline" => "site#offline"
163 get "/key" => "site#key"
164 get "/id" => "site#id"
165 get "/query" => "browse#query"
166 get "/user/new" => "users#new"
167 post "/user/new" => "users#create"
168 get "/user/terms" => "users#terms"
169 post "/user/save" => "users#save"
170 get "/user/:display_name/confirm/resend" => "confirmations#confirm_resend", :as => :user_confirm_resend
171 match "/user/:display_name/confirm" => "confirmations#confirm", :via => [:get, :post]
172 match "/user/confirm" => "confirmations#confirm", :via => [:get, :post]
173 match "/user/confirm-email" => "confirmations#confirm_email", :via => [:get, :post]
174 post "/user/go_public" => "users#go_public"
175 scope :user, :as => "user" do
176 get "forgot-password" => "passwords#new"
177 post "forgot-password" => "passwords#create"
178 get "reset-password" => "passwords#edit"
179 post "reset-password" => "passwords#update"
181 get "/user/suspended" => "users#suspended"
183 get "/index.html", :to => redirect(:path => "/")
184 get "/create-account.html", :to => redirect(:path => "/user/new")
185 get "/forgot-password.html", :to => redirect(:path => "/user/forgot-password")
188 get "/auth/failure" => "users#auth_failure"
189 match "/auth/:provider/callback" => "users#auth_success", :via => [:get, :post], :as => :auth_success
190 match "/auth/:provider" => "users#auth", :via => [:post, :patch], :as => :auth
193 get "/go/:code" => "site#permalink", :code => /[a-zA-Z0-9_@~]+[=-]*/, :as => :permalink
196 post "/preview/:type" => "site#preview", :as => :preview
199 resources :traces, :except => [:show]
200 get "/user/:display_name/traces/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/traces/tag/%{tag}")
201 get "/user/:display_name/traces/tag/:tag" => "traces#index"
202 get "/user/:display_name/traces/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/traces")
203 get "/user/:display_name/traces" => "traces#index"
204 get "/user/:display_name/traces/tag/:tag/rss" => "traces#georss", :defaults => { :format => :rss }
205 get "/user/:display_name/traces/rss" => "traces#georss", :defaults => { :format => :rss }
206 get "/user/:display_name/traces/:id" => "traces#show", :as => "show_trace"
207 get "/user/:display_name/traces/:id/picture" => "traces#picture", :as => "trace_picture"
208 get "/user/:display_name/traces/:id/icon" => "traces#icon", :as => "trace_icon"
209 get "/traces/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/tag/%{tag}")
210 get "/traces/tag/:tag" => "traces#index"
211 get "/traces/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces")
212 get "/traces/tag/:tag/rss" => "traces#georss", :defaults => { :format => :rss }
213 get "/traces/rss" => "traces#georss", :defaults => { :format => :rss }
214 get "/traces/mine/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/mine/tag/%{tag}")
215 get "/traces/mine/tag/:tag" => "traces#mine"
216 get "/traces/mine/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/mine")
217 get "/traces/mine" => "traces#mine"
218 get "/trace/create", :to => redirect(:path => "/traces/new")
219 get "/trace/:id/data" => "traces#data", :id => /\d+/, :as => "trace_data"
220 get "/trace/:id/edit", :to => redirect(:path => "/traces/%{id}/edit")
223 resources :diary_entries, :path => "diary", :only => [:new, :create, :index] do
225 get "friends" => "diary_entries#index", :friends => true
226 get "nearby" => "diary_entries#index", :nearby => true
229 get "/user/:display_name/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss }
230 get "/diary/:language/rss" => "diary_entries#rss", :defaults => { :format => :rss }
231 get "/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss }
232 get "/user/:display_name/diary/comments/:page" => "diary_entries#comments", :page => /[1-9][0-9]*/
233 get "/user/:display_name/diary/comments/" => "diary_entries#comments", :as => :diary_comments
234 get "/user/:display_name/diary" => "diary_entries#index"
235 get "/diary/:language" => "diary_entries#index"
236 scope "/user/:display_name" do
237 resources :diary_entries, :path => "diary", :only => [:edit, :update, :show], :id => /\d+/
239 post "/user/:display_name/diary/:id/newcomment" => "diary_entries#comment", :id => /\d+/, :as => :comment_diary_entry
240 post "/user/:display_name/diary/:id/hide" => "diary_entries#hide", :id => /\d+/, :as => :hide_diary_entry
241 post "/user/:display_name/diary/:id/unhide" => "diary_entries#unhide", :id => /\d+/, :as => :unhide_diary_entry
242 post "/user/:display_name/diary/:id/hidecomment/:comment" => "diary_entries#hidecomment", :id => /\d+/, :comment => /\d+/, :as => :hide_diary_comment
243 post "/user/:display_name/diary/:id/unhidecomment/:comment" => "diary_entries#unhidecomment", :id => /\d+/, :comment => /\d+/, :as => :unhide_diary_comment
244 post "/user/:display_name/diary/:id/subscribe" => "diary_entries#subscribe", :as => :diary_entry_subscribe, :id => /\d+/
245 post "/user/:display_name/diary/:id/unsubscribe" => "diary_entries#unsubscribe", :as => :diary_entry_unsubscribe, :id => /\d+/
248 resources :users, :path => "user", :param => :display_name, :only => [:show, :destroy]
249 get "/user/:display_name/account", :to => redirect(:path => "/account/edit")
250 post "/user/:display_name/set_status" => "users#set_status", :as => :set_status_user
252 resource :account, :only => [:edit, :update, :destroy]
254 namespace :account do
255 resource :deletion, :only => [:show]
257 resource :dashboard, :only => [:show]
258 resource :preferences, :only => [:show, :edit, :update]
259 resource :profile, :only => [:edit, :update]
262 match "/user/:display_name/make_friend" => "friendships#make_friend", :via => [:get, :post], :as => "make_friend"
263 match "/user/:display_name/remove_friend" => "friendships#remove_friend", :via => [:get, :post], :as => "remove_friend"
266 match "/users" => "users#index", :via => [:get, :post]
267 match "/users/:status" => "users#index", :via => [:get, :post]
270 get "/search" => "geocoder#search"
271 post "/geocoder/search_latlon" => "geocoder#search_latlon"
272 post "/geocoder/search_osm_nominatim" => "geocoder#search_osm_nominatim"
273 post "/geocoder/search_osm_nominatim_reverse" => "geocoder#search_osm_nominatim_reverse"
276 get "/directions" => "directions#search"
279 post "/export/finish" => "export#finish"
280 get "/export/embed" => "export#embed"
283 resources :messages, :only => [:create, :show, :destroy] do
287 match :reply, :via => [:get, :post]
294 get "/user/:display_name/inbox", :to => redirect(:path => "/messages/inbox")
295 get "/user/:display_name/outbox", :to => redirect(:path => "/messages/outbox")
296 get "/message/new/:display_name" => "messages#new", :as => "new_message"
297 get "/message/read/:message_id", :to => redirect(:path => "/messages/%{message_id}")
300 scope "/user/:display_name" do
301 resource :user_mute, :only => [:create, :destroy], :path => "mute"
303 resources :user_mutes, :only => [:index]
305 # oauth admin pages (i.e: for setting up new clients, etc...)
306 scope "/user/:display_name" do
307 resources :oauth_clients
309 match "/oauth/revoke" => "oauth#revoke", :via => [:get, :post]
310 match "/oauth/authorize" => "oauth#authorize", :via => [:get, :post], :as => :authorize
311 get "/oauth/token" => "oauth#token", :as => :token
312 match "/oauth/request_token" => "oauth#request_token", :via => [:get, :post], :as => :request_token
313 match "/oauth/access_token" => "oauth#access_token", :via => [:get, :post], :as => :access_token
314 get "/oauth/test_request" => "oauth#test_request", :as => :test_request
316 # roles and banning pages
317 post "/user/:display_name/role/:role/grant" => "user_roles#grant", :as => "grant_role"
318 post "/user/:display_name/role/:role/revoke" => "user_roles#revoke", :as => "revoke_role"
319 get "/user/:display_name/blocks" => "user_blocks#blocks_on", :as => "user_blocks_on"
320 get "/user/:display_name/blocks_by" => "user_blocks#blocks_by", :as => "user_blocks_by"
321 get "/blocks/new/:display_name" => "user_blocks#new", :as => "new_user_block"
322 resources :user_blocks
323 match "/blocks/:id/revoke" => "user_blocks#revoke", :via => [:get, :post], :as => "revoke_user_block"
324 match "/user/:display_name/blocks/revoke_all" => "user_blocks#revoke_all", :via => [:get, :post], :as => "revoke_all_user_blocks"
328 resources :comments, :controller => :issue_comments
340 resources :redactions
343 match "/403", :to => "errors#forbidden", :via => :all
344 match "/404", :to => "errors#not_found", :via => :all
345 match "/500", :to => "errors#internal_server_error", :via => :all