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.
 
 
 
 

161 lines
4.0 KiB

  1. # frozen_string_literal: true
  2. require 'sidekiq/web'
  3. Rails.application.routes.draw do
  4. # Development-only routes
  5. if Rails.env.development?
  6. mount LetterOpenerWeb::Engine, at: "/letter_opener"
  7. end
  8. mount ActionCable.server, at: 'cable'
  9. authenticate :user, lambda { |u| u.admin? } do
  10. mount Sidekiq::Web, at: 'sidekiq', as: :sidekiq
  11. mount PgHero::Engine, at: 'pghero', as: :pghero
  12. end
  13. use_doorkeeper do
  14. controllers authorizations: 'oauth/authorizations'
  15. end
  16. get '.well-known/host-meta', to: 'xrd#host_meta', as: :host_meta
  17. get '.well-known/webfinger', to: 'xrd#webfinger', as: :webfinger
  18. devise_for :users, path: 'auth', controllers: {
  19. sessions: 'auth/sessions',
  20. registrations: 'auth/registrations',
  21. passwords: 'auth/passwords',
  22. confirmations: 'auth/confirmations',
  23. }
  24. resources :accounts, path: 'users', only: [:show], param: :username do
  25. resources :stream_entries, path: 'updates', only: [:show] do
  26. member do
  27. get :embed
  28. end
  29. end
  30. get :remote_follow, to: 'remote_follow#new'
  31. post :remote_follow, to: 'remote_follow#create'
  32. member do
  33. get :followers
  34. get :following
  35. post :follow
  36. post :unfollow
  37. end
  38. end
  39. namespace :settings do
  40. resource :profile, only: [:show, :update]
  41. resource :preferences, only: [:show, :update]
  42. end
  43. resources :media, only: [:show]
  44. resources :tags, only: [:show]
  45. # Remote follow
  46. get :authorize_follow, to: 'authorize_follow#new'
  47. post :authorize_follow, to: 'authorize_follow#create'
  48. namespace :admin do
  49. resources :pubsubhubbub, only: [:index]
  50. resources :domain_blocks, only: [:index, :create]
  51. resources :settings, only: [:index, :update]
  52. resources :accounts, only: [:index, :show, :update] do
  53. member do
  54. post :suspend
  55. end
  56. end
  57. end
  58. namespace :api do
  59. # PubSubHubbub outgoing subscriptions
  60. resources :subscriptions, only: [:show]
  61. post '/subscriptions/:id', to: 'subscriptions#update'
  62. # PubSubHubbub incoming subscriptions
  63. post '/push', to: 'push#update', as: :push
  64. # Salmon
  65. post '/salmon/:id', to: 'salmon#update', as: :salmon
  66. # OEmbed
  67. get '/oembed', to: 'oembed#show', as: :oembed
  68. # JSON / REST API
  69. namespace :v1 do
  70. resources :statuses, only: [:create, :show, :destroy] do
  71. member do
  72. get :context
  73. get :card
  74. get :reblogged_by
  75. get :favourited_by
  76. post :reblog
  77. post :unreblog
  78. post :favourite
  79. post :unfavourite
  80. end
  81. end
  82. get '/timelines/home', to: 'timelines#home', as: :home_timeline
  83. get '/timelines/mentions', to: 'timelines#mentions', as: :mentions_timeline
  84. get '/timelines/public', to: 'timelines#public', as: :public_timeline
  85. get '/timelines/tag/:id', to: 'timelines#tag', as: :hashtag_timeline
  86. resources :follows, only: [:create]
  87. resources :media, only: [:create]
  88. resources :apps, only: [:create]
  89. resources :blocks, only: [:index]
  90. resources :follow_requests, only: [:index] do
  91. member do
  92. post :authorize
  93. post :reject
  94. end
  95. end
  96. resources :notifications, only: [:index]
  97. resources :favourites, only: [:index]
  98. resources :accounts, only: [:show] do
  99. collection do
  100. get :relationships
  101. get :verify_credentials
  102. get :search
  103. end
  104. member do
  105. get :statuses
  106. get :followers
  107. get :following
  108. post :follow
  109. post :unfollow
  110. post :block
  111. post :unblock
  112. end
  113. end
  114. end
  115. namespace :web do
  116. resource :settings, only: [:update]
  117. end
  118. end
  119. get '/web/(*any)', to: 'home#index', as: :web
  120. get '/about', to: 'about#index'
  121. get '/about/more', to: 'about#more'
  122. get '/terms', to: 'about#terms'
  123. root 'home#index'
  124. match '*unmatched_route', via: :all, to: 'application#raise_not_found'
  125. end