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.

153 lines
3.8 KiB

8 years ago
8 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 :settings, only: [:index, :update]
  48. resources :accounts, only: [:index, :show, :update] do
  49. member do
  50. post :suspend
  51. end
  52. end
  53. end
  54. namespace :api do
  55. # PubSubHubbub outgoing subscriptions
  56. resources :subscriptions, only: [:show]
  57. post '/subscriptions/:id', to: 'subscriptions#update'
  58. # PubSubHubbub incoming subscriptions
  59. post '/push', to: 'push#update', as: :push
  60. # Salmon
  61. post '/salmon/:id', to: 'salmon#update', as: :salmon
  62. # OEmbed
  63. get '/oembed', to: 'oembed#show', as: :oembed
  64. # JSON / REST API
  65. namespace :v1 do
  66. resources :statuses, only: [:create, :show, :destroy] do
  67. member do
  68. get :context
  69. get :reblogged_by
  70. get :favourited_by
  71. post :reblog
  72. post :unreblog
  73. post :favourite
  74. post :unfavourite
  75. end
  76. end
  77. get '/timelines/home', to: 'timelines#home', as: :home_timeline
  78. get '/timelines/mentions', to: 'timelines#mentions', as: :mentions_timeline
  79. get '/timelines/public', to: 'timelines#public', as: :public_timeline
  80. get '/timelines/tag/:id', to: 'timelines#tag', as: :hashtag_timeline
  81. resources :follows, only: [:create]
  82. resources :media, only: [:create]
  83. resources :apps, only: [:create]
  84. resources :blocks, only: [:index]
  85. resources :follow_requests, only: [:index] do
  86. member do
  87. post :authorize
  88. post :reject
  89. end
  90. end
  91. resources :notifications, only: [:index]
  92. resources :favourites, only: [:index]
  93. resources :accounts, only: [:show] do
  94. collection do
  95. get :relationships
  96. get :verify_credentials
  97. get :search
  98. end
  99. member do
  100. get :statuses
  101. get :followers
  102. get :following
  103. post :follow
  104. post :unfollow
  105. post :block
  106. post :unblock
  107. end
  108. end
  109. end
  110. namespace :web do
  111. resource :settings, only: [:update]
  112. end
  113. end
  114. get '/web/(*any)', to: 'home#index', as: :web
  115. get '/about', to: 'about#index'
  116. get '/about/more', to: 'about#more'
  117. get '/terms', to: 'about#terms'
  118. root 'home#index'
  119. match '*unmatched_route', via: :all, to: 'application#raise_not_found'
  120. end