闭社主体 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.

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