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.
 
 
 
 

169 lines
4.2 KiB

  1. # frozen_string_literal: true
  2. require 'sidekiq/web'
  3. Rails.application.routes.draw do
  4. mount LetterOpenerWeb::Engine, at: 'letter_opener' if Rails.env.development?
  5. mount ActionCable.server, at: 'cable'
  6. authenticate :user, lambda { |u| u.admin? } do
  7. mount Sidekiq::Web, at: 'sidekiq', as: :sidekiq
  8. mount PgHero::Engine, at: 'pghero', as: :pghero
  9. end
  10. use_doorkeeper do
  11. controllers authorizations: 'oauth/authorizations'
  12. end
  13. get '.well-known/host-meta', to: 'xrd#host_meta', as: :host_meta
  14. get '.well-known/webfinger', to: 'xrd#webfinger', as: :webfinger
  15. devise_for :users, path: 'auth', controllers: {
  16. sessions: 'auth/sessions',
  17. registrations: 'auth/registrations',
  18. passwords: 'auth/passwords',
  19. confirmations: 'auth/confirmations',
  20. }
  21. resources :accounts, path: 'users', only: [:show], param: :username do
  22. resources :stream_entries, path: 'updates', only: [:show] do
  23. member do
  24. get :embed
  25. end
  26. end
  27. get :remote_follow, to: 'remote_follow#new'
  28. post :remote_follow, to: 'remote_follow#create'
  29. member do
  30. get :followers
  31. get :following
  32. post :follow
  33. post :unfollow
  34. end
  35. end
  36. namespace :settings do
  37. resource :profile, only: [:show, :update]
  38. resource :preferences, only: [:show, :update]
  39. resource :two_factor_auth, only: [:show] do
  40. member do
  41. post :enable
  42. post :disable
  43. end
  44. end
  45. end
  46. resources :media, only: [:show]
  47. resources :tags, only: [:show]
  48. # Remote follow
  49. get :authorize_follow, to: 'authorize_follow#new'
  50. post :authorize_follow, to: 'authorize_follow#create'
  51. namespace :admin do
  52. resources :pubsubhubbub, only: [:index]
  53. resources :domain_blocks, only: [:index, :create]
  54. resources :settings, only: [:index, :update]
  55. resources :accounts, only: [:index, :show, :update] do
  56. member do
  57. post :suspend
  58. end
  59. end
  60. end
  61. get '/admin', to: redirect('/admin/settings', status: 302)
  62. namespace :api do
  63. # PubSubHubbub outgoing subscriptions
  64. resources :subscriptions, only: [:show]
  65. post '/subscriptions/:id', to: 'subscriptions#update'
  66. # PubSubHubbub incoming subscriptions
  67. post '/push', to: 'push#update', as: :push
  68. # Salmon
  69. post '/salmon/:id', to: 'salmon#update', as: :salmon
  70. # OEmbed
  71. get '/oembed', to: 'oembed#show', as: :oembed
  72. # JSON / REST API
  73. namespace :v1 do
  74. resources :statuses, only: [:create, :show, :destroy] do
  75. member do
  76. get :context
  77. get :card
  78. get :reblogged_by
  79. get :favourited_by
  80. post :reblog
  81. post :unreblog
  82. post :favourite
  83. post :unfavourite
  84. end
  85. end
  86. get '/timelines/home', to: 'timelines#home', as: :home_timeline
  87. get '/timelines/mentions', to: 'timelines#mentions', as: :mentions_timeline
  88. get '/timelines/public', to: 'timelines#public', as: :public_timeline
  89. get '/timelines/tag/:id', to: 'timelines#tag', as: :hashtag_timeline
  90. resources :follows, only: [:create]
  91. resources :media, only: [:create]
  92. resources :apps, only: [:create]
  93. resources :blocks, only: [:index]
  94. resources :favourites, only: [:index]
  95. resources :follow_requests, only: [:index] do
  96. member do
  97. post :authorize
  98. post :reject
  99. end
  100. end
  101. resources :notifications, only: [:index, :show] do
  102. collection do
  103. post :clear
  104. end
  105. end
  106. resources :accounts, only: [:show] do
  107. collection do
  108. get :relationships
  109. get :verify_credentials
  110. get :search
  111. end
  112. member do
  113. get :statuses
  114. get :followers
  115. get :following
  116. post :follow
  117. post :unfollow
  118. post :block
  119. post :unblock
  120. end
  121. end
  122. end
  123. namespace :web do
  124. resource :settings, only: [:update]
  125. end
  126. end
  127. get '/web/(*any)', to: 'home#index', as: :web
  128. get '/about', to: 'about#index'
  129. get '/about/more', to: 'about#more'
  130. get '/terms', to: 'about#terms'
  131. root 'home#index'
  132. match '*unmatched_route', via: :all, to: 'application#raise_not_found'
  133. end