logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

routes.rb (10316B)


  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 :remote_unfollow, only: [:create]
  93. resource :authorize_follow, only: [:show, :create]
  94. resource :share, only: [:show, :create]
  95. namespace :admin do
  96. resources :subscriptions, only: [:index]
  97. resources :domain_blocks, only: [:index, :new, :create, :show, :destroy]
  98. resources :email_domain_blocks, only: [:index, :new, :create, :destroy]
  99. resources :action_logs, only: [:index]
  100. resource :settings, only: [:edit, :update]
  101. resources :invites, only: [:index, :create, :destroy]
  102. resources :instances, only: [:index] do
  103. collection do
  104. post :resubscribe
  105. end
  106. end
  107. resources :reports, only: [:index, :show, :update] do
  108. resources :reported_statuses, only: [:create, :update, :destroy]
  109. end
  110. resources :report_notes, only: [:create, :destroy]
  111. resources :accounts, only: [:index, :show] do
  112. member do
  113. post :subscribe
  114. post :unsubscribe
  115. post :enable
  116. post :disable
  117. post :redownload
  118. post :remove_avatar
  119. post :memorialize
  120. end
  121. resource :change_email, only: [:show, :update]
  122. resource :reset, only: [:create]
  123. resource :silence, only: [:create, :destroy]
  124. resource :suspension, only: [:create, :destroy]
  125. resource :confirmation, only: [:create]
  126. resources :statuses, only: [:index, :create, :update, :destroy]
  127. resource :role do
  128. member do
  129. post :promote
  130. post :demote
  131. end
  132. end
  133. end
  134. resources :users, only: [] do
  135. resource :two_factor_authentication, only: [:destroy]
  136. end
  137. resources :custom_emojis, only: [:index, :new, :create, :update, :destroy] do
  138. member do
  139. post :copy
  140. post :enable
  141. post :disable
  142. end
  143. end
  144. resources :account_moderation_notes, only: [:create, :destroy]
  145. end
  146. authenticate :user, lambda { |u| u.admin? } do
  147. get '/admin', to: redirect('/admin/settings/edit', status: 302)
  148. end
  149. authenticate :user, lambda { |u| u.moderator? } do
  150. get '/admin', to: redirect('/admin/reports', status: 302)
  151. end
  152. namespace :api do
  153. # PubSubHubbub outgoing subscriptions
  154. resources :subscriptions, only: [:show]
  155. post '/subscriptions/:id', to: 'subscriptions#update'
  156. # PubSubHubbub incoming subscriptions
  157. post '/push', to: 'push#update', as: :push
  158. # Salmon
  159. post '/salmon/:id', to: 'salmon#update', as: :salmon
  160. # OEmbed
  161. get '/oembed', to: 'oembed#show', as: :oembed
  162. # JSON / REST API
  163. namespace :v1 do
  164. resources :statuses, only: [:create, :show, :destroy] do
  165. scope module: :statuses do
  166. resources :reblogged_by, controller: :reblogged_by_accounts, only: :index
  167. resources :favourited_by, controller: :favourited_by_accounts, only: :index
  168. resource :reblog, only: :create
  169. post :unreblog, to: 'reblogs#destroy'
  170. resource :favourite, only: :create
  171. post :unfavourite, to: 'favourites#destroy'
  172. resource :mute, only: :create
  173. post :unmute, to: 'mutes#destroy'
  174. resource :pin, only: :create
  175. post :unpin, to: 'pins#destroy'
  176. end
  177. member do
  178. get :context
  179. get :card
  180. end
  181. end
  182. namespace :timelines do
  183. resource :home, only: :show, controller: :home
  184. resource :public, only: :show, controller: :public
  185. resources :tag, only: :show
  186. resources :list, only: :show
  187. end
  188. resources :streaming, only: [:index]
  189. resources :custom_emojis, only: [:index]
  190. get '/search', to: 'search#index', as: :search
  191. resources :follows, only: [:create]
  192. resources :media, only: [:create, :update]
  193. resources :blocks, only: [:index]
  194. resources :mutes, only: [:index]
  195. resources :favourites, only: [:index]
  196. resources :reports, only: [:index, :create]
  197. namespace :apps do
  198. get :verify_credentials, to: 'credentials#show'
  199. end
  200. resources :apps, only: [:create]
  201. resource :instance, only: [:show] do
  202. resources :peers, only: [:index], controller: 'instances/peers'
  203. resource :activity, only: [:show], controller: 'instances/activity'
  204. end
  205. resource :domain_blocks, only: [:show, :create, :destroy]
  206. resources :follow_requests, only: [:index] do
  207. member do
  208. post :authorize
  209. post :reject
  210. end
  211. end
  212. resources :notifications, only: [:index, :show] do
  213. collection do
  214. post :clear
  215. post :dismiss
  216. end
  217. end
  218. namespace :accounts do
  219. get :verify_credentials, to: 'credentials#show'
  220. patch :update_credentials, to: 'credentials#update'
  221. resource :search, only: :show, controller: :search
  222. resources :relationships, only: :index
  223. end
  224. resources :accounts, only: [:show] do
  225. resources :statuses, only: :index, controller: 'accounts/statuses'
  226. resources :followers, only: :index, controller: 'accounts/follower_accounts'
  227. resources :following, only: :index, controller: 'accounts/following_accounts'
  228. resources :lists, only: :index, controller: 'accounts/lists'
  229. member do
  230. post :follow
  231. post :unfollow
  232. post :block
  233. post :unblock
  234. post :mute
  235. post :unmute
  236. end
  237. end
  238. resources :lists, only: [:index, :create, :show, :update, :destroy] do
  239. resource :accounts, only: [:show, :create, :destroy], controller: 'lists/accounts'
  240. end
  241. end
  242. namespace :web do
  243. resource :settings, only: [:update]
  244. resource :embed, only: [:create]
  245. resources :push_subscriptions, only: [:create] do
  246. member do
  247. put :update
  248. end
  249. end
  250. end
  251. end
  252. get '/web/(*any)', to: 'home#index', as: :web
  253. get '/about', to: 'about#show'
  254. get '/about/more', to: 'about#more'
  255. get '/terms', to: 'about#terms'
  256. root 'home#index'
  257. match '*unmatched_route',
  258. via: :all,
  259. to: 'application#raise_not_found',
  260. format: false
  261. end