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. resources :follow_requests do
  40. member do
  41. post :authorize
  42. post :reject
  43. end
  44. end
  45. namespace :admin do
  46. resources :pubsubhubbub, only: [:index]
  47. resources :domain_blocks, only: [:index, :create]
  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 :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