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.

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