闭社主体 forked from https://github.com/tootsuite/mastodon
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.

101 lines
2.3 KiB

8 years ago
8 years ago
  1. require 'sidekiq/web'
  2. Rails.application.routes.draw do
  3. mount ActionCable.server => '/cable'
  4. authenticate :user, lambda { |u| u.admin? } do
  5. mount Sidekiq::Web => '/sidekiq'
  6. end
  7. use_doorkeeper do
  8. controllers authorizations: 'oauth/authorizations'
  9. end
  10. get '.well-known/host-meta', to: 'xrd#host_meta', as: :host_meta
  11. get '.well-known/webfinger', to: 'xrd#webfinger', as: :webfinger
  12. devise_for :users, path: 'auth', controllers: {
  13. sessions: 'auth/sessions',
  14. registrations: 'auth/registrations',
  15. passwords: 'auth/passwords',
  16. confirmations: 'auth/confirmations'
  17. }
  18. resources :accounts, path: 'users', only: [:show], param: :username do
  19. resources :stream_entries, path: 'updates', only: [:show]
  20. member do
  21. get :followers
  22. get :following
  23. post :follow
  24. post :unfollow
  25. end
  26. end
  27. namespace :settings do
  28. resource :profile, only: [:show, :update]
  29. resource :preferences, only: [:show, :update]
  30. end
  31. resources :media, only: [:show]
  32. namespace :api do
  33. # PubSubHubbub
  34. resources :subscriptions, only: [:show]
  35. post '/subscriptions/:id', to: 'subscriptions#update'
  36. # Salmon
  37. post '/salmon/:id', to: 'salmon#update', as: :salmon
  38. # JSON / REST API
  39. namespace :v1 do
  40. resources :statuses, only: [:create, :show, :destroy] do
  41. collection do
  42. get :home
  43. get :mentions
  44. get :public
  45. end
  46. member do
  47. get :context
  48. post :reblog
  49. post :unreblog
  50. post :favourite
  51. post :unfavourite
  52. end
  53. end
  54. resources :follows, only: [:create]
  55. resources :media, only: [:create]
  56. resources :apps, only: [:create]
  57. resources :accounts, only: [:show] do
  58. collection do
  59. get :relationships
  60. get :verify_credentials
  61. get :suggestions
  62. end
  63. member do
  64. get :statuses
  65. get :followers
  66. get :following
  67. get :common_followers
  68. post :follow
  69. post :unfollow
  70. post :block
  71. post :unblock
  72. end
  73. end
  74. end
  75. end
  76. get :about, to: 'about#index'
  77. root 'home#index'
  78. match '*unmatched_route', via: :all, to: 'application#raise_not_found'
  79. end