The code powering m.abunchtell.com https://m.abunchtell.com
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

325 líneas
9.9 KiB

  1. # frozen_string_literal: true
  2. require 'sidekiq/web'
  3. require 'sidekiq-scheduler/web'
  4. Sidekiq::Web.set :session_secret, Rails.application.secrets[:secret_key_base]
  5. Rails.application.routes.draw do
  6. mount LetterOpenerWeb::Engine, at: 'letter_opener' if Rails.env.development?
  7. authenticate :user, lambda { |u| u.admin? } do
  8. mount Sidekiq::Web, at: 'sidekiq', as: :sidekiq
  9. mount PgHero::Engine, at: 'pghero', as: :pghero
  10. end
  11. use_doorkeeper do
  12. controllers authorizations: 'oauth/authorizations', authorized_applications: 'oauth/authorized_applications'
  13. end
  14. get '.well-known/host-meta', to: 'well_known/host_meta#show', as: :host_meta, defaults: { format: 'xml' }
  15. get '.well-known/webfinger', to: 'well_known/webfinger#show', as: :webfinger
  16. get 'manifest', to: 'manifests#show', defaults: { format: 'json' }
  17. get 'intent', to: 'intents#show'
  18. devise_scope :user do
  19. get '/invite/:invite_code', to: 'auth/registrations#new', as: :public_invite
  20. match '/auth/finish_signup' => 'auth/confirmations#finish_signup', via: [:get, :patch], as: :finish_signup
  21. end
  22. devise_for :users, path: 'auth', controllers: {
  23. omniauth_callbacks: 'auth/omniauth_callbacks',
  24. sessions: 'auth/sessions',
  25. registrations: 'auth/registrations',
  26. passwords: 'auth/passwords',
  27. confirmations: 'auth/confirmations',
  28. }
  29. get '/users/:username', to: redirect('/@%{username}'), constraints: lambda { |req| req.format.nil? || req.format.html? }
  30. resources :accounts, path: 'users', only: [:show], param: :username do
  31. resources :stream_entries, path: 'updates', only: [:show] do
  32. member do
  33. get :embed
  34. end
  35. end
  36. get :remote_follow, to: 'remote_follow#new'
  37. post :remote_follow, to: 'remote_follow#create'
  38. resources :statuses, only: [:show] do
  39. member do
  40. get :activity
  41. get :embed
  42. end
  43. end
  44. resources :followers, only: [:index], controller: :follower_accounts
  45. resources :following, only: [:index], controller: :following_accounts
  46. resource :follow, only: [:create], controller: :account_follow
  47. resource :unfollow, only: [:create], controller: :account_unfollow
  48. resource :outbox, only: [:show], module: :activitypub
  49. resource :inbox, only: [:create], module: :activitypub
  50. resources :collections, only: [:show], module: :activitypub
  51. end
  52. resource :inbox, only: [:create], module: :activitypub
  53. get '/@:username', to: 'accounts#show', as: :short_account
  54. get '/@:username/with_replies', to: 'accounts#show', as: :short_account_with_replies
  55. get '/@:username/media', to: 'accounts#show', as: :short_account_media
  56. get '/@:account_username/:id', to: 'statuses#show', as: :short_account_status
  57. get '/@:account_username/:id/embed', to: 'statuses#embed', as: :embed_short_account_status
  58. namespace :settings do
  59. resource :profile, only: [:show, :update]
  60. resource :preferences, only: [:show, :update]
  61. resource :notifications, only: [:show, :update]
  62. resource :import, only: [:show, :create]
  63. resource :export, only: [:show, :create]
  64. namespace :exports, constraints: { format: :csv } do
  65. resources :follows, only: :index, controller: :following_accounts
  66. resources :blocks, only: :index, controller: :blocked_accounts
  67. resources :mutes, only: :index, controller: :muted_accounts
  68. end
  69. resource :two_factor_authentication, only: [:show, :create, :destroy]
  70. namespace :two_factor_authentication do
  71. resources :recovery_codes, only: [:create]
  72. resource :confirmation, only: [:new, :create]
  73. end
  74. resource :follower_domains, only: [:show, :update]
  75. resources :applications, except: [:edit] do
  76. member do
  77. post :regenerate
  78. end
  79. end
  80. resource :delete, only: [:show, :destroy]
  81. resource :migration, only: [:show, :update]
  82. resources :sessions, only: [:destroy]
  83. end
  84. resources :media, only: [:show] do
  85. get :player
  86. end
  87. resources :tags, only: [:show]
  88. resources :emojis, only: [:show]
  89. resources :invites, only: [:index, :create, :destroy]
  90. get '/media_proxy/:id/(*any)', to: 'media_proxy#show', as: :media_proxy
  91. # Remote follow
  92. resource :authorize_follow, only: [:show, :create]
  93. resource :share, only: [:show, :create]
  94. namespace :admin do
  95. resources :subscriptions, only: [:index]
  96. resources :domain_blocks, only: [:index, :new, :create, :show, :destroy]
  97. resources :email_domain_blocks, only: [:index, :new, :create, :destroy]
  98. resources :action_logs, only: [:index]
  99. resource :settings, only: [:edit, :update]
  100. resources :invites, only: [:index, :create, :destroy]
  101. resources :instances, only: [:index] do
  102. collection do
  103. post :resubscribe
  104. end
  105. end
  106. resources :reports, only: [:index, :show, :update] do
  107. resources :reported_statuses, only: [:create, :update, :destroy]
  108. end
  109. resources :accounts, only: [:index, :show] do
  110. member do
  111. post :subscribe
  112. post :unsubscribe
  113. post :enable
  114. post :disable
  115. post :redownload
  116. post :remove_avatar
  117. post :memorialize
  118. end
  119. resource :reset, only: [:create]
  120. resource :silence, only: [:create, :destroy]
  121. resource :suspension, only: [:create, :destroy]
  122. resource :confirmation, only: [:create]
  123. resources :statuses, only: [:index, :create, :update, :destroy]
  124. resource :role do
  125. member do
  126. post :promote
  127. post :demote
  128. end
  129. end
  130. end
  131. resources :users, only: [] do
  132. resource :two_factor_authentication, only: [:destroy]
  133. end
  134. resources :custom_emojis, only: [:index, :new, :create, :update, :destroy] do
  135. member do
  136. post :copy
  137. post :enable
  138. post :disable
  139. end
  140. end
  141. resources :account_moderation_notes, only: [:create, :destroy]
  142. end
  143. authenticate :user, lambda { |u| u.admin? } do
  144. get '/admin', to: redirect('/admin/settings/edit', status: 302)
  145. end
  146. authenticate :user, lambda { |u| u.moderator? } do
  147. get '/admin', to: redirect('/admin/reports', status: 302)
  148. end
  149. namespace :api do
  150. # PubSubHubbub outgoing subscriptions
  151. resources :subscriptions, only: [:show]
  152. post '/subscriptions/:id', to: 'subscriptions#update'
  153. # PubSubHubbub incoming subscriptions
  154. post '/push', to: 'push#update', as: :push
  155. # Salmon
  156. post '/salmon/:id', to: 'salmon#update', as: :salmon
  157. # OEmbed
  158. get '/oembed', to: 'oembed#show', as: :oembed
  159. # JSON / REST API
  160. namespace :v1 do
  161. resources :statuses, only: [:create, :show, :destroy] do
  162. scope module: :statuses do
  163. resources :reblogged_by, controller: :reblogged_by_accounts, only: :index
  164. resources :favourited_by, controller: :favourited_by_accounts, only: :index
  165. resource :reblog, only: :create
  166. post :unreblog, to: 'reblogs#destroy'
  167. resource :favourite, only: :create
  168. post :unfavourite, to: 'favourites#destroy'
  169. resource :mute, only: :create
  170. post :unmute, to: 'mutes#destroy'
  171. resource :pin, only: :create
  172. post :unpin, to: 'pins#destroy'
  173. end
  174. member do
  175. get :context
  176. get :card
  177. end
  178. end
  179. namespace :timelines do
  180. resource :home, only: :show, controller: :home
  181. resource :public, only: :show, controller: :public
  182. resources :tag, only: :show
  183. resources :list, only: :show
  184. end
  185. resources :streaming, only: [:index]
  186. resources :custom_emojis, only: [:index]
  187. get '/search', to: 'search#index', as: :search
  188. resources :follows, only: [:create]
  189. resources :media, only: [:create, :update]
  190. resources :blocks, only: [:index]
  191. resources :mutes, only: [:index]
  192. resources :favourites, only: [:index]
  193. resources :reports, only: [:index, :create]
  194. namespace :apps do
  195. get :verify_credentials, to: 'credentials#show'
  196. end
  197. resources :apps, only: [:create]
  198. resource :instance, only: [:show] do
  199. resources :peers, only: [:index], controller: 'instances/peers'
  200. resource :activity, only: [:show], controller: 'instances/activity'
  201. end
  202. resource :domain_blocks, only: [:show, :create, :destroy]
  203. resources :follow_requests, only: [:index] do
  204. member do
  205. post :authorize
  206. post :reject
  207. end
  208. end
  209. resources :notifications, only: [:index, :show] do
  210. collection do
  211. post :clear
  212. post :dismiss
  213. end
  214. end
  215. namespace :accounts do
  216. get :verify_credentials, to: 'credentials#show'
  217. patch :update_credentials, to: 'credentials#update'
  218. resource :search, only: :show, controller: :search
  219. resources :relationships, only: :index
  220. end
  221. resources :accounts, only: [:show] do
  222. resources :statuses, only: :index, controller: 'accounts/statuses'
  223. resources :followers, only: :index, controller: 'accounts/follower_accounts'
  224. resources :following, only: :index, controller: 'accounts/following_accounts'
  225. resources :lists, only: :index, controller: 'accounts/lists'
  226. member do
  227. post :follow
  228. post :unfollow
  229. post :block
  230. post :unblock
  231. post :mute
  232. post :unmute
  233. end
  234. end
  235. resources :lists, only: [:index, :create, :show, :update, :destroy] do
  236. resource :accounts, only: [:show, :create, :destroy], controller: 'lists/accounts'
  237. end
  238. end
  239. namespace :web do
  240. resource :settings, only: [:update]
  241. resource :embed, only: [:create]
  242. resources :push_subscriptions, only: [:create] do
  243. member do
  244. put :update
  245. end
  246. end
  247. end
  248. end
  249. get '/web/(*any)', to: 'home#index', as: :web
  250. get '/about', to: 'about#show'
  251. get '/about/more', to: 'about#more'
  252. get '/terms', to: 'about#terms'
  253. root 'home#index'
  254. match '*unmatched_route',
  255. via: :all,
  256. to: 'application#raise_not_found',
  257. format: false
  258. end