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

117 lines
2.9 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. end
  38. namespace :api do
  39. # PubSubHubbub outgoing subscriptions
  40. resources :subscriptions, only: [:show]
  41. post '/subscriptions/:id', to: 'subscriptions#update'
  42. # PubSubHubbub incoming subscriptions
  43. post '/push', to: 'push#update', as: :push
  44. # Salmon
  45. post '/salmon/:id', to: 'salmon#update', as: :salmon
  46. # JSON / REST API
  47. namespace :v1 do
  48. resources :statuses, only: [:create, :show, :destroy] do
  49. member do
  50. get :context
  51. get :reblogged_by
  52. get :favourited_by
  53. post :reblog
  54. post :unreblog
  55. post :favourite
  56. post :unfavourite
  57. end
  58. end
  59. get '/timelines/home', to: 'timelines#home', as: :home_timeline
  60. get '/timelines/mentions', to: 'timelines#mentions', as: :mentions_timeline
  61. get '/timelines/public', to: 'timelines#public', as: :public_timeline
  62. get '/timelines/tag/:id', to: 'timelines#tag', as: :hashtag_timeline
  63. resources :follows, only: [:create]
  64. resources :media, only: [:create]
  65. resources :apps, only: [:create]
  66. resources :notifications, only: [:index]
  67. resources :accounts, only: [:show] do
  68. collection do
  69. get :relationships
  70. get :verify_credentials
  71. get :search
  72. end
  73. member do
  74. get :statuses
  75. get :followers
  76. get :following
  77. post :follow
  78. post :unfollow
  79. post :block
  80. post :unblock
  81. end
  82. end
  83. end
  84. end
  85. get '/web/*any', to: 'home#index', as: :web
  86. get :about, to: 'about#index'
  87. get :terms, to: 'about#terms'
  88. root 'home#index'
  89. match '*unmatched_route', via: :all, to: 'application#raise_not_found'
  90. end