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.

147 lines
3.7 KiB

8 years ago
7 years ago
8 years ago
  1. # frozen_string_literal: true
  2. require 'sidekiq/web'
  3. Rails.application.routes.draw do
  4. mount ActionCable.server, at: 'cable'
  5. authenticate :user, lambda { |u| u.admin? } do
  6. mount Sidekiq::Web, at: 'sidekiq', as: :sidekiq
  7. mount PgHero::Engine, at: 'pghero', as: :pghero
  8. end
  9. use_doorkeeper do
  10. controllers authorizations: 'oauth/authorizations'
  11. end
  12. get '.well-known/host-meta', to: 'xrd#host_meta', as: :host_meta
  13. get '.well-known/webfinger', to: 'xrd#webfinger', as: :webfinger
  14. devise_for :users, path: 'auth', controllers: {
  15. sessions: 'auth/sessions',
  16. registrations: 'auth/registrations',
  17. passwords: 'auth/passwords',
  18. confirmations: 'auth/confirmations',
  19. }
  20. resources :accounts, path: 'users', only: [:show], param: :username do
  21. resources :stream_entries, path: 'updates', only: [:show] do
  22. member do
  23. get :embed
  24. end
  25. end
  26. get :remote_follow, to: 'remote_follow#new'
  27. post :remote_follow, to: 'remote_follow#create'
  28. member do
  29. get :followers
  30. get :following
  31. post :follow
  32. post :unfollow
  33. end
  34. end
  35. namespace :settings do
  36. resource :profile, only: [:show, :update]
  37. resource :preferences, only: [:show, :update]
  38. end
  39. resources :media, only: [:show]
  40. resources :tags, only: [:show]
  41. # Remote follow
  42. get :authorize_follow, to: 'authorize_follow#new'
  43. post :authorize_follow, to: 'authorize_follow#create'
  44. namespace :admin do
  45. resources :pubsubhubbub, only: [:index]
  46. resources :domain_blocks, only: [:index, :create]
  47. resources :accounts, only: [:index, :show, :update] do
  48. member do
  49. post :suspend
  50. end
  51. end
  52. end
  53. namespace :api do
  54. # PubSubHubbub outgoing subscriptions
  55. resources :subscriptions, only: [:show]
  56. post '/subscriptions/:id', to: 'subscriptions#update'
  57. # PubSubHubbub incoming subscriptions
  58. post '/push', to: 'push#update', as: :push
  59. # Salmon
  60. post '/salmon/:id', to: 'salmon#update', as: :salmon
  61. # OEmbed
  62. get '/oembed', to: 'oembed#show', as: :oembed
  63. # JSON / REST API
  64. namespace :v1 do
  65. resources :statuses, only: [:create, :show, :destroy] do
  66. member do
  67. get :context
  68. get :reblogged_by
  69. get :favourited_by
  70. post :reblog
  71. post :unreblog
  72. post :favourite
  73. post :unfavourite
  74. end
  75. end
  76. get '/timelines/home', to: 'timelines#home', as: :home_timeline
  77. get '/timelines/mentions', to: 'timelines#mentions', as: :mentions_timeline
  78. get '/timelines/public', to: 'timelines#public', as: :public_timeline
  79. get '/timelines/tag/:id', to: 'timelines#tag', as: :hashtag_timeline
  80. resources :follows, only: [:create]
  81. resources :media, only: [:create]
  82. resources :apps, only: [:create]
  83. resources :blocks, only: [:index]
  84. resources :follow_requests, only: [:index] do
  85. member do
  86. post :authorize
  87. post :reject
  88. end
  89. end
  90. resources :notifications, only: [:index]
  91. resources :favourites, only: [:index]
  92. resources :accounts, only: [:show] do
  93. collection do
  94. get :relationships
  95. get :verify_credentials
  96. get :search
  97. end
  98. member do
  99. get :statuses
  100. get :followers
  101. get :following
  102. post :follow
  103. post :unfollow
  104. post :block
  105. post :unblock
  106. end
  107. end
  108. end
  109. end
  110. get '/web/(*any)', to: 'home#index', as: :web
  111. get :about, to: 'about#index'
  112. get :terms, to: 'about#terms'
  113. root 'home#index'
  114. match '*unmatched_route', via: :all, to: 'application#raise_not_found'
  115. end