The code powering m.abunchtell.com https://m.abunchtell.com
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.
 
 
 
 

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