BigW Consortium Gitlab

routes.rb 21.1 KB
Newer Older
Dmitriy Zaporozhets committed
1
require 'sidekiq/web'
2
require 'sidekiq/cron/web'
3
require 'api/api'
Dmitriy Zaporozhets committed
4

Valery Sizov committed
5
Rails.application.routes.draw do
6 7 8 9 10 11 12 13 14 15 16 17 18
  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

19 20 21 22 23 24 25 26 27 28 29 30
  # 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
  if Rails.env.development?
    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'
  end

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
  namespace :ci do
    # CI API
    Ci::API::API.logger Rails.logger
    mount Ci::API::API => '/api'

    resource :lint, only: [:show, :create]

    resources :projects do
      member do
        get :status, to: 'projects#badge'
        get :integration
      end
    end

    root to: 'projects#index'
  end

Valery Sizov committed
48
  use_doorkeeper do
49 50 51
    controllers applications: 'oauth/applications',
                authorized_applications: 'oauth/authorized_applications',
                authorizations: 'oauth/authorizations'
Valery Sizov committed
52
  end
53

54 55 56 57
  # Autocomplete
  get '/autocomplete/users' => 'autocomplete#users'
  get '/autocomplete/users/:id' => 'autocomplete#user'

58 59
  # Emojis
  resources :emojis, only: :index
60

61
  # Search
62 63
  get 'search' => 'search#show'
  get 'search/autocomplete' => 'search#autocomplete', as: :search_autocomplete
Valery Sizov committed
64

65
  # API
66 67
  API::API.logger Rails.logger
  mount API::API => '/api'
68

69
  constraint = lambda { |request| request.env['warden'].authenticate? and request.env['warden'].user.admin? }
Dmitriy Zaporozhets committed
70
  constraints constraint do
71
    mount Sidekiq::Web, at: '/admin/sidekiq', as: :sidekiq
Dmitriy Zaporozhets committed
72
  end
73

74
  # Enable Grack support
75
  mount Grack::AuthSpawner, at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) }, via: [:get, :post, :put]
76

77
  # Help
78
  get 'help'                  => 'help#index'
79
  get 'help/:category/:file'  => 'help#show', as: :help_page, constraints: { category: /.*/, file: /[^\/\.]+/ }
80
  get 'help/shortcuts'
81
  get 'help/ui'               => 'help#ui'
82

Andrew8xx8 committed
83 84 85 86 87
  #
  # Global snippets
  #
  resources :snippets do
    member do
88
      get 'raw'
Andrew8xx8 committed
89 90
    end
  end
91 92

  get '/s/:username' => 'snippets#index', as: :user_snippets, constraints: { username: /.*/ }
Andrew8xx8 committed
93

Douwe Maan committed
94 95 96 97 98 99 100
  #
  # Invites
  #

  resources :invites, only: [:show], constraints: { id: /[A-Za-z0-9_-]+/ } do
    member do
      post :accept
Douwe Maan committed
101
      match :decline, via: [:get, :post]
Douwe Maan committed
102 103
    end
  end
104

105
  resources :sent_notifications, only: [], constraints: { id: /\h{32}/ } do
106 107 108 109 110
    member do
      get :unsubscribe
    end
  end

111 112 113
  # Spam reports
  resources :abuse_reports, only: [:new, :create]

Valery Sizov committed
114
  #
115
  # Import
Valery Sizov committed
116
  #
117 118
  namespace :import do
    resource :github, only: [:create, :new], controller: :github do
119 120 121 122 123
      get :status
      get :callback
      get :jobs
    end

124
    resource :gitlab, only: [:create, :new], controller: :gitlab do
125 126 127 128
      get :status
      get :callback
      get :jobs
    end
129

Douwe Maan committed
130 131 132 133 134
    resource :bitbucket, only: [:create, :new], controller: :bitbucket do
      get :status
      get :callback
      get :jobs
    end
135

136 137 138 139 140
    resource :gitorious, only: [:create, :new], controller: :gitorious do
      get :status
      get :callback
      get :jobs
    end
141 142 143 144 145

    resource :google_code, only: [:create, :new], controller: :google_code do
      get :status
      post :callback
      get :jobs
146 147 148

      get   :new_user_map,    path: :user_map
      post  :create_user_map, path: :user_map
149
    end
Jared Szechy committed
150 151 152 153 154 155 156 157 158

    resource :fogbugz, only: [:create, :new], controller: :fogbugz do
      get :status
      post :callback
      get :jobs

      get   :new_user_map,    path: :user_map
      post  :create_user_map, path: :user_map
    end
Valery Sizov committed
159
  end
160

161 162 163
  #
  # Uploads
  #
164

165 166
  scope path: :uploads do
    # Note attachments and User/Group/Project avatars
167 168
    get ":model/:mounted_as/:id/:filename",
        to:           "uploads#show",
169
        constraints:  { model: /note|user|group|project/, mounted_as: /avatar|attachment/, filename: /[^\/]+/ }
170

171 172 173 174 175
    # Appearance
    get ":model/:mounted_as/:id/:filename",
        to:           "uploads#show",
        constraints:  { model: /appearance/, mounted_as: /logo|header_logo/, filename: /.+/ }

176
    # Project markdown uploads
177
    get ":namespace_id/:project_id/:secret/:filename",
178
      to:           "projects/uploads#show",
179
      constraints:  { namespace_id: /[a-zA-Z.0-9_\-]+/, project_id: /[a-zA-Z.0-9_\-]+/, filename: /[^\/]+/ }
180
  end
Valery Sizov committed
181

182
  # Redirect old note attachments path to new uploads path.
183 184
  get "files/note/:id/:filename",
    to:           redirect("uploads/note/attachment/%{id}/%{filename}"),
185
    constraints:  { filename: /[^\/]+/ }
186

187
  #
Yatish Mehta committed
188
  # Explore area
189
  #
190 191 192 193
  namespace :explore do
    resources :projects, only: [:index] do
      collection do
        get :trending
194
        get :starred
195 196 197
      end
    end

198
    resources :groups, only: [:index]
199
    resources :snippets, only: [:index]
200
    root to: 'projects#trending'
201 202
  end

203
  # Compatibility with old routing
204 205
  get 'public' => 'explore/projects#index'
  get 'public/projects' => 'explore/projects#index'
206

207 208 209
  #
  # Admin Area
  #
Nihad Abbasov committed
210
  namespace :admin do
211
    resources :users, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do
212
      resources :keys, only: [:show, :destroy]
213
      resources :identities, except: [:show]
214

215
      delete 'stop_impersonation' => 'impersonation#destroy', on: :collection
216

217
      member do
218 219 220
        get :projects
        get :keys
        get :groups
221
        put :team_update
222 223
        put :block
        put :unblock
224
        put :unlock
225
        put :confirm
226
        post 'impersonate' => 'impersonation#create'
227
        patch :disable_two_factor
228
        delete 'remove/:email_id', action: 'remove_email', as: 'remove_email'
229 230
      end
    end
Andrey Kumanyaev committed
231

232
    resources :abuse_reports, only: [:index, :destroy]
233 234
    resources :spam_logs, only: [:index, :destroy]

235 236
    resources :applications

237 238
    resources :groups, constraints: { id: /[^\/]+/ } do
      member do
239
        put :members_update
240
      end
241
    end
Andrey Kumanyaev committed
242

243
    resources :deploy_keys, only: [:index, :new, :create, :destroy]
244

245
    resources :hooks, only: [:index, :create, :destroy] do
246 247
      get :test
    end
Andrey Kumanyaev committed
248

249 250 251 252
    resources :broadcast_messages, only: [:index, :edit, :create, :update, :destroy] do
      post :preview, on: :collection
    end

253
    resource :logs, only: [:show]
254
    resource :background_jobs, controller: 'background_jobs', only: [:show]
255

Vinnie Okada committed
256 257 258
    resources :namespaces, path: '/projects', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only: [] do
      root to: 'projects#index', as: :projects

259 260
      resources(:projects,
                path: '/',
Vinnie Okada committed
261 262 263 264 265 266
                constraints: { id: /[a-zA-Z.0-9_\-]+/ },
                only: [:index, :show]) do
        root to: 'projects#show'

        member do
          put :transfer
267
          post :repository_check
Vinnie Okada committed
268
        end
269 270

        resources :runner_projects
271 272 273
      end
    end

274 275 276 277 278 279 280
    resource :appearances, path: 'appearance' do
      member do
        get :preview
        delete :logo
        delete :header_logos
      end
    end
281

282 283
    resource :application_settings, only: [:show, :update] do
      resources :services
284
      put :reset_runners_token
285
      put :clear_repository_check_states
286
    end
287

Valery Sizov committed
288 289
    resources :labels

290 291 292 293 294 295 296 297 298 299 300 301 302
    resources :runners, only: [:index, :show, :update, :destroy] do
      member do
        get :resume
        get :pause
      end
    end

    resources :builds, only: :index do
      collection do
        post :cancel_all
      end
    end

303
    root to: 'dashboard#index'
gitlabhq committed
304 305
  end

randx committed
306 307 308
  #
  # Profile Area
  #
309 310
  resource :profile, only: [:show, :update] do
    member do
311
      get :audit_log
312
      get :applications, to: 'oauth/applications#index'
313 314 315 316

      put :reset_private_token
      put :update_username
    end
317

318
    scope module: :profiles do
319 320 321 322 323
      resource :account, only: [:show, :update] do
        member do
          delete :unlink
        end
      end
324
      resource :notifications, only: [:show, :update]
325 326 327 328 329
      resource :password, only: [:new, :create, :edit, :update] do
        member do
          put :reset
        end
      end
330
      resource :preferences, only: [:show, :update]
331
      resources :keys
332
      resources :emails, only: [:index, :create, :destroy]
333
      resource :avatar, only: [:destroy]
334 335
      resource :two_factor_auth, only: [:new, :create, :destroy] do
        member do
336
          post :codes
337
          patch :skip
338 339
        end
      end
340
    end
341
  end
342

343
  get 'u/:username/calendar' => 'users#calendar', as: :user_calendar,
344 345 346 347
      constraints: { username: /.*/ }

  get 'u/:username/calendar_activities' => 'users#calendar_activities', as: :user_calendar_activities,
      constraints: { username: /.*/ }
348

349 350 351
  get 'u/:username/groups' => 'users#groups', as: :user_groups,
      constraints: { username: /.*/ }

352
  get 'u/:username/projects' => 'users#projects', as: :user_projects,
353 354
      constraints: { username: /.*/ }

355
  get 'u/:username/contributed' => 'users#contributed', as: :user_contributed_projects,
356 357
      constraints: { username: /.*/ }

358
  get '/u/:username' => 'users#show', as: :user,
359
      constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }
360

randx committed
361 362 363
  #
  # Dashboard Area
  #
364 365 366 367
  resource :dashboard, controller: 'dashboard', only: [] do
    get :issues
    get :merge_requests
    get :activity
Douwe Maan committed
368 369 370

    scope module: :dashboard do
      resources :milestones, only: [:index, :show]
371
      resources :labels, only: [:index]
372

373
      resources :groups, only: [:index]
374
      resources :snippets, only: [:index]
375 376 377 378 379 380

      resources :todos, only: [:index, :destroy] do
        collection do
          delete :destroy_all
        end
      end
381

382
      resources :projects, only: [:index] do
383 384 385 386
        collection do
          get :starred
        end
      end
Douwe Maan committed
387
    end
388 389

    root to: "dashboard/projects#index"
390
  end
gitlabhq committed
391

392 393 394
  #
  # Groups Area
  #
395
  resources :groups, constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }  do
396 397 398
    member do
      get :issues
      get :merge_requests
399
      get :projects
400
      get :activity
401
    end
402

Steven Thonus committed
403
    scope module: :groups do
404
      resources :group_members, only: [:index, :create, :update, :destroy] do
405
        post :resend_invite, on: :member
406
        delete :leave, on: :collection
407
      end
408

Steven Thonus committed
409
      resource :avatar, only: [:destroy]
410
      resources :milestones, constraints: { id: /[^\/]+/ }, only: [:index, :show, :update, :new, :create]
411
      resource :notification_setting, only: [:update]
Steven Thonus committed
412
    end
413 414
  end

415
  resources :projects, constraints: { id: /[^\/]+/ }, only: [:index, :new, :create]
416

417
  devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, registrations: :registrations , passwords: :passwords, sessions: :sessions, confirmations: :confirmations }
gitlabhq committed
418

419
  devise_scope :user do
420
    get '/users/auth/:provider/omniauth_error' => 'omniauth_callbacks#omniauth_error', as: :omniauth_error
Phil Hughes committed
421
    get '/users/almost_there' => 'confirmations#almost_there'
422
  end
Vinnie Okada committed
423

424
  root to: "root#index"
Vinnie Okada committed
425

426 427 428
  #
  # Project Area
  #
Vinnie Okada committed
429
  resources :namespaces, path: '/', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only: [] do
430
    resources(:projects, constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }, except:
Vinnie Okada committed
431 432 433
              [:new, :create, :index], path: "/") do
      member do
        put :transfer
434
        delete :remove_fork
Vinnie Okada committed
435 436
        post :archive
        post :unarchive
437
        post :housekeeping
Vinnie Okada committed
438 439 440
        post :toggle_star
        post :markdown_preview
        get :autocomplete_sources
441
        get :activity
skv committed
442
      end
443

Vinnie Okada committed
444 445 446 447 448 449 450 451 452
      scope module: :projects do
        # Blob routes:
        get '/new/*id', to: 'blob#new', constraints: { id: /.+/ }, as: 'new_blob'
        post '/create/*id', to: 'blob#create', constraints: { id: /.+/ }, as: 'create_blob'
        get '/edit/*id', to: 'blob#edit', constraints: { id: /.+/ }, as: 'edit_blob'
        put '/update/*id', to: 'blob#update', constraints: { id: /.+/ }, as: 'update_blob'
        post '/preview/*id', to: 'blob#preview', constraints: { id: /.+/ }, as: 'preview_blob'

        scope do
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469
          get(
            '/blob/*id/diff',
            to: 'blob#diff',
            constraints: { id: /.+/, format: false },
            as: :blob_diff
          )
          get(
            '/blob/*id',
            to: 'blob#show',
            constraints: { id: /.+/, format: false },
            as: :blob
          )
          delete(
            '/blob/*id',
            to: 'blob#destroy',
            constraints: { id: /.+/, format: false }
          )
470 471 472 473 474 475 476 477 478 479
          put(
            '/blob/*id',
            to: 'blob#update',
            constraints: { id: /.+/, format: false }
          )
          post(
            '/blob/*id',
            to: 'blob#create',
            constraints: { id: /.+/, format: false }
          )
Vinnie Okada committed
480
        end
481

Vinnie Okada committed
482 483 484 485 486 487 488
        scope do
          get(
            '/raw/*id',
            to: 'raw#show',
            constraints: { id: /.+/, format: /(html|js)/ },
            as: :raw
          )
489
        end
490

Vinnie Okada committed
491 492 493 494 495 496 497 498 499
        scope do
          get(
            '/tree/*id',
            to: 'tree#show',
            constraints: { id: /.+/, format: /(html|js)/ },
            as: :tree
          )
        end

500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517
        scope do
          get(
            '/find_file/*id',
            to: 'find_file#show',
            constraints: { id: /.+/, format: /html/ },
            as: :find_file
          )
        end

        scope do
          get(
            '/files/*id',
            to: 'find_file#list',
            constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ },
            as: :files
          )
        end

Stan Hu committed
518 519
        scope do
          post(
520
            '/create_dir/*id',
Stan Hu committed
521 522 523 524 525 526
              to: 'tree#create_dir',
              constraints: { id: /.+/ },
              as: 'create_dir'
          )
        end

Vinnie Okada committed
527 528 529 530 531 532 533
        scope do
          get(
            '/blame/*id',
            to: 'blame#show',
            constraints: { id: /.+/, format: /(html|js)/ },
            as: :blame
          )
534
        end
Dmitriy Zaporozhets committed
535

536 537 538 539
        scope do
          get(
            '/commits/*id',
            to: 'commits#show',
540
            constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ },
541 542 543 544 545
            as: :commits
          )
        end

        resource  :avatar, only: [:show, :destroy]
546
        resources :commit, only: [:show], constraints: { id: /\h{7,40}/ } do
547 548
          member do
            get :branches
Kamil Trzcinski committed
549 550 551
            get :builds
            post :cancel_builds
            post :retry_builds
552
            post :revert
553
            post :cherry_pick
554
          end
555 556 557 558 559 560
        end

        resources :compare, only: [:index, :create]
        resources :network, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ }

        resources :graphs, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ } do
Vinnie Okada committed
561 562
          member do
            get :commits
563
            get :ci
564
            get :languages
Vinnie Okada committed
565
          end
566
        end
567

Vinnie Okada committed
568 569
        get '/compare/:from...:to' => 'compare#show', :as => 'compare',
            :constraints => { from: /.+/, to: /.+/ }
570

Vinnie Okada committed
571 572 573 574
        resources :snippets, constraints: { id: /\d+/ } do
          member do
            get 'raw'
          end
575
        end
576

577
        WIKI_SLUG_ID = { id: /\S+/ } unless defined? WIKI_SLUG_ID
578

Stan Hu committed
579 580 581 582
        scope do
          # Order matters to give priority to these matches
          get '/wikis/git_access', to: 'wikis#git_access'
          get '/wikis/pages', to: 'wikis#pages', as: 'wiki_pages'
583
          post '/wikis/markdown_preview', to:'wikis#markdown_preview'
Stan Hu committed
584 585 586 587 588 589 590 591
          post '/wikis', to: 'wikis#create'

          get '/wikis/*id/history', to: 'wikis#history', as: 'wiki_history', constraints: WIKI_SLUG_ID
          get '/wikis/*id/edit', to: 'wikis#edit', as: 'wiki_edit', constraints: WIKI_SLUG_ID

          get '/wikis/*id', to: 'wikis#show', as: 'wiki', constraints: WIKI_SLUG_ID
          delete '/wikis/*id', to: 'wikis#destroy', constraints: WIKI_SLUG_ID
          put '/wikis/*id', to: 'wikis#update', constraints: WIKI_SLUG_ID
592
        end
593

Vinnie Okada committed
594 595 596 597 598
        resource :repository, only: [:show, :create] do
          member do
            get 'archive', constraints: { format: Gitlab::Regex.archive_formats_regex }
          end
        end
miks committed
599

Vinnie Okada committed
600 601 602 603
        resources :services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do
          member do
            get :test
          end
604
        end
gitlabhq committed
605

606
        resources :deploy_keys, constraints: { id: /\d+/ }, only: [:index, :new, :create] do
Vinnie Okada committed
607 608 609 610
          member do
            put :enable
            put :disable
          end
611
        end
gitlabhq committed
612

613
        resources :forks, only: [:index, :new, :create]
Vinnie Okada committed
614
        resource :import, only: [:new, :create, :show]
615
        resource :notification_setting, only: [:update]
Vinnie Okada committed
616 617 618 619 620 621 622 623 624

        resources :refs, only: [] do
          collection do
            get 'switch'
          end

          member do
            # tree viewer logs
            get 'logs_tree', constraints: { id: Gitlab::Regex.git_reference_regex }
625 626
            # Directories with leading dots erroneously get rejected if git
            # ref regex used in constraints. Regex verification now done in controller.
627
            get 'logs_tree/*path' => 'refs#logs_tree', as: :logs_file, constraints: {
628
              id: /.*/,
Vinnie Okada committed
629 630 631
              path: /.*/
            }
          end
632
        end
633

634
        resources :merge_requests, constraints: { id: /\d+/ } do
Vinnie Okada committed
635
          member do
636
            get :commits
Vinnie Okada committed
637
            get :diffs
638
            get :builds
639 640
            get :merge_check
            post :merge
641
            post :cancel_merge_when_build_succeeds
Vinnie Okada committed
642
            get :ci_status
Valery Sizov committed
643
            post :toggle_subscription
644
            post :remove_wip
Vinnie Okada committed
645 646 647 648 649 650 651
          end

          collection do
            get :branch_from
            get :branch_to
            get :update_branches
          end
652
        end
653

Vinnie Okada committed
654
        resources :branches, only: [:index, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex }
655 656
        resources :tags, only: [:index, :show, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex } do
          resource :release, only: [:edit, :update]
657 658
        end

Vinnie Okada committed
659
        resources :protected_branches, only: [:index, :create, :update, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex }
660
        resource :variables, only: [:show, :update]
661
        resources :triggers, only: [:index, :create, :destroy]
662

663
        resources :builds, only: [:index, :show], constraints: { id: /\d+/ } do
Kamil Trzcinski committed
664
          collection do
Kamil Trzcinski committed
665
            post :cancel_all
Kamil Trzcinski committed
666 667
          end

668 669
          member do
            get :status
670
            post :cancel
671
            post :retry
672
            post :erase
673
            get :raw
674
          end
675

676 677
          resource :artifacts, only: [] do
            get :download
678 679
            get :browse, path: 'browse(/*path)', format: false
            get :file, path: 'file/*path', format: false
680
          end
681
        end
682

Vinnie Okada committed
683 684 685 686
        resources :hooks, only: [:index, :create, :destroy], constraints: { id: /\d+/ } do
          member do
            get :test
          end
687
        end
688

689
        resources :milestones, constraints: { id: /\d+/ } do
Vinnie Okada committed
690 691 692 693
          member do
            put :sort_issues
            put :sort_merge_requests
          end
694
        end
695

Vinnie Okada committed
696 697 698 699
        resources :labels, constraints: { id: /\d+/ } do
          collection do
            post :generate
          end
700 701 702 703

          member do
            post :toggle_subscription
          end
704
        end
705

706
        resources :issues, constraints: { id: /\d+/ } do
Valery Sizov committed
707
          member do
Valery Sizov committed
708
            post :toggle_subscription
709 710
            get :referenced_merge_requests
            get :related_branches
Valery Sizov committed
711
          end
Vinnie Okada committed
712 713 714
          collection do
            post  :bulk_update
          end
715
        end
Robert Speicher committed
716

717
        resources :project_members, except: [:new, :edit], constraints: { id: /[a-zA-Z.\/0-9_\-#%+]+/ } do
Vinnie Okada committed
718 719
          collection do
            delete :leave
720

Vinnie Okada committed
721 722 723 724 725
            # Used for import team
            # from another project
            get :import
            post :apply_import
          end
726 727 728 729

          member do
            post :resend_invite
          end
730
        end
731

732 733
        resources :group_links, only: [:index, :create, :destroy], constraints: { id: /\d+/ }

Vinnie Okada committed
734 735 736 737
        resources :notes, only: [:index, :create, :destroy, :update], constraints: { id: /\d+/ } do
          member do
            delete :delete_attachment
          end
Valery Sizov committed
738 739 740 741

          collection do
            post :award_toggle
          end
742
        end
743 744 745

        resources :uploads, only: [:create] do
          collection do
746
            get ":secret/:filename", action: :show, as: :show, constraints: { filename: /[^\/]+/ }
747
          end
748
        end
749

750 751 752 753 754
        resources :runners, only: [:index, :edit, :update, :destroy, :show] do
          member do
            get :resume
            get :pause
          end
755 756 757 758

          collection do
            post :toggle_shared_runners
          end
759
        end
760 761

        resources :runner_projects, only: [:create, :destroy]
762
        resources :badges, only: [:index] do
763
          collection do
764 765 766
            scope '*ref', constraints: { ref: Gitlab::Regex.git_reference_regex } do
              get :build, constraints: { format: /svg/ }
            end
767 768
          end
        end
769
      end
770
    end
gitlabhq committed
771
  end
772

773 774 775
  # Get all keys of user
  get ':username.keys' => 'profiles/keys#get_keys' , constraints: { username: /.*/ }

776
  get ':id' => 'namespaces#show', constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ }
gitlabhq committed
777
end