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

107 lines
2.6 KiB

8 years ago
8 years ago
8 years ago
8 years ago
  1. require 'sidekiq/web'
  2. Rails.application.routes.draw do
  3. get 'tags/show'
  4. mount ActionCable.server => '/cable'
  5. authenticate :user, lambda { |u| u.admin? } do
  6. mount Sidekiq::Web => '/sidekiq'
  7. mount PgHero::Engine, at: '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]
  22. member do
  23. get :followers
  24. get :following
  25. post :follow
  26. post :unfollow
  27. end
  28. end
  29. namespace :settings do
  30. resource :profile, only: [:show, :update]
  31. resource :preferences, only: [:show, :update]
  32. end
  33. resources :media, only: [:show]
  34. resources :tags, only: [:show]
  35. namespace :api do
  36. # PubSubHubbub
  37. resources :subscriptions, only: [:show]
  38. post '/subscriptions/:id', to: 'subscriptions#update'
  39. # Salmon
  40. post '/salmon/:id', to: 'salmon#update', as: :salmon
  41. # JSON / REST API
  42. namespace :v1 do
  43. resources :statuses, only: [:create, :show, :destroy] do
  44. member do
  45. get :context
  46. get :reblogged_by
  47. get :favourited_by
  48. post :reblog
  49. post :unreblog
  50. post :favourite
  51. post :unfavourite
  52. end
  53. end
  54. get '/timelines/home', to: 'timelines#home', as: :home_timeline
  55. get '/timelines/mentions', to: 'timelines#mentions', as: :mentions_timeline
  56. get '/timelines/public', to: 'timelines#public', as: :public_timeline
  57. get '/timelines/tag/:id', to: 'timelines#tag', as: :hashtag_timeline
  58. resources :follows, only: [:create]
  59. resources :media, only: [:create]
  60. resources :apps, only: [:create]
  61. resources :accounts, only: [:show] do
  62. collection do
  63. get :relationships
  64. get :verify_credentials
  65. get :suggestions
  66. end
  67. member do
  68. get :statuses
  69. get :followers
  70. get :following
  71. get :common_followers
  72. post :follow
  73. post :unfollow
  74. post :block
  75. post :unblock
  76. end
  77. end
  78. end
  79. end
  80. get :about, to: 'about#index'
  81. get :terms, to: 'about#terms'
  82. root 'home#index'
  83. match '*unmatched_route', via: :all, to: 'application#raise_not_found'
  84. end