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.
 
 
 
 

210 lines
6.0 KiB

  1. # frozen_string_literal: true
  2. require 'sidekiq/web'
  3. require 'sidekiq-scheduler/web'
  4. Rails.application.routes.draw do
  5. mount LetterOpenerWeb::Engine, at: 'letter_opener' if Rails.env.development?
  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', authorized_applications: 'oauth/authorized_applications'
  12. end
  13. get '.well-known/host-meta', to: 'well_known/host_meta#show', as: :host_meta, defaults: { format: 'xml' }
  14. get '.well-known/webfinger', to: 'well_known/webfinger#show', 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. get '/users/:username', to: redirect('/@%{username}'), constraints: { format: :html }
  22. resources :accounts, path: 'users', only: [:show], param: :username do
  23. resources :stream_entries, path: 'updates', only: [:show] do
  24. member do
  25. get :embed
  26. end
  27. end
  28. get :remote_follow, to: 'remote_follow#new'
  29. post :remote_follow, to: 'remote_follow#create'
  30. resources :followers, only: [:index], controller: :follower_accounts
  31. resources :following, only: [:index], controller: :following_accounts
  32. resource :follow, only: [:create], controller: :account_follow
  33. resource :unfollow, only: [:create], controller: :account_unfollow
  34. end
  35. get '/@:username', to: 'accounts#show', as: :short_account
  36. get '/@:account_username/:id', to: 'statuses#show', as: :short_account_status
  37. namespace :settings do
  38. resource :profile, only: [:show, :update]
  39. resource :preferences, only: [:show, :update]
  40. resource :import, only: [:show, :create]
  41. resource :export, only: [:show]
  42. namespace :exports, constraints: { format: :csv } do
  43. resources :follows, only: :index, controller: :following_accounts
  44. resources :blocks, only: :index, controller: :blocked_accounts
  45. resources :mutes, only: :index, controller: :muted_accounts
  46. end
  47. resource :two_factor_authentication, only: [:show, :create, :destroy]
  48. namespace :two_factor_authentication do
  49. resources :recovery_codes, only: [:create]
  50. resource :confirmation, only: [:new, :create]
  51. end
  52. resource :follower_domains, only: [:show, :update]
  53. end
  54. resources :media, only: [:show]
  55. resources :tags, only: [:show]
  56. # Remote follow
  57. resource :authorize_follow, only: [:show, :create]
  58. namespace :admin do
  59. resources :pubsubhubbub, only: [:index]
  60. resources :domain_blocks, only: [:index, :new, :create, :show, :destroy]
  61. resource :settings, only: [:edit, :update]
  62. resources :instances, only: [:index]
  63. resources :reports, only: [:index, :show, :update] do
  64. resources :reported_statuses, only: :destroy
  65. end
  66. resources :accounts, only: [:index, :show] do
  67. resource :reset, only: [:create]
  68. resource :silence, only: [:create, :destroy]
  69. resource :suspension, only: [:create, :destroy]
  70. resource :confirmation, only: [:create]
  71. end
  72. resources :users, only: [] do
  73. resource :two_factor_authentication, only: [:destroy]
  74. end
  75. end
  76. get '/admin', to: redirect('/admin/settings/edit', status: 302)
  77. namespace :api do
  78. # PubSubHubbub outgoing subscriptions
  79. resources :subscriptions, only: [:show]
  80. post '/subscriptions/:id', to: 'subscriptions#update'
  81. # PubSubHubbub incoming subscriptions
  82. post '/push', to: 'push#update', as: :push
  83. # Salmon
  84. post '/salmon/:id', to: 'salmon#update', as: :salmon
  85. # OEmbed
  86. get '/oembed', to: 'oembed#show', as: :oembed
  87. # ActivityPub
  88. namespace :activitypub do
  89. get '/users/:id/outbox', to: 'outbox#show', as: :outbox
  90. get '/statuses/:id', to: 'activities#show_status', as: :status
  91. resources :notes, only: [:show]
  92. end
  93. # JSON / REST API
  94. namespace :v1 do
  95. resources :statuses, only: [:create, :show, :destroy] do
  96. member do
  97. get :context
  98. get :card
  99. get :reblogged_by
  100. get :favourited_by
  101. post :reblog
  102. post :unreblog
  103. post :favourite
  104. post :unfavourite
  105. post :mute
  106. post :unmute
  107. end
  108. end
  109. get '/timelines/home', to: 'timelines#home', as: :home_timeline
  110. get '/timelines/public', to: 'timelines#public', as: :public_timeline
  111. get '/timelines/tag/:id', to: 'timelines#tag', as: :hashtag_timeline
  112. get '/search', to: 'search#index', as: :search
  113. resources :follows, only: [:create]
  114. resources :media, only: [:create]
  115. resources :apps, only: [:create]
  116. resources :blocks, only: [:index]
  117. resources :mutes, only: [:index]
  118. resources :favourites, only: [:index]
  119. resources :reports, only: [:index, :create]
  120. resource :instance, only: [:show]
  121. resources :follow_requests, only: [:index] do
  122. member do
  123. post :authorize
  124. post :reject
  125. end
  126. end
  127. resources :notifications, only: [:index, :show] do
  128. collection do
  129. post :clear
  130. post :dismiss
  131. end
  132. end
  133. resources :accounts, only: [:show] do
  134. collection do
  135. get :relationships
  136. get :verify_credentials
  137. patch :update_credentials
  138. get :search
  139. end
  140. member do
  141. get :statuses
  142. get :followers
  143. get :following
  144. post :follow
  145. post :unfollow
  146. post :block
  147. post :unblock
  148. post :mute
  149. post :unmute
  150. end
  151. end
  152. end
  153. namespace :web do
  154. resource :settings, only: [:update]
  155. end
  156. end
  157. get '/web/(*any)', to: 'home#index', as: :web
  158. get '/about', to: 'about#show'
  159. get '/about/more', to: 'about#more'
  160. get '/terms', to: 'about#terms'
  161. root 'home#index'
  162. match '*unmatched_route',
  163. via: :all,
  164. to: 'application#raise_not_found',
  165. format: false
  166. end