2013-01-09 05:14:05 +00:00
|
|
|
require 'sidekiq/web'
|
2015-12-03 23:24:39 +00:00
|
|
|
require 'sidekiq/cron/web'
|
2013-05-14 12:33:31 +00:00
|
|
|
require 'api/api'
|
2013-01-09 05:14:05 +00:00
|
|
|
|
2016-10-05 12:21:27 +00:00
|
|
|
class ActionDispatch::Routing::Mapper
|
|
|
|
def draw(routes_name)
|
|
|
|
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-11-25 16:18:44 +00:00
|
|
|
Rails.application.routes.draw do
|
2015-11-04 18:13:19 +00:00
|
|
|
if Gitlab::Sherlock.enabled?
|
|
|
|
namespace :sherlock do
|
|
|
|
resources :transactions, only: [:index, :show] do
|
|
|
|
resources :queries, only: [:show]
|
|
|
|
resources :file_samples, only: [:show]
|
|
|
|
|
|
|
|
collection do
|
|
|
|
delete :destroy_all
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-03-23 00:26:57 +00:00
|
|
|
if Rails.env.development?
|
2016-04-22 20:13:59 +00:00
|
|
|
# Make the built-in Rails routes available in development, otherwise they'd
|
|
|
|
# get swallowed by the `namespace/project` route matcher below.
|
|
|
|
#
|
|
|
|
# See https://git.io/va79N
|
2016-03-23 00:26:57 +00:00
|
|
|
get '/rails/mailers' => 'rails/mailers#index'
|
|
|
|
get '/rails/mailers/:path' => 'rails/mailers#preview'
|
|
|
|
get '/rails/info/properties' => 'rails/info#properties'
|
|
|
|
get '/rails/info/routes' => 'rails/info#routes'
|
|
|
|
get '/rails/info' => 'rails/info#index'
|
2016-04-22 20:13:59 +00:00
|
|
|
|
|
|
|
mount LetterOpenerWeb::Engine, at: '/rails/letter_opener'
|
2016-03-23 00:26:57 +00:00
|
|
|
end
|
|
|
|
|
2016-06-01 16:07:23 +00:00
|
|
|
concern :access_requestable do
|
|
|
|
post :request_access, on: :collection
|
2016-06-01 16:17:03 +00:00
|
|
|
post :approve_access_request, on: :member
|
2016-06-01 16:07:23 +00:00
|
|
|
end
|
|
|
|
|
2016-09-19 07:26:37 +00:00
|
|
|
concern :awardable do
|
|
|
|
post :toggle_award_emoji, on: :member
|
|
|
|
end
|
|
|
|
|
2015-08-26 01:42:46 +00:00
|
|
|
namespace :ci do
|
|
|
|
# CI API
|
|
|
|
Ci::API::API.logger Rails.logger
|
|
|
|
mount Ci::API::API => '/api'
|
|
|
|
|
|
|
|
resource :lint, only: [:show, :create]
|
|
|
|
|
2016-05-03 22:32:14 +00:00
|
|
|
resources :projects, only: [:index, :show] do
|
2015-08-26 01:42:46 +00:00
|
|
|
member do
|
|
|
|
get :status, to: 'projects#badge'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
root to: 'projects#index'
|
|
|
|
end
|
|
|
|
|
2014-12-19 14:15:29 +00:00
|
|
|
use_doorkeeper do
|
2015-02-03 03:30:09 +00:00
|
|
|
controllers applications: 'oauth/applications',
|
|
|
|
authorized_applications: 'oauth/authorized_applications',
|
|
|
|
authorizations: 'oauth/authorizations'
|
2014-12-19 14:15:29 +00:00
|
|
|
end
|
2015-03-08 21:46:22 +00:00
|
|
|
|
2015-03-27 02:06:19 +00:00
|
|
|
# Autocomplete
|
|
|
|
get '/autocomplete/users' => 'autocomplete#users'
|
|
|
|
get '/autocomplete/users/:id' => 'autocomplete#user'
|
2016-05-16 14:24:51 +00:00
|
|
|
get '/autocomplete/projects' => 'autocomplete#projects'
|
2015-03-27 02:06:19 +00:00
|
|
|
|
2016-02-23 02:16:00 +00:00
|
|
|
# Emojis
|
|
|
|
resources :emojis, only: :index
|
2015-03-27 02:06:19 +00:00
|
|
|
|
2012-06-13 06:03:53 +00:00
|
|
|
# Search
|
2015-01-19 20:37:20 +00:00
|
|
|
get 'search' => 'search#show'
|
|
|
|
get 'search/autocomplete' => 'search#autocomplete', as: :search_autocomplete
|
2012-02-19 14:35:31 +00:00
|
|
|
|
2016-05-02 11:29:17 +00:00
|
|
|
# JSON Web Token
|
|
|
|
get 'jwt/auth' => 'jwt#auth'
|
|
|
|
|
2012-06-27 09:26:16 +00:00
|
|
|
# API
|
2013-05-14 12:33:31 +00:00
|
|
|
API::API.logger Rails.logger
|
|
|
|
mount API::API => '/api'
|
2012-06-27 09:26:16 +00:00
|
|
|
|
2015-01-19 20:37:20 +00:00
|
|
|
constraint = lambda { |request| request.env['warden'].authenticate? and request.env['warden'].user.admin? }
|
2013-01-09 05:14:05 +00:00
|
|
|
constraints constraint do
|
2015-01-19 20:37:20 +00:00
|
|
|
mount Sidekiq::Web, at: '/admin/sidekiq', as: :sidekiq
|
2013-01-09 05:14:05 +00:00
|
|
|
end
|
2011-12-07 23:31:06 +00:00
|
|
|
|
2016-04-22 16:50:08 +00:00
|
|
|
# Health check
|
2016-05-13 07:51:13 +00:00
|
|
|
get 'health_check(/:checks)' => 'health_check#index', as: :health_check
|
2016-04-22 16:50:08 +00:00
|
|
|
|
2012-06-13 06:03:53 +00:00
|
|
|
# Help
|
2016-07-19 17:17:14 +00:00
|
|
|
get 'help' => 'help#index'
|
|
|
|
get 'help/shortcuts' => 'help#shortcuts'
|
|
|
|
get 'help/ui' => 'help#ui'
|
|
|
|
get 'help/*path' => 'help#show', as: :help_page
|
2011-11-05 19:00:05 +00:00
|
|
|
|
2016-07-26 03:59:39 +00:00
|
|
|
# Koding route
|
|
|
|
get 'koding' => 'koding#index'
|
|
|
|
|
2013-03-24 22:17:20 +00:00
|
|
|
# Global snippets
|
2016-09-19 07:26:37 +00:00
|
|
|
resources :snippets, concerns: :awardable do
|
2013-03-24 22:17:20 +00:00
|
|
|
member do
|
2015-01-19 20:37:20 +00:00
|
|
|
get 'raw'
|
2013-03-24 22:17:20 +00:00
|
|
|
end
|
|
|
|
end
|
2015-04-03 01:22:54 +00:00
|
|
|
|
2016-05-08 08:29:51 +00:00
|
|
|
get '/s/:username', to: redirect('/u/%{username}/snippets'),
|
2016-05-08 08:27:33 +00:00
|
|
|
constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }
|
2013-03-24 22:17:20 +00:00
|
|
|
|
2015-04-10 13:22:31 +00:00
|
|
|
# Invites
|
|
|
|
resources :invites, only: [:show], constraints: { id: /[A-Za-z0-9_-]+/ } do
|
|
|
|
member do
|
|
|
|
post :accept
|
2015-04-10 14:37:02 +00:00
|
|
|
match :decline, via: [:get, :post]
|
2015-04-10 13:22:31 +00:00
|
|
|
end
|
|
|
|
end
|
2015-02-12 01:34:41 +00:00
|
|
|
|
2016-01-09 18:32:03 +00:00
|
|
|
resources :sent_notifications, only: [], constraints: { id: /\h{32}/ } do
|
2015-12-09 10:59:25 +00:00
|
|
|
member do
|
|
|
|
get :unsubscribe
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-08-06 12:03:27 +00:00
|
|
|
# Spam reports
|
|
|
|
resources :abuse_reports, only: [:new, :create]
|
|
|
|
|
2016-06-14 18:36:36 +00:00
|
|
|
# Notification settings
|
|
|
|
resources :notification_settings, only: [:create, :update]
|
|
|
|
|
2016-10-05 12:21:27 +00:00
|
|
|
draw :import
|
|
|
|
draw :uploads
|
|
|
|
draw :explore
|
|
|
|
draw :admin
|
|
|
|
draw :profile
|
|
|
|
draw :dashboard
|
|
|
|
draw :group
|
|
|
|
draw :user
|
|
|
|
draw :project
|
2011-10-08 21:36:38 +00:00
|
|
|
|
2016-10-05 13:05:26 +00:00
|
|
|
# Get all keys of user
|
|
|
|
get ':username.keys' => 'profiles/keys#get_keys', constraints: { username: /.*/ }
|
|
|
|
|
2016-10-05 13:40:11 +00:00
|
|
|
get ':id' => 'namespaces#show', constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ }
|
|
|
|
|
2015-09-08 13:49:20 +00:00
|
|
|
root to: "root#index"
|
2011-10-08 21:36:38 +00:00
|
|
|
end
|