The code powering m.abunchtell.com https://m.abunchtell.com
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

145 行
3.6 KiB

  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', as: :sidekiq
  7. mount PgHero::Engine, at: 'pghero', as: :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] do
  22. member do
  23. get :embed
  24. end
  25. end
  26. member do
  27. get :followers
  28. get :following
  29. post :follow
  30. post :unfollow
  31. end
  32. end
  33. namespace :settings do
  34. resource :profile, only: [:show, :update]
  35. resource :preferences, only: [:show, :update]
  36. end
  37. resources :media, only: [:show]
  38. resources :tags, only: [:show]
  39. # Remote follow
  40. get :authorize_follow, to: 'authorize_follow#new'
  41. post :authorize_follow, to: 'authorize_follow#create'
  42. namespace :admin do
  43. resources :pubsubhubbub, only: [:index]
  44. resources :domain_blocks, only: [:index, :create]
  45. resources :accounts, only: [:index, :show, :update] do
  46. member do
  47. post :suspend
  48. end
  49. end
  50. end
  51. namespace :api do
  52. # PubSubHubbub outgoing subscriptions
  53. resources :subscriptions, only: [:show]
  54. post '/subscriptions/:id', to: 'subscriptions#update'
  55. # PubSubHubbub incoming subscriptions
  56. post '/push', to: 'push#update', as: :push
  57. # Salmon
  58. post '/salmon/:id', to: 'salmon#update', as: :salmon
  59. # OEmbed
  60. get '/oembed', to: 'oembed#show', as: :oembed
  61. # JSON / REST API
  62. namespace :v1 do
  63. resources :statuses, only: [:create, :show, :destroy] do
  64. member do
  65. get :context
  66. get :reblogged_by
  67. get :favourited_by
  68. post :reblog
  69. post :unreblog
  70. post :favourite
  71. post :unfavourite
  72. end
  73. end
  74. get '/timelines/home', to: 'timelines#home', as: :home_timeline
  75. get '/timelines/mentions', to: 'timelines#mentions', as: :mentions_timeline
  76. get '/timelines/public', to: 'timelines#public', as: :public_timeline
  77. get '/timelines/tag/:id', to: 'timelines#tag', as: :hashtag_timeline
  78. resources :follows, only: [:create]
  79. resources :media, only: [:create]
  80. resources :apps, only: [:create]
  81. resources :blocks, only: [:index]
  82. resources :follow_requests, only: [:index] do
  83. member do
  84. post :authorize
  85. post :reject
  86. end
  87. end
  88. resources :notifications, only: [:index]
  89. resources :favourites, only: [:index]
  90. resources :accounts, only: [:show] do
  91. collection do
  92. get :relationships
  93. get :verify_credentials
  94. get :search
  95. end
  96. member do
  97. get :statuses
  98. get :followers
  99. get :following
  100. post :follow
  101. post :unfollow
  102. post :block
  103. post :unblock
  104. end
  105. end
  106. end
  107. end
  108. get '/web/*any', to: 'home#index', as: :web
  109. get :about, to: 'about#index'
  110. get :terms, to: 'about#terms'
  111. root 'home#index'
  112. match '*unmatched_route', via: :all, to: 'application#raise_not_found'
  113. end