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.

142 lines
3.5 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. member do
  27. get :followers
  28. get :following
  29. post :follow
  30. post :unfollow
  31. end
  32. end
  33. namespace :settings do
  34. resource :profile, only: [:show, :update]
  35. resource :preferences, only: [:show, :update]
  36. end
  37. resources :media, only: [:show]
  38. resources :tags, only: [:show]
  39. # Remote follow
  40. get :authorize_follow, to: 'authorize_follow#new'
  41. post :authorize_follow, to: 'authorize_follow#create'
  42. namespace :admin do
  43. resources :pubsubhubbub, only: [:index]
  44. resources :domain_blocks, only: [:index, :create]
  45. resources :accounts, only: [:index, :show, :update] do
  46. member do
  47. post :suspend
  48. end
  49. end
  50. end
  51. namespace :api do
  52. # PubSubHubbub outgoing subscriptions
  53. resources :subscriptions, only: [:show]
  54. post '/subscriptions/:id', to: 'subscriptions#update'
  55. # PubSubHubbub incoming subscriptions
  56. post '/push', to: 'push#update', as: :push
  57. # Salmon
  58. post '/salmon/:id', to: 'salmon#update', as: :salmon
  59. # OEmbed
  60. get '/oembed', to: 'oembed#show', as: :oembed
  61. # JSON / REST API
  62. namespace :v1 do
  63. resources :statuses, only: [:create, :show, :destroy] do
  64. member do
  65. get :context
  66. get :reblogged_by
  67. get :favourited_by
  68. post :reblog
  69. post :unreblog
  70. post :favourite
  71. post :unfavourite
  72. end
  73. end
  74. get '/timelines/home', to: 'timelines#home', as: :home_timeline
  75. get '/timelines/mentions', to: 'timelines#mentions', as: :mentions_timeline
  76. get '/timelines/public', to: 'timelines#public', as: :public_timeline
  77. get '/timelines/tag/:id', to: 'timelines#tag', as: :hashtag_timeline
  78. resources :follows, only: [:create]
  79. resources :media, only: [:create]
  80. resources :apps, only: [:create]
  81. resources :follow_requests, only: [:index] do
  82. member do
  83. post :authorize
  84. post :reject
  85. end
  86. end
  87. resources :notifications, only: [:index]
  88. resources :accounts, only: [:show] do
  89. collection do
  90. get :relationships
  91. get :verify_credentials
  92. get :search
  93. end
  94. member do
  95. get :statuses
  96. get :followers
  97. get :following
  98. post :follow
  99. post :unfollow
  100. post :block
  101. post :unblock
  102. end
  103. end
  104. end
  105. end
  106. get '/web/*any', to: 'home#index', as: :web
  107. get :about, to: 'about#index'
  108. get :terms, to: 'about#terms'
  109. root 'home#index'
  110. match '*unmatched_route', via: :all, to: 'application#raise_not_found'
  111. end