Skip to content
Extraits de code Groupes Projets
routes.rb 7,43 ko
Newer Older
  • Learn to ignore specific revisions
  • danielgrippi's avatar
    danielgrippi a validé
    #   Copyright (c) 2010-2011, Diaspora Inc.  This file is
    
    Raphael's avatar
    Raphael a validé
    #   licensed under the Affero General Public License version 3 or later.  See
    
    Raphael's avatar
    Raphael a validé
    #   the COPYRIGHT file.
    
    require "sidekiq/web"
    
    require "sidekiq/cron/web"
    
    Sidekiq::Web.set :sessions, false # disable rack session cookie
    
    maxwell's avatar
    maxwell a validé
    Diaspora::Application.routes.draw do
    
    Denys Kurets's avatar
    Denys Kurets a validé
      resources :report, except: %i(edit new show)
    
    Jonne Haß's avatar
    Jonne Haß a validé
      constraints ->(req) { req.env["warden"].authenticate?(scope: :user) &&
                            req.env['warden'].user.admin? } do
        mount Sidekiq::Web => '/sidekiq', :as => 'sidekiq'
      end
    
      # Federation
    
      mount DiasporaFederation::Engine => "/"
    
    
      get "/atom.xml" => redirect('http://blog.diasporafoundation.org/feed/atom') #too many stupid redirects :()
    
    Maxwell Salzberg's avatar
    Maxwell Salzberg a validé
      get 'oembed' => 'posts#oembed', :as => 'oembed'
    
      # Posting and Reading
    
    Denys Kurets's avatar
    Denys Kurets a validé
      resources :reshares, only: %i(create)
    
    Maxwell Salzberg's avatar
    Maxwell Salzberg a validé
    
    
    MrZYX's avatar
    MrZYX a validé
      resources :status_messages, :only => [:new, :create]
    
    Denys Kurets's avatar
    Denys Kurets a validé
      resources :posts, only: %i(show destroy) do
    
          get :interactions
    
        resource :participation, only: %i(create destroy)
        resources :poll_participations, only: :create
        resources :likes, only: %i(create destroy index)
        resources :comments, only: %i(new create destroy index)
    
        resources :reshares, only: :index
    
    Dennis Collinson's avatar
    Dennis Collinson a validé
    
    
      get 'p/:id' => 'posts#show', :as => 'short_post'
    
      # roll up likes into a nested resource above
      resources :comments, :only => [:create, :destroy] do
        resources :likes, :only => [:create, :destroy, :index]
      end
    
    
      get "activity" => "streams#activity", :as => "activity_stream"
      get "stream" => "streams#multi", :as => "stream"
    
      get "public" => "streams#public", :as => "public_stream"
      get "followed_tags" => "streams#followed_tags", :as => "followed_tags_stream"
      get "mentions" => "streams#mentioned", :as => "mentioned_stream"
      get "liked" => "streams#liked", :as => "liked_stream"
      get "commented" => "streams#commented", :as => "commented_stream"
      get "aspects" => "streams#aspects", :as => "aspects_stream"
    
    Denys Kurets's avatar
    Denys Kurets a validé
      resources :aspects, except: %i(index new edit) do
    
        put :toggle_contact_visibility
    
        put :toggle_chat_privilege
    
        collection do
          put "order" => :update_order
        end
    
      get 'bookmarklet' => 'status_messages#bookmarklet'
    
    Denys Kurets's avatar
    Denys Kurets a validé
      resources :photos, only: %i(destroy create) do
    
    MrZYX's avatar
    MrZYX a validé
        put :make_profile_photo
    
    	#Search
    	get 'search' => "search#search"
    
    Denys Kurets's avatar
    Denys Kurets a validé
      resources :conversations, except: %i(edit update destroy)  do
        resources :messages, only: %i(create)
    
        delete 'visibility' => 'conversation_visibilities#destroy'
    
      resources :notifications, :only => [:index, :update] do
    
        collection do
          get :read_all
        end
    
    MrZYX's avatar
    MrZYX a validé
      resources :tags, :only => [:index]
    
      resources "tag_followings", only: %i(create destroy index) do
        collection do
          get :manage
        end
      end
    
    MrZYX's avatar
    MrZYX a validé
      get 'tags/:name' => 'tags#show', :as => 'tag'
    
      # Users and people
    
      resource :user, only: %i(edit destroy), shallow: true do
        put :edit, action: :update
    
        post :export_profile
    
        get :download_profile
    
        post :export_photos
    
        get :download_photos
    
        post :auth_token
    
      end
    
      controller :users do
    
        get "public/:username"          => :public,                  :as => :users_public
        get "getting_started"           => :getting_started,         :as => :getting_started
        get "confirm_email/:token"      => :confirm_email,           :as => :confirm_email
        get "privacy"                   => :privacy_settings,        :as => :privacy_settings
        put "privacy"                   => :update_privacy_settings, :as => :update_privacy_settings
        get "getting_started_completed" => :getting_started_completed
    
      devise_for :users, controllers: {sessions: :sessions}, skip: :registration
      devise_scope :user do
        get "/users/sign_up" => "registrations#new",    :as => :new_user_registration
        post "/users"        => "registrations#create", :as => :user_registration
      end
    
      get "users/invitations"  => "invitations#new",    :as => "new_user_invitation"
      post "users/invitations" => "invitations#create", :as => "user_invitation"
    
      get 'login' => redirect('/users/sign_in')
    
      scope "admins", controller: :admins do
    
    Jonne Haß's avatar
    Jonne Haß a validé
        match :user_search, via: [:get, :post]
    
        get :admin_inviter
        get :weekly_user_stats
        get :stats, as: "pod_stats"
        get :dashboard, as: "admin_dashboard"
        get "add_invites/:invite_code_id" => "admins#add_invites", :as => "add_invites"
    
        resources :pods, only: :index do
          post :recheck
        end
    
    
        post 'users/:id/close_account' => 'users#close_account', :as => 'close_account'
    
    Akash Agrawall's avatar
    Akash Agrawall a validé
        post 'users/:id/lock_account' => 'users#lock_account', :as => 'lock_account'
        post 'users/:id/unlock_account' => 'users#unlock_account', :as => 'unlock_account'
    
      resource :profile, :only => [:edit, :update]
    
      resources :profiles, :only => [:show]
    
    
    Denys Kurets's avatar
    Denys Kurets a validé
      resources :contacts, only: %i(index)
    
      resources :aspect_memberships, :only  => [:destroy, :create]
    
      resources :share_visibilities,  :only => [:update]
      resources :blocks, :only => [:create, :destroy]
    
      get 'i/:id' => 'invitation_codes#show', :as => 'invite_code'
    
      get 'people/refresh_search' => "people#refresh_search"
    
    Denys Kurets's avatar
    Denys Kurets a validé
      resources :people, only: %i(show index) do
        resources :status_messages, only: %i(new create)
        resources :photos, except:  %i(new update)
    
    Florian Staudacher's avatar
    Florian Staudacher a validé
        get :hovercard
    
    MrZYX's avatar
    MrZYX a validé
        collection do
          post 'by_handle' => :retrieve_remote, :as => 'person_by_handle'
        end
    
      get '/u/:username' => 'people#show', :as => 'user_profile', :constraints => { :username => /[^\/]+/ }
    
      # External
    
      resources :services, :only => [:index, :destroy]
      controller :services do
    
    MrZYX's avatar
    MrZYX a validé
        scope "/auth", :as => "auth" do
    
    Jonne Haß's avatar
    Jonne Haß a validé
          get ':provider/callback' => :create
          get :failure
    
    MrZYX's avatar
    MrZYX a validé
        end
    
      get 'community_spotlight' => "contacts#spotlight", :as => 'community_spotlight'
    
      # Mobile site
    
    
      get 'mobile/toggle', :to => 'home#toggle_mobile', :as => 'toggle_mobile'
    
    augier's avatar
    augier a validé
      get "/m", to: "home#force_mobile", as: "force_mobile"
    
    Jonne Haß's avatar
    Jonne Haß a validé
      # Help
    
      get 'help' => 'help#faq', :as => 'help'
    
      get 'help/:topic' => 'help#faq'
    
    Jonne Haß's avatar
    Jonne Haß a validé
      get 'protocol' => redirect("http://wiki.diasporafoundation.org/Federation_Protocol_Overview")
    
    Jonne Haß's avatar
    Jonne Haß a validé
      # NodeInfo
      get ".well-known/nodeinfo", to: "node_info#jrd"
      get "nodeinfo/:version",    to: "node_info#document", as: "node_info", constraints: {version: /\d+\.\d+/}
    
      get "statistics",           to: "node_info#statistics"
    
      if AppConfig.settings.terms.enable? || Rails.env.test?
    
        get 'terms' => 'terms#index'
      end
    
      # Relay
      get ".well-known/x-social-relay" => "social_relay#well_known"
    
    
      get "podmin", to: "home#podmin"
    
    theworldbright's avatar
    theworldbright a validé
      namespace :api do
        namespace :openid_connect do
          resources :clients, only: :create
    
          get "clients/find", to: "clients#find"
    
    
          post "access_tokens", to: "token_endpoint#create"
    
    theworldbright's avatar
    theworldbright a validé
    
          # Authorization Servers MUST support the use of the HTTP GET and POST methods at the Authorization Endpoint
          # See http://openid.net/specs/openid-connect-core-1_0.html#AuthResponseValidation
    
          resources :authorizations, only: %i(new create destroy)
    
    theworldbright's avatar
    theworldbright a validé
          post "authorizations/new", to: "authorizations#new"
    
    augier's avatar
    augier a validé
          get "user_applications", to: "user_applications#index"
    
    theworldbright's avatar
    theworldbright a validé
          get "jwks.json", to: "id_tokens#jwks"
    
          match "user_info", to: "user_info#show", via: %i(get post)
    
    theworldbright's avatar
    theworldbright a validé
        end
      end
    
      get ".well-known/webfinger", to: "api/openid_connect/discovery#webfinger"
      get ".well-known/openid-configuration", to: "api/openid_connect/discovery#configuration"
    
    Raphael Sofaer's avatar
    Raphael Sofaer a validé
    end