The code powering m.abunchtell.com https://m.abunchtell.com
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 

202 рядки
5.1 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: 'xrd#host_meta', as: :host_meta
  13. get '.well-known/webfinger', to: 'xrd#webfinger', as: :webfinger
  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] do
  43. collection do
  44. get :follows, to: 'exports#download_following_list'
  45. get :blocks, to: 'exports#download_blocking_list'
  46. end
  47. end
  48. resource :two_factor_auth, only: [:show, :new, :create] do
  49. member do
  50. post :disable
  51. end
  52. end
  53. end
  54. resources :media, only: [:show]
  55. resources :tags, only: [:show]
  56. # Remote follow
  57. get :authorize_follow, to: 'authorize_follow#new'
  58. post :authorize_follow, to: 'authorize_follow#create'
  59. namespace :admin do
  60. resources :pubsubhubbub, only: [:index]
  61. resources :domain_blocks, only: [:index, :new, :create]
  62. resources :settings, only: [:index, :update]
  63. resources :reports, only: [:index, :show] do
  64. member do
  65. post :resolve
  66. post :silence
  67. post :suspend
  68. post :remove
  69. end
  70. end
  71. resources :accounts, only: [:index, :show] do
  72. member do
  73. post :silence
  74. post :unsilence
  75. post :suspend
  76. post :unsuspend
  77. end
  78. end
  79. end
  80. get '/admin', to: redirect('/admin/settings', status: 302)
  81. namespace :api do
  82. # PubSubHubbub outgoing subscriptions
  83. resources :subscriptions, only: [:show]
  84. post '/subscriptions/:id', to: 'subscriptions#update'
  85. # PubSubHubbub incoming subscriptions
  86. post '/push', to: 'push#update', as: :push
  87. # Salmon
  88. post '/salmon/:id', to: 'salmon#update', as: :salmon
  89. # OEmbed
  90. get '/oembed', to: 'oembed#show', as: :oembed
  91. # JSON / REST API
  92. namespace :v1 do
  93. resources :statuses, only: [:create, :show, :destroy] do
  94. member do
  95. get :context
  96. get :card
  97. get :reblogged_by
  98. get :favourited_by
  99. post :reblog
  100. post :unreblog
  101. post :favourite
  102. post :unfavourite
  103. end
  104. end
  105. get '/timelines/home', to: 'timelines#home', as: :home_timeline
  106. get '/timelines/public', to: 'timelines#public', as: :public_timeline
  107. get '/timelines/tag/:id', to: 'timelines#tag', as: :hashtag_timeline
  108. get '/search', to: 'search#index', as: :search
  109. resources :follows, only: [:create]
  110. resources :media, only: [:create]
  111. resources :apps, only: [:create]
  112. resources :blocks, only: [:index]
  113. resources :mutes, only: [:index]
  114. resources :favourites, only: [:index]
  115. resources :reports, only: [:index, :create]
  116. resource :instance, only: [:show]
  117. resources :follow_requests, only: [:index] do
  118. member do
  119. post :authorize
  120. post :reject
  121. end
  122. end
  123. resources :notifications, only: [:index, :show] do
  124. collection do
  125. post :clear
  126. end
  127. end
  128. resources :accounts, only: [:show] do
  129. collection do
  130. get :relationships
  131. get :verify_credentials
  132. get :search
  133. end
  134. member do
  135. get :statuses
  136. get :followers
  137. get :following
  138. post :follow
  139. post :unfollow
  140. post :block
  141. post :unblock
  142. post :mute
  143. post :unmute
  144. end
  145. end
  146. end
  147. namespace :web do
  148. resource :settings, only: [:update]
  149. end
  150. end
  151. get '/web/(*any)', to: 'home#index', as: :web
  152. get '/about', to: 'about#show'
  153. get '/about/more', to: 'about#more'
  154. get '/terms', to: 'about#terms'
  155. root 'home#index'
  156. match '*unmatched_route',
  157. via: :all,
  158. to: 'application#raise_not_found',
  159. format: false
  160. end