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

126 lines
3.1 KiB

8 years ago
8 years ago
8 years ago
  1. # frozen_string_literal: true
  2. require 'sidekiq/web'
  3. Rails.application.routes.draw do
  4. mount ActionCable.server, at: 'cable'
  5. authenticate :user, lambda { |u| u.admin? } do
  6. mount Sidekiq::Web, at: '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 :admin do
  36. resources :pubsubhubbub, only: [:index]
  37. resources :accounts, only: [:index, :show, :update] do
  38. member do
  39. post :suspend
  40. end
  41. end
  42. end
  43. namespace :api do
  44. # PubSubHubbub outgoing subscriptions
  45. resources :subscriptions, only: [:show]
  46. post '/subscriptions/:id', to: 'subscriptions#update'
  47. # PubSubHubbub incoming subscriptions
  48. post '/push', to: 'push#update', as: :push
  49. # Salmon
  50. post '/salmon/:id', to: 'salmon#update', as: :salmon
  51. # OEmbed
  52. get '/oembed', to: 'oembed#show', as: :oembed
  53. # JSON / REST API
  54. namespace :v1 do
  55. resources :statuses, only: [:create, :show, :destroy] do
  56. member do
  57. get :context
  58. get :reblogged_by
  59. get :favourited_by
  60. post :reblog
  61. post :unreblog
  62. post :favourite
  63. post :unfavourite
  64. end
  65. end
  66. get '/timelines/home', to: 'timelines#home', as: :home_timeline
  67. get '/timelines/mentions', to: 'timelines#mentions', as: :mentions_timeline
  68. get '/timelines/public', to: 'timelines#public', as: :public_timeline
  69. get '/timelines/tag/:id', to: 'timelines#tag', as: :hashtag_timeline
  70. resources :follows, only: [:create]
  71. resources :media, only: [:create]
  72. resources :apps, only: [:create]
  73. resources :notifications, only: [:index]
  74. resources :accounts, only: [:show] do
  75. collection do
  76. get :relationships
  77. get :verify_credentials
  78. get :search
  79. end
  80. member do
  81. get :statuses
  82. get :followers
  83. get :following
  84. post :follow
  85. post :unfollow
  86. post :block
  87. post :unblock
  88. end
  89. end
  90. end
  91. end
  92. get '/web/*any', to: 'home#index', as: :web
  93. get :about, to: 'about#index'
  94. get :terms, to: 'about#terms'
  95. root 'home#index'
  96. match '*unmatched_route', via: :all, to: 'application#raise_not_found'
  97. end