BigW Consortium Gitlab

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

    mount LetterOpenerWeb::Engine, at: '/rails/letter_opener'
31 32
  end

33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
  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
50
  use_doorkeeper do
51 52 53
    controllers applications: 'oauth/applications',
                authorized_applications: 'oauth/authorized_applications',
                authorizations: 'oauth/authorizations'
Valery Sizov committed
54
  end
55

56 57 58 59
  # Autocomplete
  get '/autocomplete/users' => 'autocomplete#users'
  get '/autocomplete/users/:id' => 'autocomplete#user'

60 61
  # Emojis
  resources :emojis, only: :index
62

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

67
  # API
68 69
  API::API.logger Rails.logger
  mount API::API => '/api'
70

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

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

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

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

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

Douwe Maan committed
96 97 98 99 100 101 102
  #
  # Invites
  #

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

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

113 114 115
  # Spam reports
  resources :abuse_reports, only: [:new, :create]

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

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

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

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

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

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

    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
161 162 163 164 165 166

    resource :gitlab_project, only: [:create, :new], controller: :gitlab_projects do
      get :status
      get :callback
      get :jobs
    end
Valery Sizov committed
167
  end
168

169 170 171
  #
  # Uploads
  #
172

173 174
  scope path: :uploads do
    # Note attachments and User/Group/Project avatars
175 176
    get ":model/:mounted_as/:id/:filename",
        to:           "uploads#show",
177
        constraints:  { model: /note|user|group|project/, mounted_as: /avatar|attachment/, filename: /[^\/]+/ }
178

179 180 181 182 183
    # Appearance
    get ":model/:mounted_as/:id/:filename",
        to:           "uploads#show",
        constraints:  { model: /appearance/, mounted_as: /logo|header_logo/, filename: /.+/ }

184
    # Project markdown uploads
185
    get ":namespace_id/:project_id/:secret/:filename",
186
      to:           "projects/uploads#show",
187
      constraints:  { namespace_id: /[a-zA-Z.0-9_\-]+/, project_id: /[a-zA-Z.0-9_\-]+/, filename: /[^\/]+/ }
188
  end
Valery Sizov committed
189

190
  # Redirect old note attachments path to new uploads path.
191 192
  get "files/note/:id/:filename",
    to:           redirect("uploads/note/attachment/%{id}/%{filename}"),
193
    constraints:  { filename: /[^\/]+/ }
194

195
  #
Yatish Mehta committed
196
  # Explore area
197
  #
198 199 200 201
  namespace :explore do
    resources :projects, only: [:index] do
      collection do
        get :trending
202
        get :starred
203 204 205
      end
    end

206
    resources :groups, only: [:index]
207
    resources :snippets, only: [:index]
208
    root to: 'projects#trending'
209 210
  end

211
  # Compatibility with old routing
212 213
  get 'public' => 'explore/projects#index'
  get 'public/projects' => 'explore/projects#index'
214

215 216 217
  #
  # Admin Area
  #
Nihad Abbasov committed
218
  namespace :admin do
219
    resources :users, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do
220
      resources :keys, only: [:show, :destroy]
221
      resources :identities, except: [:show]
222

223
      member do
224 225 226
        get :projects
        get :keys
        get :groups
227
        put :team_update
228 229
        put :block
        put :unblock
230
        put :unlock
231
        put :confirm
232
        post :impersonate
233
        patch :disable_two_factor
234
        delete 'remove/:email_id', action: 'remove_email', as: 'remove_email'
235 236
      end
    end
Andrey Kumanyaev committed
237

238 239
    resource :impersonation, only: :destroy

240
    resources :abuse_reports, only: [:index, :destroy]
241 242
    resources :spam_logs, only: [:index, :destroy]

243 244
    resources :applications

245 246
    resources :groups, constraints: { id: /[^\/]+/ } do
      member do
247
        put :members_update
248
      end
249
    end
Andrey Kumanyaev committed
250

251
    resources :deploy_keys, only: [:index, :new, :create, :destroy]
252

253
    resources :hooks, only: [:index, :create, :destroy] do
254 255
      get :test
    end
Andrey Kumanyaev committed
256

257 258 259 260
    resources :broadcast_messages, only: [:index, :edit, :create, :update, :destroy] do
      post :preview, on: :collection
    end

261
    resource :logs, only: [:show]
262
    resource :background_jobs, controller: 'background_jobs', only: [:show]
263

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

267 268
      resources(:projects,
                path: '/',
Vinnie Okada committed
269 270 271 272 273 274
                constraints: { id: /[a-zA-Z.0-9_\-]+/ },
                only: [:index, :show]) do
        root to: 'projects#show'

        member do
          put :transfer
275
          post :repository_check
Vinnie Okada committed
276
        end
277 278

        resources :runner_projects
279 280 281
      end
    end

282 283 284 285 286 287 288
    resource :appearances, path: 'appearance' do
      member do
        get :preview
        delete :logo
        delete :header_logos
      end
    end
289

290 291
    resource :application_settings, only: [:show, :update] do
      resources :services
292
      put :reset_runners_token
293
      put :clear_repository_check_states
294
    end
295

Valery Sizov committed
296 297
    resources :labels

298 299 300 301 302 303 304 305 306 307 308 309 310
    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

311
    root to: 'dashboard#index'
gitlabhq committed
312 313
  end

randx committed
314 315 316
  #
  # Profile Area
  #
317 318
  resource :profile, only: [:show, :update] do
    member do
319
      get :audit_log
320
      get :applications, to: 'oauth/applications#index'
321 322 323 324

      put :reset_private_token
      put :update_username
    end
325

326
    scope module: :profiles do
327 328 329 330 331
      resource :account, only: [:show, :update] do
        member do
          delete :unlink
        end
      end
332
      resource :notifications, only: [:show, :update]
333 334 335 336 337
      resource :password, only: [:new, :create, :edit, :update] do
        member do
          put :reset
        end
      end
338
      resource :preferences, only: [:show, :update]
339
      resources :keys
340
      resources :emails, only: [:index, :create, :destroy]
341
      resource :avatar, only: [:destroy]
342 343
      resource :two_factor_auth, only: [:new, :create, :destroy] do
        member do
344
          post :codes
345
          patch :skip
346 347
        end
      end
348
    end
349
  end
350

351
  get 'u/:username/calendar' => 'users#calendar', as: :user_calendar,
352 353 354 355
      constraints: { username: /.*/ }

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

357 358 359
  get 'u/:username/groups' => 'users#groups', as: :user_groups,
      constraints: { username: /.*/ }

360
  get 'u/:username/projects' => 'users#projects', as: :user_projects,
361 362
      constraints: { username: /.*/ }

363
  get 'u/:username/contributed' => 'users#contributed', as: :user_contributed_projects,
364 365
      constraints: { username: /.*/ }

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

randx committed
369 370 371
  #
  # Dashboard Area
  #
372 373 374 375
  resource :dashboard, controller: 'dashboard', only: [] do
    get :issues
    get :merge_requests
    get :activity
Douwe Maan committed
376 377 378

    scope module: :dashboard do
      resources :milestones, only: [:index, :show]
379
      resources :labels, only: [:index]
380

381
      resources :groups, only: [:index]
382
      resources :snippets, only: [:index]
383 384 385 386 387 388

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

390
      resources :projects, only: [:index] do
391 392 393 394
        collection do
          get :starred
        end
      end
Douwe Maan committed
395
    end
396 397

    root to: "dashboard/projects#index"
398
  end
gitlabhq committed
399

400 401 402
  #
  # Groups Area
  #
403
  resources :groups, constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }  do
404 405 406
    member do
      get :issues
      get :merge_requests
407
      get :projects
408
      get :activity
409
    end
410

Steven Thonus committed
411
    scope module: :groups do
412
      resources :group_members, only: [:index, :create, :update, :destroy] do
413
        post :resend_invite, on: :member
414
        delete :leave, on: :collection
415
      end
416

Steven Thonus committed
417
      resource :avatar, only: [:destroy]
418
      resources :milestones, constraints: { id: /[^\/]+/ }, only: [:index, :show, :update, :new, :create]
419
      resource :notification_setting, only: [:update]
Steven Thonus committed
420
    end
421 422
  end

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

425
  devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, registrations: :registrations , passwords: :passwords, sessions: :sessions, confirmations: :confirmations }
gitlabhq committed
426

427
  devise_scope :user do
428
    get '/users/auth/:provider/omniauth_error' => 'omniauth_callbacks#omniauth_error', as: :omniauth_error
Phil Hughes committed
429
    get '/users/almost_there' => 'confirmations#almost_there'
430
  end
Vinnie Okada committed
431

432
  root to: "root#index"
Vinnie Okada committed
433

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

Vinnie Okada committed
452 453 454 455 456 457 458 459 460
      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
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477
          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 }
          )
478 479 480 481 482 483 484 485 486 487
          put(
            '/blob/*id',
            to: 'blob#update',
            constraints: { id: /.+/, format: false }
          )
          post(
            '/blob/*id',
            to: 'blob#create',
            constraints: { id: /.+/, format: false }
          )
Vinnie Okada committed
488
        end
489

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

Vinnie Okada committed
499 500 501 502 503 504 505 506 507
        scope do
          get(
            '/tree/*id',
            to: 'tree#show',
            constraints: { id: /.+/, format: /(html|js)/ },
            as: :tree
          )
        end

508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525
        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
526 527
        scope do
          post(
528
            '/create_dir/*id',
Stan Hu committed
529 530 531 532 533 534
              to: 'tree#create_dir',
              constraints: { id: /.+/ },
              as: 'create_dir'
          )
        end

Vinnie Okada committed
535 536 537 538 539 540 541
        scope do
          get(
            '/blame/*id',
            to: 'blame#show',
            constraints: { id: /.+/, format: /(html|js)/ },
            as: :blame
          )
542
        end
Dmitriy Zaporozhets committed
543

544 545 546 547
        scope do
          get(
            '/commits/*id',
            to: 'commits#show',
548
            constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ },
549 550 551 552 553
            as: :commits
          )
        end

        resource  :avatar, only: [:show, :destroy]
554
        resources :commit, only: [:show], constraints: { id: /\h{7,40}/ } do
555 556
          member do
            get :branches
Kamil Trzcinski committed
557 558 559
            get :builds
            post :cancel_builds
            post :retry_builds
560
            post :revert
561
            post :cherry_pick
562
          end
563 564 565 566 567 568
        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
569 570
          member do
            get :commits
571
            get :ci
572
            get :languages
Vinnie Okada committed
573
          end
574
        end
575

Vinnie Okada committed
576 577
        get '/compare/:from...:to' => 'compare#show', :as => 'compare',
            :constraints => { from: /.+/, to: /.+/ }
578

Vinnie Okada committed
579 580 581 582
        resources :snippets, constraints: { id: /\d+/ } do
          member do
            get 'raw'
          end
583
        end
584

585
        WIKI_SLUG_ID = { id: /\S+/ } unless defined? WIKI_SLUG_ID
586

Stan Hu committed
587 588 589 590
        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'
591
          post '/wikis/markdown_preview', to:'wikis#markdown_preview'
Stan Hu committed
592 593 594 595 596 597 598 599
          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
600
        end
601

Vinnie Okada committed
602 603 604 605 606
        resource :repository, only: [:show, :create] do
          member do
            get 'archive', constraints: { format: Gitlab::Regex.archive_formats_regex }
          end
        end
miks committed
607

Vinnie Okada committed
608 609 610 611
        resources :services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do
          member do
            get :test
          end
612
        end
gitlabhq committed
613

614
        resources :deploy_keys, constraints: { id: /\d+/ }, only: [:index, :new, :create] do
Vinnie Okada committed
615 616 617 618
          member do
            put :enable
            put :disable
          end
619
        end
gitlabhq committed
620

621
        resources :forks, only: [:index, :new, :create]
Vinnie Okada committed
622
        resource :import, only: [:new, :create, :show]
623
        resource :notification_setting, only: [:update]
Vinnie Okada committed
624 625 626 627 628 629 630 631 632

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

          member do
            # tree viewer logs
            get 'logs_tree', constraints: { id: Gitlab::Regex.git_reference_regex }
633 634
            # Directories with leading dots erroneously get rejected if git
            # ref regex used in constraints. Regex verification now done in controller.
635
            get 'logs_tree/*path' => 'refs#logs_tree', as: :logs_file, constraints: {
636
              id: /.*/,
Vinnie Okada committed
637 638 639
              path: /.*/
            }
          end
640
        end
641

642
        resources :merge_requests, constraints: { id: /\d+/ } do
Vinnie Okada committed
643
          member do
644
            get :commits
Vinnie Okada committed
645
            get :diffs
646
            get :builds
647 648
            get :merge_check
            post :merge
649
            post :cancel_merge_when_build_succeeds
Vinnie Okada committed
650
            get :ci_status
Valery Sizov committed
651
            post :toggle_subscription
652
            post :remove_wip
Vinnie Okada committed
653 654 655 656 657 658 659
          end

          collection do
            get :branch_from
            get :branch_to
            get :update_branches
          end
660
        end
661

Vinnie Okada committed
662
        resources :branches, only: [:index, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex }
663 664
        resources :tags, only: [:index, :show, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex } do
          resource :release, only: [:edit, :update]
665 666
        end

Vinnie Okada committed
667
        resources :protected_branches, only: [:index, :create, :update, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex }
668
        resource :variables, only: [:show, :update]
669
        resources :triggers, only: [:index, :create, :destroy]
670

671
        resources :builds, only: [:index, :show], constraints: { id: /\d+/ } do
Kamil Trzcinski committed
672
          collection do
Kamil Trzcinski committed
673
            post :cancel_all
Kamil Trzcinski committed
674 675
          end

676 677
          member do
            get :status
678
            post :cancel
679
            post :retry
680
            post :erase
681
            get :raw
682
          end
683

684 685
          resource :artifacts, only: [] do
            get :download
686 687
            get :browse, path: 'browse(/*path)', format: false
            get :file, path: 'file/*path', format: false
688
          end
689
        end
690

Vinnie Okada committed
691 692 693 694
        resources :hooks, only: [:index, :create, :destroy], constraints: { id: /\d+/ } do
          member do
            get :test
          end
695
        end
696

697
        resources :milestones, constraints: { id: /\d+/ } do
Vinnie Okada committed
698 699 700 701
          member do
            put :sort_issues
            put :sort_merge_requests
          end
702
        end
703

Vinnie Okada committed
704 705 706 707
        resources :labels, constraints: { id: /\d+/ } do
          collection do
            post :generate
          end
708 709 710 711

          member do
            post :toggle_subscription
          end
712
        end
713

714
        resources :issues, constraints: { id: /\d+/ } do
Valery Sizov committed
715
          member do
Valery Sizov committed
716
            post :toggle_subscription
717 718
            get :referenced_merge_requests
            get :related_branches
719
            get :can_create_branch
Valery Sizov committed
720
          end
Vinnie Okada committed
721 722 723
          collection do
            post  :bulk_update
          end
724
        end
Robert Speicher committed
725

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

Vinnie Okada committed
730 731 732 733 734
            # Used for import team
            # from another project
            get :import
            post :apply_import
          end
735 736 737 738

          member do
            post :resend_invite
          end
739
        end
740

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

Vinnie Okada committed
743 744 745 746
        resources :notes, only: [:index, :create, :destroy, :update], constraints: { id: /\d+/ } do
          member do
            delete :delete_attachment
          end
Valery Sizov committed
747 748 749 750

          collection do
            post :award_toggle
          end
751
        end
752 753 754

        resources :uploads, only: [:create] do
          collection do
755
            get ":secret/:filename", action: :show, as: :show, constraints: { filename: /[^\/]+/ }
756
          end
757
        end
758

759 760 761 762 763
        resources :runners, only: [:index, :edit, :update, :destroy, :show] do
          member do
            get :resume
            get :pause
          end
764 765 766 767

          collection do
            post :toggle_shared_runners
          end
768
        end
769 770

        resources :runner_projects, only: [:create, :destroy]
771
        resources :badges, only: [:index] do
772
          collection do
773 774 775
            scope '*ref', constraints: { ref: Gitlab::Regex.git_reference_regex } do
              get :build, constraints: { format: /svg/ }
            end
776 777
          end
        end
778
      end
779
    end
gitlabhq committed
780
  end
781

782 783 784
  # Get all keys of user
  get ':username.keys' => 'profiles/keys#get_keys' , constraints: { username: /.*/ }

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