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 put "node/create" => "nodes#create"
34 get "node/:id/ways" => "ways#ways_for_node", :as => :node_ways, :id => /\d+/
35 get "node/:id/relations" => "relations#relations_for_node", :as => :node_relations, :id => /\d+/
36 get "node/:id/history" => "old_nodes#history", :as => :api_node_history, :id => /\d+/
37 post "node/:id/:version/redact" => "old_nodes#redact", :as => :node_version_redact, :version => /\d+/, :id => /\d+/
38 get "node/:id/:version" => "old_nodes#show", :as => :api_old_node, :id => /\d+/, :version => /\d+/
39 get "node/:id" => "nodes#show", :as => :api_node, :id => /\d+/
40 put "node/:id" => "nodes#update", :id => /\d+/
41 delete "node/:id" => "nodes#delete", :id => /\d+/
42 get "nodes" => "nodes#index"
44 put "way/create" => "ways#create"
45 get "way/:id/history" => "old_ways#history", :as => :api_way_history, :id => /\d+/
46 get "way/:id/full" => "ways#full", :as => :way_full, :id => /\d+/
47 get "way/:id/relations" => "relations#relations_for_way", :as => :way_relations, :id => /\d+/
48 post "way/:id/:version/redact" => "old_ways#redact", :as => :way_version_redact, :version => /\d+/, :id => /\d+/
49 get "way/:id/:version" => "old_ways#show", :as => :api_old_way, :id => /\d+/, :version => /\d+/
50 get "way/:id" => "ways#show", :as => :api_way, :id => /\d+/
51 put "way/:id" => "ways#update", :id => /\d+/
52 delete "way/:id" => "ways#delete", :id => /\d+/
53 get "ways" => "ways#index"
55 put "relation/create" => "relations#create"
56 get "relation/:id/relations" => "relations#relations_for_relation", :as => :relation_relations, :id => /\d+/
57 get "relation/:id/history" => "old_relations#history", :as => :api_relation_history, :id => /\d+/
58 get "relation/:id/full" => "relations#full", :as => :relation_full, :id => /\d+/
59 post "relation/:id/:version/redact" => "old_relations#redact", :as => :relation_version_redact, :version => /\d+/, :id => /\d+/
60 get "relation/:id/:version" => "old_relations#show", :as => :api_old_relation, :id => /\d+/, :version => /\d+/
61 get "relation/:id" => "relations#show", :as => :api_relation, :id => /\d+/
62 put "relation/:id" => "relations#update", :id => /\d+/
63 delete "relation/:id" => "relations#delete", :id => /\d+/
64 get "relations" => "relations#index"
66 get "map" => "map#index"
68 get "trackpoints" => "tracepoints#index"
70 get "user/:id" => "users#show", :id => /\d+/, :as => :api_user
71 get "user/details" => "users#details"
72 get "user/gpx_files" => "users#gpx_files"
73 get "users" => "users#index", :as => :api_users
75 resources :user_preferences, :except => [:new, :create, :edit], :param => :preference_key, :path => "user/preferences", :controller => "user_preferences" do
77 put "" => "user_preferences#update_all", :as => ""
81 resources :messages, :path => "user/messages", :constraints => { :id => /\d+/ }, :only => [:create, :show, :destroy], :controller => "messages", :as => :api_messages do
88 post "/user/messages/:id" => "messages#update", :as => :api_message_update
90 post "gpx/create" => "traces#create"
91 get "gpx/:id" => "traces#show", :as => :api_trace, :id => /\d+/
92 put "gpx/:id" => "traces#update", :id => /\d+/
93 delete "gpx/:id" => "traces#destroy", :id => /\d+/
94 get "gpx/:id/details" => "traces#show", :id => /\d+/
95 get "gpx/:id/data" => "traces#data", :as => :api_trace_data
98 namespace :api, :path => "api/0.6" do
100 resources :notes, :except => [:new, :edit, :update], :id => /\d+/, :controller => "notes" do
103 get "feed", :defaults => { :format => "rss" }
113 resources :user_blocks, :only => :show, :id => /\d+/, :controller => "user_blocks"
117 get "/way/:id" => "ways#show", :id => /\d+/, :as => :way
118 get "/way/:id/history" => "old_ways#index", :id => /\d+/, :as => :way_history
119 resources :old_ways, :path => "/way/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show
120 get "/node/:id" => "nodes#show", :id => /\d+/, :as => :node
121 get "/node/:id/history" => "old_nodes#index", :id => /\d+/, :as => :node_history
122 resources :old_nodes, :path => "/node/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show
123 get "/relation/:id" => "relations#show", :id => /\d+/, :as => :relation
124 get "/relation/:id/history" => "old_relations#index", :id => /\d+/, :as => :relation_history
125 resources :old_relations, :path => "/relation/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show
126 resources :changesets, :path => "changeset", :id => /\d+/, :only => :show do
127 match :subscribe, :unsubscribe, :on => :member, :via => [:get, :post]
129 get "/changeset/:id/comments/feed" => "changeset_comments#index", :as => :changeset_comments_feed, :id => /\d*/, :defaults => { :format => "rss" }
130 resources :notes, :path => "note", :id => /\d+/, :only => [:show, :new]
132 get "/user/:display_name/history" => "changesets#index"
133 get "/user/:display_name/history/feed" => "changesets#feed", :defaults => { :format => :atom }
134 get "/user/:display_name/notes" => "notes#index", :as => :user_notes
135 get "/history/friends" => "changesets#index", :friends => true, :as => "friend_changesets", :defaults => { :format => :html }
136 get "/history/nearby" => "changesets#index", :nearby => true, :as => "nearby_changesets", :defaults => { :format => :html }
138 get "/browse/way/:id", :to => redirect(:path => "/way/%{id}")
139 get "/browse/way/:id/history", :to => redirect(:path => "/way/%{id}/history")
140 get "/browse/node/:id", :to => redirect(:path => "/node/%{id}")
141 get "/browse/node/:id/history", :to => redirect(:path => "/node/%{id}/history")
142 get "/browse/relation/:id", :to => redirect(:path => "/relation/%{id}")
143 get "/browse/relation/:id/history", :to => redirect(:path => "/relation/%{id}/history")
144 get "/browse/changeset/:id", :to => redirect(:path => "/changeset/%{id}")
145 get "/browse/note/:id", :to => redirect(:path => "/note/%{id}")
146 get "/user/:display_name/edits", :to => redirect(:path => "/user/%{display_name}/history")
147 get "/user/:display_name/edits/feed", :to => redirect(:path => "/user/%{display_name}/history/feed")
148 get "/browse/friends", :to => redirect(:path => "/history/friends")
149 get "/browse/nearby", :to => redirect(:path => "/history/nearby")
150 get "/browse/changesets/feed", :to => redirect(:path => "/history/feed")
151 get "/browse/changesets", :to => redirect(:path => "/history")
152 get "/browse", :to => redirect(:path => "/history")
155 root :to => "site#index", :via => [:get, :post]
156 get "/edit" => "site#edit"
157 get "/copyright/:copyright_locale" => "site#copyright"
158 get "/copyright" => "site#copyright"
159 get "/welcome" => "site#welcome"
160 get "/fixthemap" => "site#fixthemap"
161 get "/help" => "site#help"
162 get "/about/:about_locale" => "site#about"
163 get "/about" => "site#about"
164 get "/communities" => "site#communities"
165 get "/history" => "changesets#index"
166 get "/history/feed" => "changesets#feed", :defaults => { :format => :atom }
167 get "/history/comments/feed" => "changeset_comments#index", :as => :changesets_comments_feed, :defaults => { :format => "rss" }
168 get "/export" => "site#export"
169 get "/login" => "sessions#new"
170 post "/login" => "sessions#create"
171 match "/logout" => "sessions#destroy", :via => [:get, :post]
172 get "/offline" => "site#offline"
173 get "/key" => "site#key"
174 get "/id" => "site#id"
175 get "/query" => "browse#query"
176 get "/user/new" => "users#new"
177 post "/user/new" => "users#create"
178 get "/user/terms" => "users#terms"
179 post "/user/save" => "users#save"
180 get "/user/:display_name/confirm/resend" => "confirmations#confirm_resend", :as => :user_confirm_resend
181 match "/user/:display_name/confirm" => "confirmations#confirm", :via => [:get, :post]
182 match "/user/confirm" => "confirmations#confirm", :via => [:get, :post]
183 match "/user/confirm-email" => "confirmations#confirm_email", :via => [:get, :post]
184 post "/user/go_public" => "users#go_public"
185 scope :user, :as => "user" do
186 get "forgot-password" => "passwords#new"
187 post "forgot-password" => "passwords#create"
188 get "reset-password" => "passwords#edit"
189 post "reset-password" => "passwords#update"
191 get "/user/suspended" => "users#suspended"
193 get "/index.html", :to => redirect(:path => "/")
194 get "/create-account.html", :to => redirect(:path => "/user/new")
195 get "/forgot-password.html", :to => redirect(:path => "/user/forgot-password")
198 get "/auth/failure" => "users#auth_failure"
199 match "/auth/:provider/callback" => "users#auth_success", :via => [:get, :post], :as => :auth_success
200 match "/auth/:provider" => "users#auth", :via => [:post, :patch], :as => :auth
203 get "/go/:code" => "site#permalink", :code => /[a-zA-Z0-9_@~]+[=-]*/, :as => :permalink
206 post "/preview/:type" => "site#preview", :as => :preview
209 resources :traces, :except => [:show]
210 get "/user/:display_name/traces/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/traces/tag/%{tag}")
211 get "/user/:display_name/traces/tag/:tag" => "traces#index"
212 get "/user/:display_name/traces/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/traces")
213 get "/user/:display_name/traces" => "traces#index"
214 get "/user/:display_name/traces/tag/:tag/rss" => "traces#georss", :defaults => { :format => :rss }
215 get "/user/:display_name/traces/rss" => "traces#georss", :defaults => { :format => :rss }
216 get "/user/:display_name/traces/:id" => "traces#show", :as => "show_trace"
217 scope "/user/:display_name/traces/:trace_id", :module => :traces do
218 get "picture" => "pictures#show", :as => "trace_picture"
219 get "icon" => "icons#show", :as => "trace_icon"
221 get "/traces/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/tag/%{tag}")
222 get "/traces/tag/:tag" => "traces#index"
223 get "/traces/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces")
224 get "/traces/tag/:tag/rss" => "traces#georss", :defaults => { :format => :rss }
225 get "/traces/rss" => "traces#georss", :defaults => { :format => :rss }
226 get "/traces/mine/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/mine/tag/%{tag}")
227 get "/traces/mine/tag/:tag" => "traces#mine"
228 get "/traces/mine/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/mine")
229 get "/traces/mine" => "traces#mine"
230 get "/trace/create", :to => redirect(:path => "/traces/new")
231 get "/trace/:id/data" => "traces#data", :id => /\d+/, :as => "trace_data"
232 get "/trace/:id/edit", :to => redirect(:path => "/traces/%{id}/edit")
235 resources :diary_entries, :path => "diary", :only => [:new, :create, :index] do
237 get "friends" => "diary_entries#index", :friends => true
238 get "nearby" => "diary_entries#index", :nearby => true
241 get "/user/:display_name/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss }
242 get "/diary/:language/rss" => "diary_entries#rss", :defaults => { :format => :rss }
243 get "/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss }
244 get "/user/:display_name/diary/comments/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/diary/comments")
245 get "/user/:display_name/diary/comments" => "diary_comments#index", :as => :diary_comments
246 get "/user/:display_name/diary" => "diary_entries#index"
247 get "/diary/:language" => "diary_entries#index"
248 scope "/user/:display_name" do
249 resources :diary_entries, :path => "diary", :only => [:edit, :update, :show], :id => /\d+/
251 post "/user/:display_name/diary/:id/hide" => "diary_entries#hide", :id => /\d+/, :as => :hide_diary_entry
252 post "/user/:display_name/diary/:id/unhide" => "diary_entries#unhide", :id => /\d+/, :as => :unhide_diary_entry
253 match "/user/:display_name/diary/:id/subscribe" => "diary_entries#subscribe", :via => [:get, :post], :as => :diary_entry_subscribe, :id => /\d+/
254 match "/user/:display_name/diary/:id/unsubscribe" => "diary_entries#unsubscribe", :via => [:get, :post], :as => :diary_entry_unsubscribe, :id => /\d+/
255 post "/user/:display_name/diary/:id/comments" => "diary_comments#create", :id => /\d+/, :as => :comment_diary_entry
256 post "/user/:display_name/diary/:id/comments/:comment/hide" => "diary_comments#hide", :id => /\d+/, :comment => /\d+/, :as => :hide_diary_comment
257 post "/user/:display_name/diary/:id/comments/:comment/unhide" => "diary_comments#unhide", :id => /\d+/, :comment => /\d+/, :as => :unhide_diary_comment
260 resources :users, :path => "user", :param => :display_name, :only => [:show, :destroy]
261 get "/user/:display_name/account", :to => redirect(:path => "/account/edit")
262 post "/user/:display_name/set_status" => "users#set_status", :as => :set_status_user
264 resource :account, :only => [:edit, :update, :destroy]
266 namespace :account do
267 resource :deletion, :only => [:show]
269 resource :dashboard, :only => [:show]
270 resource :preferences, :only => [:show, :edit, :update]
271 resource :profile, :only => [:edit, :update]
274 match "/user/:display_name/make_friend" => "friendships#make_friend", :via => [:get, :post], :as => "make_friend"
275 match "/user/:display_name/remove_friend" => "friendships#remove_friend", :via => [:get, :post], :as => "remove_friend"
278 match "/users" => "users#index", :via => [:get, :post]
279 match "/users/:status" => "users#index", :via => [:get, :post]
282 get "/search" => "geocoder#search"
283 post "/geocoder/search_latlon" => "geocoder#search_latlon"
284 post "/geocoder/search_osm_nominatim" => "geocoder#search_osm_nominatim"
285 post "/geocoder/search_osm_nominatim_reverse" => "geocoder#search_osm_nominatim_reverse"
288 get "/directions" => "directions#search"
291 post "/export/finish" => "export#finish"
292 get "/export/embed" => "export#embed"
295 resources :messages, :only => [:create, :show, :destroy] do
299 match :reply, :via => [:get, :post]
306 get "/user/:display_name/inbox", :to => redirect(:path => "/messages/inbox")
307 get "/user/:display_name/outbox", :to => redirect(:path => "/messages/outbox")
308 get "/message/new/:display_name" => "messages#new", :as => "new_message"
309 get "/message/read/:message_id", :to => redirect(:path => "/messages/%{message_id}")
312 scope "/user/:display_name" do
313 resource :user_mute, :only => [:create, :destroy], :path => "mute"
315 resources :user_mutes, :only => [:index]
317 # oauth admin pages (i.e: for setting up new clients, etc...)
318 scope "/user/:display_name" do
319 resources :oauth_clients
321 match "/oauth/revoke" => "oauth#revoke", :via => [:get, :post]
322 match "/oauth/authorize" => "oauth#authorize", :via => [:get, :post], :as => :authorize
323 get "/oauth/token" => "oauth#token", :as => :token
324 match "/oauth/request_token" => "oauth#request_token", :via => [:get, :post], :as => :request_token
325 match "/oauth/access_token" => "oauth#access_token", :via => [:get, :post], :as => :access_token
326 get "/oauth/test_request" => "oauth#test_request", :as => :test_request
328 # roles and banning pages
329 post "/user/:display_name/role/:role/grant" => "user_roles#grant", :as => "grant_role"
330 post "/user/:display_name/role/:role/revoke" => "user_roles#revoke", :as => "revoke_role"
331 get "/user/:display_name/blocks" => "user_blocks#blocks_on", :as => "user_blocks_on"
332 get "/user/:display_name/blocks_by" => "user_blocks#blocks_by", :as => "user_blocks_by"
333 get "/blocks/new/:display_name" => "user_blocks#new", :as => "new_user_block"
334 resources :user_blocks, :except => :new
335 match "/blocks/:id/revoke" => "user_blocks#revoke", :via => [:get, :post], :as => "revoke_user_block"
336 match "/user/:display_name/blocks/revoke_all" => "user_blocks#revoke_all", :via => [:get, :post], :as => "revoke_all_user_blocks"
340 resources :comments, :controller => :issue_comments
352 resources :redactions
355 match "/400", :to => "errors#bad_request", :via => :all
356 match "/403", :to => "errors#forbidden", :via => :all
357 match "/404", :to => "errors#not_found", :via => :all
358 match "/500", :to => "errors#internal_server_error", :via => :all