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

110 lines
2.7 KiB

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