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.
 
 
 
 

196 lines
5.3 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. 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', authorized_applications: 'oauth/authorized_applications'
  11. end
  12. get '.well-known/host-meta', to: 'well_known/host_meta#show', as: :host_meta, defaults: { format: 'xml' }
  13. get '.well-known/webfinger', to: 'well_known/webfinger#show', as: :webfinger, defaults: { format: 'json' }
  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. get '/users/:username', to: redirect('/@%{username}'), constraints: { format: :html }
  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. get '/@:username', to: 'accounts#show', as: :short_account
  37. get '/@:account_username/:id', to: 'statuses#show', as: :short_account_status
  38. namespace :settings do
  39. resource :profile, only: [:show, :update]
  40. resource :preferences, only: [:show, :update]
  41. resource :import, only: [:show, :create]
  42. resource :export, only: [:show]
  43. namespace :exports, constraints: { format: :csv } do
  44. resources :follows, only: :index, controller: :following_accounts
  45. resources :blocks, only: :index, controller: :blocked_accounts
  46. resources :mutes, only: :index, controller: :muted_accounts
  47. end
  48. resource :two_factor_auth, only: [:show, :new, :create] do
  49. member do
  50. post :disable
  51. post :recovery_codes
  52. end
  53. end
  54. end
  55. resources :media, only: [:show]
  56. resources :tags, only: [:show]
  57. # Remote follow
  58. get :authorize_follow, to: 'authorize_follow#new'
  59. post :authorize_follow, to: 'authorize_follow#create'
  60. namespace :admin do
  61. resources :pubsubhubbub, only: [:index]
  62. resources :domain_blocks, only: [:index, :new, :create]
  63. resources :settings, only: [:index, :update]
  64. resources :reports, only: [:index, :show, :update] do
  65. resources :reported_statuses, only: :destroy
  66. end
  67. resources :accounts, only: [:index, :show] do
  68. resource :silence, only: [:create, :destroy]
  69. resource :suspension, only: [:create, :destroy]
  70. end
  71. end
  72. get '/admin', to: redirect('/admin/settings', status: 302)
  73. namespace :api do
  74. # PubSubHubbub outgoing subscriptions
  75. resources :subscriptions, only: [:show]
  76. post '/subscriptions/:id', to: 'subscriptions#update'
  77. # PubSubHubbub incoming subscriptions
  78. post '/push', to: 'push#update', as: :push
  79. # Salmon
  80. post '/salmon/:id', to: 'salmon#update', as: :salmon
  81. # OEmbed
  82. get '/oembed', to: 'oembed#show', as: :oembed
  83. # JSON / REST API
  84. namespace :v1 do
  85. resources :statuses, only: [:create, :show, :destroy] do
  86. member do
  87. get :context
  88. get :card
  89. get :reblogged_by
  90. get :favourited_by
  91. post :reblog
  92. post :unreblog
  93. post :favourite
  94. post :unfavourite
  95. end
  96. end
  97. get '/timelines/home', to: 'timelines#home', as: :home_timeline
  98. get '/timelines/public', to: 'timelines#public', as: :public_timeline
  99. get '/timelines/tag/:id', to: 'timelines#tag', as: :hashtag_timeline
  100. get '/search', to: 'search#index', as: :search
  101. resources :follows, only: [:create]
  102. resources :media, only: [:create]
  103. resources :apps, only: [:create]
  104. resources :blocks, only: [:index]
  105. resources :mutes, only: [:index]
  106. resources :favourites, only: [:index]
  107. resources :reports, only: [:index, :create]
  108. resource :instance, only: [:show]
  109. resources :follow_requests, only: [:index] do
  110. member do
  111. post :authorize
  112. post :reject
  113. end
  114. end
  115. resources :notifications, only: [:index, :show] do
  116. collection do
  117. post :clear
  118. end
  119. end
  120. resources :accounts, only: [:show] do
  121. collection do
  122. get :relationships
  123. get :verify_credentials
  124. patch :update_credentials
  125. get :search
  126. end
  127. member do
  128. get :statuses
  129. get :followers
  130. get :following
  131. post :follow
  132. post :unfollow
  133. post :block
  134. post :unblock
  135. post :mute
  136. post :unmute
  137. end
  138. end
  139. end
  140. namespace :web do
  141. resource :settings, only: [:update]
  142. end
  143. end
  144. get '/web/(*any)', to: 'home#index', as: :web
  145. get '/about', to: 'about#show'
  146. get '/about/more', to: 'about#more'
  147. get '/terms', to: 'about#terms'
  148. root 'home#index'
  149. match '*unmatched_route',
  150. via: :all,
  151. to: 'application#raise_not_found',
  152. format: false
  153. end