X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/152414861caa30e9217e3451caabd5a2b983ce2b..67669171af7e088d19378913cbd37f9cab98ea5b:/config/routes.rb?ds=sidebyside diff --git a/config/routes.rb b/config/routes.rb index be27698a5..09afe8fd9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,6 +5,8 @@ OpenStreetMap::Application.routes.draw do :authorized_applications => "oauth2_authorized_applications" end + use_doorkeeper_openid_connect :scope => "oauth2" if Settings.key?(:doorkeeper_signing_key) + # API namespace :api do get "capabilities" => "capabilities#show" # Deprecated, remove when 0.6 support is removed @@ -84,7 +86,7 @@ OpenStreetMap::Application.routes.draw do get "gpx/:id/data" => "api/traces#data", :as => :api_trace_data # Map notes API - resources :notes, :except => [:new, :edit, :update], :constraints => { :id => /\d+/ }, :controller => "api/notes" do + resources :notes, :except => [:new, :edit, :update], :constraints => { :id => /\d+/ }, :controller => "api/notes", :as => :api_notes do collection do get "search" get "feed", :defaults => { :format => "rss" } @@ -102,19 +104,24 @@ OpenStreetMap::Application.routes.draw do post "notes/editPOIexec" => "api/notes#comment" get "notes/getGPX" => "api/notes#index", :format => "gpx" get "notes/getRSSfeed" => "api/notes#feed", :format => "rss" + + resources :user_blocks, :only => [:show], :constraints => { :id => /\d+/ }, :controller => "api/user_blocks", :as => :api_user_blocks end # Data browsing get "/way/:id" => "browse#way", :id => /\d+/, :as => :way get "/way/:id/history" => "browse#way_history", :id => /\d+/, :as => :way_history + resources :old_ways, :path => "/way/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show get "/node/:id" => "browse#node", :id => /\d+/, :as => :node get "/node/:id/history" => "browse#node_history", :id => /\d+/, :as => :node_history + resources :old_nodes, :path => "/node/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show get "/relation/:id" => "browse#relation", :id => /\d+/, :as => :relation get "/relation/:id/history" => "browse#relation_history", :id => /\d+/, :as => :relation_history + resources :old_relations, :path => "/relation/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show get "/changeset/:id" => "browse#changeset", :as => :changeset, :id => /\d+/ get "/changeset/:id/comments/feed" => "changeset_comments#index", :as => :changeset_comments_feed, :id => /\d*/, :defaults => { :format => "rss" } - get "/note/:id" => "browse#note", :id => /\d+/, :as => "browse_note" - get "/note/new" => "browse#new_note" + resources :notes, :path => "note", :only => [:show, :new] + get "/user/:display_name/history" => "changesets#index" get "/user/:display_name/history/feed" => "changesets#feed", :defaults => { :format => :atom } get "/user/:display_name/notes" => "notes#index", :as => :user_notes @@ -168,8 +175,12 @@ OpenStreetMap::Application.routes.draw do match "/user/confirm" => "confirmations#confirm", :via => [:get, :post] match "/user/confirm-email" => "confirmations#confirm_email", :via => [:get, :post] post "/user/go_public" => "users#go_public" - match "/user/reset-password" => "passwords#reset_password", :via => [:get, :post], :as => :user_reset_password - match "/user/forgot-password" => "passwords#lost_password", :via => [:get, :post], :as => :user_forgot_password + scope :user, :as => "user" do + get "forgot-password" => "passwords#new" + post "forgot-password" => "passwords#create" + get "reset-password" => "passwords#edit" + post "reset-password" => "passwords#update" + end get "/user/suspended" => "users#suspended" get "/index.html", :to => redirect(:path => "/") @@ -189,23 +200,23 @@ OpenStreetMap::Application.routes.draw do # traces resources :traces, :except => [:show] - get "/user/:display_name/traces/tag/:tag/page/:page" => "traces#index", :page => /[1-9][0-9]*/ + get "/user/:display_name/traces/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/traces/tag/%{tag}") get "/user/:display_name/traces/tag/:tag" => "traces#index" - get "/user/:display_name/traces/page/:page" => "traces#index", :page => /[1-9][0-9]*/ + get "/user/:display_name/traces/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/user/%{display_name}/traces") get "/user/:display_name/traces" => "traces#index" get "/user/:display_name/traces/tag/:tag/rss" => "traces#georss", :defaults => { :format => :rss } get "/user/:display_name/traces/rss" => "traces#georss", :defaults => { :format => :rss } get "/user/:display_name/traces/:id" => "traces#show", :as => "show_trace" get "/user/:display_name/traces/:id/picture" => "traces#picture", :as => "trace_picture" get "/user/:display_name/traces/:id/icon" => "traces#icon", :as => "trace_icon" - get "/traces/tag/:tag/page/:page" => "traces#index", :page => /[1-9][0-9]*/ + get "/traces/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/tag/%{tag}") get "/traces/tag/:tag" => "traces#index" - get "/traces/page/:page" => "traces#index", :page => /[1-9][0-9]*/ + get "/traces/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces") get "/traces/tag/:tag/rss" => "traces#georss", :defaults => { :format => :rss } get "/traces/rss" => "traces#georss", :defaults => { :format => :rss } - get "/traces/mine/tag/:tag/page/:page" => "traces#mine", :page => /[1-9][0-9]*/ + get "/traces/mine/tag/:tag/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/mine/tag/%{tag}") get "/traces/mine/tag/:tag" => "traces#mine" - get "/traces/mine/page/:page" => "traces#mine" + get "/traces/mine/page/:page", :page => /[1-9][0-9]*/, :to => redirect(:path => "/traces/mine") get "/traces/mine" => "traces#mine" get "/trace/create", :to => redirect(:path => "/traces/new") get "/trace/:id/data" => "traces#data", :id => /\d+/, :as => "trace_data" @@ -226,7 +237,7 @@ OpenStreetMap::Application.routes.draw do get "/user/:display_name/diary" => "diary_entries#index" get "/diary/:language" => "diary_entries#index" scope "/user/:display_name" do - resources :diary_entries, :path => "diary", :only => [:edit, :update, :show] + resources :diary_entries, :path => "diary", :only => [:edit, :update, :show], :id => /\d+/ end post "/user/:display_name/diary/:id/newcomment" => "diary_entries#comment", :id => /\d+/, :as => :comment_diary_entry post "/user/:display_name/diary/:id/hide" => "diary_entries#hide", :id => /\d+/, :as => :hide_diary_entry @@ -260,12 +271,9 @@ OpenStreetMap::Application.routes.draw do # geocoder get "/search" => "geocoder#search" - get "/geocoder/search_latlon" => "geocoder#search_latlon" - get "/geocoder/search_ca_postcode" => "geocoder#search_ca_postcode" - get "/geocoder/search_osm_nominatim" => "geocoder#search_osm_nominatim" - get "/geocoder/search_geonames" => "geocoder#search_geonames" - get "/geocoder/search_osm_nominatim_reverse" => "geocoder#search_osm_nominatim_reverse" - get "/geocoder/search_geonames_reverse" => "geocoder#search_geonames_reverse" + post "/geocoder/search_latlon" => "geocoder#search_latlon" + post "/geocoder/search_osm_nominatim" => "geocoder#search_osm_nominatim" + post "/geocoder/search_osm_nominatim_reverse" => "geocoder#search_osm_nominatim_reverse" # directions get "/directions" => "directions#search" @@ -277,9 +285,12 @@ OpenStreetMap::Application.routes.draw do # messages resources :messages, :only => [:create, :show, :destroy] do post :mark + patch :unmute + match :reply, :via => [:get, :post] collection do get :inbox + get :muted get :outbox end end @@ -288,6 +299,12 @@ OpenStreetMap::Application.routes.draw do get "/message/new/:display_name" => "messages#new", :as => "new_message" get "/message/read/:message_id", :to => redirect(:path => "/messages/%{message_id}") + # muting users + scope "/user/:display_name" do + resource :user_mute, :only => [:create, :destroy], :path => "mute" + end + resources :user_mutes, :only => [:index] + # oauth admin pages (i.e: for setting up new clients, etc...) scope "/user/:display_name" do resources :oauth_clients @@ -307,6 +324,7 @@ OpenStreetMap::Application.routes.draw do get "/blocks/new/:display_name" => "user_blocks#new", :as => "new_user_block" resources :user_blocks match "/blocks/:id/revoke" => "user_blocks#revoke", :via => [:get, :post], :as => "revoke_user_block" + match "/user/:display_name/blocks/revoke_all" => "user_blocks#revoke_all", :via => [:get, :post], :as => "revoke_all_user_blocks" # issues and reports resources :issues do