Skip to content
Snippets Groups Projects
routes.rb 2.06 KiB
Newer Older
  • Learn to ignore specific revisions
  • Eugen Rochko's avatar
    Eugen Rochko committed
    Rails.application.routes.draw do
    
      mount ActionCable.server => '/cable'
    
    
      authenticate :user, lambda { |u| u.admin? } do
    
        mount Sidekiq::Web => '/sidekiq'
      end
    
    
    Eugen Rochko's avatar
    Eugen Rochko committed
      get '.well-known/host-meta', to: 'xrd#host_meta', as: :host_meta
      get '.well-known/webfinger', to: 'xrd#webfinger', as: :webfinger
    
    
      devise_for :users, path: 'auth', controllers: {
        sessions:           'auth/sessions',
        registrations:      'auth/registrations',
    
        passwords:          'auth/passwords',
        confirmations:      'auth/confirmations'
    
      resources :accounts, path: 'users', only: [:show], param: :username do
    
        resources :stream_entries, path: 'updates', only: [:show]
    
    
        member do
          get :followers
          get :following
    
    Eugen Rochko's avatar
    Eugen Rochko committed
    
    
      resource  :settings, only: [:show, :update]
    
        # PubSubHubbub
    
        resources :subscriptions, only: [:show]
        post '/subscriptions/:id', to: 'subscriptions#update'
    
        post '/salmon/:id', to: 'salmon#update', as: :salmon
    
    
        # JSON / REST API
    
        namespace :v1 do
          resources :statuses, only: [:create, :show, :destroy] do
            collection do
              get :home
              get :mentions
    
    Eugen Rochko's avatar
    Eugen Rochko committed
              get :public
    
            end
    
            member do
              get :context
    
              post :reblog
              post :unreblog
              post :favourite
              post :unfavourite
            end
    
          resources :follows,  only: [:create]
          resources :media,    only: [:create]
          resources :apps,     only: [:create]
    
          resources :accounts, only: [:show] do
            collection do
              get :relationships
    
            end
    
            member do
              get :statuses
              get :followers
              get :following
    
              post :follow
              post :unfollow
    
              post :block
              post :unblock
    
    Eugen Rochko's avatar
    Eugen Rochko committed
    
    
    Eugen Rochko's avatar
    Eugen Rochko committed
      get :about, to: 'about#index'
    
    Eugen Rochko's avatar
    Eugen Rochko committed
      root 'home#index'
    
    
      match '*unmatched_route', via: :all, to: 'application#raise_not_found'
    
    Eugen Rochko's avatar
    Eugen Rochko committed
    end