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

73 lines
1.6 KiB

8 years ago
8 years ago
  1. require 'sidekiq/web'
  2. Rails.application.routes.draw do
  3. authenticate :user, lambda { |u| u.admin? } do
  4. mount Sidekiq::Web => '/sidekiq'
  5. end
  6. use_doorkeeper do
  7. controllers applications: 'oauth/applications'
  8. end
  9. get '.well-known/host-meta', to: 'xrd#host_meta', as: :host_meta
  10. get '.well-known/webfinger', to: 'xrd#webfinger', as: :webfinger
  11. devise_for :users, path: 'auth', controllers: {
  12. sessions: 'auth/sessions',
  13. registrations: 'auth/registrations',
  14. passwords: 'auth/passwords'
  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. end
  22. end
  23. resource :settings, only: [:show, :update]
  24. resources :statuses, only: [:create]
  25. namespace :api do
  26. # PubSubHubbub
  27. resources :subscriptions, only: [:show]
  28. post '/subscriptions/:id', to: 'subscriptions#update'
  29. # Salmon
  30. post '/salmon/:id', to: 'salmon#update', as: :salmon
  31. # JSON / REST API
  32. resources :statuses, only: [:create, :show] do
  33. collection do
  34. get :home
  35. get :mentions
  36. end
  37. member do
  38. post :reblog
  39. post :favourite
  40. end
  41. end
  42. resources :follows, only: [:create]
  43. resources :accounts, only: [:show] do
  44. collection do
  45. get :lookup, to: 'accounts/lookup#index', as: :lookup
  46. end
  47. member do
  48. get :statuses
  49. get :followers
  50. get :following
  51. post :follow
  52. post :unfollow
  53. end
  54. end
  55. end
  56. root 'home#index'
  57. end