15003: Merge branch 'master' into 15003-preprocess-config
[arvados.git] / services / api / app / controllers / static_controller.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 class StaticController < ApplicationController
6   respond_to :json, :html
7
8   skip_before_action :find_object_by_uuid
9   skip_before_action :render_404_if_no_object
10   skip_before_action :require_auth_scope, only: [:home, :empty, :login_failure]
11
12   def home
13     respond_to do |f|
14       f.html do
15         if !Rails.configuration.Services.Workbench1.ExternalURL.to_s.empty?
16           redirect_to Rails.configuration.Services.Workbench1.ExternalURL.to_s
17         else
18           render_not_found "Oops, this is an API endpoint. You probably want to point your browser to an Arvados Workbench site instead."
19         end
20       end
21       f.json do
22         render_not_found "Path not found."
23       end
24     end
25   end
26
27   def empty
28     render plain: ""
29   end
30
31 end