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.

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