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 get "node/:id/ways" => "ways#ways_for_node", :as => :node_ways, :id => /\d+/
34 get "node/:id/relations" => "relations#relations_for_node", :as => :node_relations, :id => /\d+/
35 get "node/:id/history" => "old_nodes#history", :as => :api_node_history, :id => /\d+/
36 post "node/:id/:version/redact" => "old_nodes#redact", :as => :node_version_redact, :version => /\d+/, :id => /\d+/
37 get "node/:id/:version" => "old_nodes#show", :as => :api_old_node, :id => /\d+/, :version => /\d+/
39 get "way/:id/history" => "old_ways#history", :as => :api_way_history, :id => /\d+/
40 get "way/:id/full" => "ways#full", :as => :way_full, :id => /\d+/
41 get "way/:id/relations" => "relations#relations_for_way", :as => :way_relations, :id => /\d+/
42 post "way/:id/:version/redact" => "old_ways#redact", :as => :way_version_redact, :version => /\d+/, :id => /\d+/
43 get "way/:id/:version" => "old_ways#show", :as => :api_old_way, :id => /\d+/, :version => /\d+/
45 get "relation/:id/relations" => "relations#relations_for_relation", :as => :relation_relations, :id => /\d+/
46 get "relation/:id/history" => "old_relations#history", :as => :api_relation_history, :id => /\d+/
47 get "relation/:id/full" => "relations#full", :as => :relation_full, :id => /\d+/
48 post "relation/:id/:version/redact" => "old_relations#redact", :as => :relation_version_redact, :version => /\d+/, :id => /\d+/
49 get "relation/:id/:version" => "old_relations#show", :as => :api_old_relation, :id => /\d+/, :version => /\d+/
52 namespace :api, :path => "api/0.6" do
53 resources :nodes, :only => [:index, :create]
54 resources :nodes, :path => "node", :id => /\d+/, :only => [:show, :update, :destroy]
55 put "node/create" => "nodes#create", :as => nil
57 resources :ways, :only => [:index, :create]
58 resources :ways, :path => "way", :id => /\d+/, :only => [:show, :update, :destroy]
59 put "way/create" => "ways#create", :as => nil
61 resources :relations, :only => [:index, :create]
62 resources :relations, :path => "relation", :id => /\d+/, :only => [:show, :update, :destroy]
63 put "relation/create" => "relations#create", :as => nil
65 resource :map, :only => :show
67 resources :tracepoints, :path => "trackpoints", :only => :index
69 resources :users, :only => :index
70 resources :users, :path => "user", :id => /\d+/, :only => :show
71 resources :user_traces, :path => "user/gpx_files", :module => :users, :controller => :traces, :only => :index
72 get "user/details" => "users#details"
74 resources :user_preferences, :except => [:new, :create, :edit], :param => :preference_key, :path => "user/preferences" do
76 put "" => "user_preferences#update_all", :as => ""
80 resources :messages, :path => "user/messages", :constraints => { :id => /\d+/ }, :only => [:create, :show, :update, :destroy]
81 namespace :messages, :path => "user/messages" do
82 resource :inbox, :only => :show
83 resource :outbox, :only => :show
85 post "/user/messages/:id" => "messages#update", :as => nil
87 resources :traces, :path => "gpx", :only => [:create, :show, :update, :destroy], :id => /\d+/ do
88 scope :module => :traces do
89 resource :data, :only => :show
92 post "gpx/create" => "traces#create", :id => /\d+/, :as => :trace_create
93 get "gpx/:id/details" => "traces#show", :id => /\d+/, :as => :trace_details
96 resources :notes, :except => [:new, :edit, :update], :id => /\d+/, :controller => "notes" do
99 get "feed", :defaults => { :format => "rss" }
108 resource :subscription, :only => [:create, :destroy], :controller => "note_subscriptions"
111 resources :user_blocks, :only => :show, :id => /\d+/, :controller => "user_blocks"
115 get "/way/:id" => "ways#show", :id => /\d+/, :as => :way
116 get "/way/:id/history" => "old_ways#index", :id => /\d+/, :as => :way_history
117 resources :old_ways, :path => "/way/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show
118 get "/node/:id" => "nodes#show", :id => /\d+/, :as => :node
119 get "/node/:id/history" => "old_nodes#index", :id => /\d+/, :as => :node_history
120 resources :old_nodes, :path => "/node/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show
121 get "/relation/:id" => "relations#show", :id => /\d+/, :as => :relation
122 get "/relation/:id/history" => "old_relations#index", :id => /\d+/, :as => :relation_history
123 resources :old_relations, :path => "/relation/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show
125 resources :changesets, :path => "changeset", :id => /\d+/, :only => :show do
126 resource :subscription, :controller => :changeset_subscriptions, :only => [:show, :create, :destroy]
127 namespace :changeset_comments, :as => :comments, :path => :comments do
128 resource :feed, :only => :show, :defaults => { :format => "rss" }
131 get "/changeset/:id/subscribe", :id => /\d+/, :to => redirect(:path => "/changeset/%{id}/subscription")
132 get "/changeset/:id/unsubscribe", :id => /\d+/, :to => redirect(:path => "/changeset/%{id}/subscription")
134 resources :notes, :path => "note", :id => /\d+/, :only => [:show, :new]
136 get "/user/:display_name/history" => "changesets#index"
137 get "/user/:display_name/history/feed" => "changesets#feed", :defaults => { :format => :atom }
138 get "/user/:display_name/notes" => "notes#index", :as => :user_notes
139 get "/history/friends" => "changesets#index", :friends => true, :as => "friend_changesets", :defaults => { :format => :html }
140 get "/history/nearby" => "changesets#index", :nearby => true, :as => "nearby_changesets", :defaults => { :format => :html }
142 get "/browse/way/:id", :to => redirect(:path => "/way/%{id}")
143 get "/browse/way/:id/history", :to => redirect(:path => "/way/%{id}/history")
144 get "/browse/node/:id", :to => redirect(:path => "/node/%{id}")
145 get "/browse/node/:id/history", :to => redirect(:path => "/node/%{id}/history")
146 get "/browse/relation/:id", :to => redirect(:path => "/relation/%{id}")
147 get "/browse/relation/:id/history", :to => redirect(:path => "/relation/%{id}/history")
148 get "/browse/changeset/:id", :to => redirect(:path => "/changeset/%{id}")
149 get "/browse/note/:id", :to => redirect(:path => "/note/%{id}")
150 get "/user/:display_name/edits", :to => redirect(:path => "/user/%{display_name}/history")
151 get "/user/:display_name/edits/feed", :to => redirect(:path => "/user/%{display_name}/history/feed")
152 get "/browse/friends", :to => redirect(:path => "/history/friends")
153 get "/browse/nearby", :to => redirect(:path => "/history/nearby")
154 get "/browse/changesets/feed", :to => redirect(:path => "/history/feed")
155 get "/browse/changesets", :to => redirect(:path => "/history")
156 get "/browse", :to => redirect(:path => "/history")
159 root :to => "site#index", :via => [:get, :post]
160 get "/edit" => "site#edit"
161 get "/copyright/:copyright_locale" => "site#copyright"
162 get "/copyright" => "site#copyright"
163 get "/welcome" => "site#welcome"
164 get "/fixthemap" => "site#fixthemap"
165 get "/help" => "site#help"
166 get "/about/:about_locale" => "site#about"
167 get "/about" => "site#about"
168 get "/communities" => "site#communities"
169 get "/history" => "changesets#index"
170 get "/history/feed" => "changesets#feed", :defaults => { :format => :atom }
172 namespace :changeset_comments, :path => :comments, :as => :changesets_comments do
173 resource :feed, :only => :show, :defaults => { :format => "rss" }
176 get "/export" => "site#export"
177 get "/login" => "sessions#new"
178 post "/login" => "sessions#create"
179 match "/logout" => "sessions#destroy", :via => [:get, :post]
180 get "/offline" => "site#offline"
181 get "/key" => "site#key"
182 get "/id" => "site#id"
183 get "/query" => "browse#query"
184 post "/user/:display_name/confirm/resend" => "confirmations#confirm_resend", :as => :user_confirm_resend
185 match "/user/:display_name/confirm" => "confirmations#confirm", :via => [:get, :post]
186 match "/user/confirm" => "confirmations#confirm", :via => [:get, :post]
187 match "/user/confirm-email" => "confirmations#confirm_email", :via => [:get, :post]
188 post "/user/go_public" => "users#go_public"
189 scope :user, :as => "user" do
190 get "forgot-password" => "passwords#new"
191 post "forgot-password" => "passwords#create"
192 get "reset-password" => "passwords#edit"
193 post "reset-password" => "passwords#update"
195 get "/user/suspended" => "users#suspended"
197 get "/index.html", :to => redirect(:path => "/")
198 get "/create-account.html", :to => redirect(:path => "/user/new")
199 get "/forgot-password.html", :to => redirect(:path => "/user/forgot-password")
202 get "/auth/failure" => "users#auth_failure"
203 match "/auth/:provider/callback" => "users#auth_success", :via => [:get, :post], :as => :auth_success
204 match "/auth/:provider" => "users#auth", :via => [:post, :patch], :as => :auth
207 get "/go/:code" => "site#permalink", :code => /[a-zA-Z0-9_@~]+[=-]*/, :as => :permalink
210 post "/preview/:type" => "site#preview", :as => :preview
213 resources :traces, :id => /\d+/, :except => [:show] do
214 resource :data, :module => :traces, :only => :show
216 get "/user/:display_name/traces/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/traces/tag/%{tag}")
217 get "/user/:display_name/traces/tag/:tag" => "traces#index"
218 get "/user/:display_name/traces/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/traces")
219 get "/user/:display_name/traces" => "traces#index"
220 get "/user/:display_name/traces/:id" => "traces#show", :id => /\d+/, :as => "show_trace"
221 scope "/user/:display_name/traces/:trace_id", :module => :traces, :trace_id => /\d+/ do
222 get "picture" => "pictures#show", :as => "trace_picture"
223 get "icon" => "icons#show", :as => "trace_icon"
225 get "/traces/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/tag/%{tag}")
226 get "/traces/tag/:tag" => "traces#index"
227 get "/traces/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces")
228 get "/traces/mine/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/mine/tag/%{tag}")
229 get "/traces/mine/tag/:tag" => "traces#mine"
230 get "/traces/mine/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/mine")
231 get "/traces/mine" => "traces#mine"
232 get "/trace/create", :to => redirect(:path => "/traces/new")
233 get "/trace/:id/data", :format => false, :id => /\d+/, :to => redirect(:path => "/traces/%{id}/data")
234 get "/trace/:id/data.:format", :id => /\d+/, :to => redirect(:path => "/traces/%{id}/data.%{format}")
235 get "/trace/:id/edit", :id => /\d+/, :to => redirect(:path => "/traces/%{id}/edit")
237 namespace :traces, :path => "" do
238 resource :feed, :path => "(/user/:display_name)/traces(/tag/:tag)/rss", :only => :show, :defaults => { :format => :rss }
242 resources :diary_entries, :path => "diary", :only => [:new, :create, :index] do
244 get "friends" => "diary_entries#index", :friends => true
245 get "nearby" => "diary_entries#index", :nearby => true
248 get "/user/:display_name/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss }
249 get "/diary/:language/rss" => "diary_entries#rss", :defaults => { :format => :rss }
250 get "/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss }
251 get "/user/:display_name/diary" => "diary_entries#index"
252 get "/diary/:language" => "diary_entries#index"
253 scope "/user/:display_name" do
254 resources :diary_entries, :path => "diary", :only => [:edit, :update, :show], :id => /\d+/ do
261 match "/user/:display_name/diary/:id/subscribe" => "diary_entries#subscribe", :via => [:get, :post], :as => :diary_entry_subscribe, :id => /\d+/
262 match "/user/:display_name/diary/:id/unsubscribe" => "diary_entries#unsubscribe", :via => [:get, :post], :as => :diary_entry_unsubscribe, :id => /\d+/
263 post "/user/:display_name/diary/:id/comments" => "diary_comments#create", :id => /\d+/, :as => :comment_diary_entry
264 post "/diary_comments/:comment/hide" => "diary_comments#hide", :comment => /\d+/, :as => :hide_diary_comment
265 post "/diary_comments/:comment/unhide" => "diary_comments#unhide", :comment => /\d+/, :as => :unhide_diary_comment
268 get "/user/terms", :to => redirect(:path => "/account/terms")
269 resources :users, :path => "user", :param => :display_name, :only => [:new, :create, :show] do
270 resource :role, :controller => "user_roles", :path => "roles/:role", :only => [:create, :destroy]
271 scope :module => :users do
272 resources :diary_comments, :only => :index
273 resources :changeset_comments, :only => :index
274 resource :issued_blocks, :path => "blocks_by", :only => :show
275 resource :received_blocks, :path => "blocks", :only => [:show, :edit, :destroy]
276 resource :status, :only => :update
279 get "/user/:display_name/account", :to => redirect(:path => "/account/edit")
280 get "/user/:display_name/diary/comments(/:page)", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/diary_comments")
282 resource :account, :only => [:edit, :update, :destroy] do
283 scope :module => :accounts do
284 resource :terms, :only => [:show, :update]
285 resource :deletion, :only => :show
289 resource :dashboard, :only => [:show]
290 resource :preferences, :only => [:show, :update]
291 get "/preferences/edit", :to => redirect(:path => "/preferences")
292 resource :profile, :only => [:edit, :update]
295 scope "/user/:display_name" do
296 resource :follow, :only => [:create, :destroy, :show], :path => "follow"
298 get "make_friend", :to => redirect("/user/%{display_name}/follow")
299 get "remove_friend", :to => redirect("/user/%{display_name}/follow")
304 resource :list, :path => "(:status)", :only => [:show, :update]
308 get "/search" => "geocoder#search"
309 post "/geocoder/search_latlon" => "geocoder#search_latlon"
310 post "/geocoder/search_osm_nominatim" => "geocoder#search_osm_nominatim"
311 post "/geocoder/search_osm_nominatim_reverse" => "geocoder#search_osm_nominatim_reverse"
314 get "/directions" => "directions#search"
317 post "/export/finish" => "export#finish"
318 get "/export/embed" => "export#embed"
321 resources :messages, :path_names => { :new => "new/:display_name" }, :id => /\d+/, :only => [:new, :create, :show, :destroy] do
322 scope :module => :messages do
323 resource :reply, :path_names => { :new => "new" }, :only => :new
324 resource :read_mark, :only => [:create, :destroy]
325 resource :mute, :only => :destroy
328 namespace :messages, :path => "/messages" do
329 resource :inbox, :only => :show
330 resource :muted_inbox, :path => "muted", :only => :show
331 resource :outbox, :only => :show
333 get "/user/:display_name/inbox", :to => redirect(:path => "/messages/inbox")
334 get "/user/:display_name/outbox", :to => redirect(:path => "/messages/outbox")
335 get "/message/new/:display_name", :to => redirect(:path => "/messages/new/%{display_name}")
336 get "/message/read/:message_id", :to => redirect(:path => "/messages/%{message_id}")
337 get "/messages/:message_id/reply", :to => redirect(:path => "/messages/%{message_id}/reply/new")
340 scope "/user/:display_name" do
341 resource :user_mute, :only => [:create, :destroy], :path => "mute"
343 resources :user_mutes, :only => [:index]
346 resources :user_blocks, :path_names => { :new => "new/:display_name" }
350 resources :comments, :controller => :issue_comments
362 resources :redactions
365 match "/400", :to => "errors#bad_request", :via => :all
366 match "/403", :to => "errors#forbidden", :via => :all
367 match "/404", :to => "errors#not_found", :via => :all
368 match "/500", :to => "errors#internal_server_error", :via => :all