You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
2.7 KiB

8 years ago
7 years ago
8 years ago
  1. require 'sidekiq/web'
  2. Rails.application.routes.draw do
  3. mount ActionCable.server => '/cable'
  4. authenticate :user, lambda { |u| u.admin? } do
  5. mount Sidekiq::Web, at: 'sidekiq'
  6. mount PgHero::Engine, at: 'pghero'
  7. end
  8. use_doorkeeper do
  9. controllers authorizations: 'oauth/authorizations'
  10. end
  11. get '.well-known/host-meta', to: 'xrd#host_meta', as: :host_meta
  12. get '.well-known/webfinger', to: 'xrd#webfinger', as: :webfinger
  13. devise_for :users, path: 'auth', controllers: {
  14. sessions: 'auth/sessions',
  15. registrations: 'auth/registrations',
  16. passwords: 'auth/passwords',
  17. confirmations: 'auth/confirmations'
  18. }
  19. resources :accounts, path: 'users', only: [:show], param: :username do
  20. resources :stream_entries, path: 'updates', only: [:show]
  21. member do
  22. get :followers
  23. get :following
  24. post :follow
  25. post :unfollow
  26. end
  27. end
  28. namespace :settings do
  29. resource :profile, only: [:show, :update]
  30. resource :preferences, only: [:show, :update]
  31. end
  32. resources :media, only: [:show]
  33. resources :tags, only: [:show]
  34. namespace :api do
  35. # PubSubHubbub
  36. resources :subscriptions, only: [:show]
  37. post '/subscriptions/:id', to: 'subscriptions#update'
  38. # Salmon
  39. post '/salmon/:id', to: 'salmon#update', as: :salmon
  40. # JSON / REST API
  41. namespace :v1 do
  42. resources :statuses, only: [:create, :show, :destroy] do
  43. member do
  44. get :context
  45. get :reblogged_by
  46. get :favourited_by
  47. post :reblog
  48. post :unreblog
  49. post :favourite
  50. post :unfavourite
  51. end
  52. end
  53. get '/timelines/home', to: 'timelines#home', as: :home_timeline
  54. get '/timelines/mentions', to: 'timelines#mentions', as: :mentions_timeline
  55. get '/timelines/public', to: 'timelines#public', as: :public_timeline
  56. get '/timelines/tag/:id', to: 'timelines#tag', as: :hashtag_timeline
  57. resources :follows, only: [:create]
  58. resources :media, only: [:create]
  59. resources :apps, only: [:create]
  60. resources :accounts, only: [:show] do
  61. collection do
  62. get :relationships
  63. get :verify_credentials
  64. get :suggestions
  65. get :search
  66. end
  67. member do
  68. get :statuses
  69. get :followers
  70. get :following
  71. get :common_followers
  72. post :follow
  73. post :unfollow
  74. post :block
  75. post :unblock
  76. end
  77. end
  78. end
  79. end
  80. get '/web/*any', to: 'home#index', as: :web
  81. get :about, to: 'about#index'
  82. get :terms, to: 'about#terms'
  83. root 'home#index'
  84. match '*unmatched_route', via: :all, to: 'application#raise_not_found'
  85. end