debian-mirror-gitlab/lib/api/appearance.rb

59 lines
2.7 KiB
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
module API
2021-01-03 14:25:43 +05:30
class Appearance < ::API::Base
2020-03-13 15:44:24 +05:30
before { authenticated_as_admin! }
2021-01-29 00:20:46 +05:30
feature_category :navigation
2022-07-23 23:45:48 +05:30
urgency :low
2021-01-29 00:20:46 +05:30
2020-03-13 15:44:24 +05:30
helpers do
def current_appearance
@current_appearance ||= (::Appearance.current || ::Appearance.new)
end
end
desc 'Get the current appearance' do
success Entities::Appearance
end
get "application/appearance" do
present current_appearance, with: Entities::Appearance
end
desc 'Modify appearance' do
success Entities::Appearance
2023-01-13 00:05:48 +05:30
consumes ['multipart/form-data']
2020-03-13 15:44:24 +05:30
end
params do
optional :title, type: String, desc: 'Instance title on the sign in / sign up page'
optional :description, type: String, desc: 'Markdown text shown on the sign in / sign up page'
2023-04-23 21:23:45 +05:30
optional :pwa_name, type: String, desc: 'Name of the Progressive Web App'
optional :pwa_short_name, type: String, desc: 'Optional, short name for Progressive Web App'
optional :pwa_description, type: String, desc: 'An explanation of what the Progressive Web App does'
2020-03-13 15:44:24 +05:30
# TODO: remove rubocop disable - https://gitlab.com/gitlab-org/gitlab/issues/14960
2023-04-23 21:23:45 +05:30
optional :logo, type: File, desc: 'Instance image used on the sign in / sign up page' # rubocop:todo Scalability/FileUploads
optional :pwa_icon, type: File, desc: 'Icon used for Progressive Web App' # rubocop:todo Scalability/FileUploads
optional :header_logo, type: File, desc: 'Instance image used for the main navigation bar' # rubocop:todo Scalability/FileUploads
optional :favicon, type: File, desc: 'Instance favicon in .ico/.png format' # rubocop:todo Scalability/FileUploads
2020-05-24 23:13:21 +05:30
optional :new_project_guidelines, type: String, desc: 'Markdown text shown on the new project page'
optional :profile_image_guidelines, type: String, desc: 'Markdown text shown on the profile page below Public Avatar'
2020-03-13 15:44:24 +05:30
optional :header_message, type: String, desc: 'Message within the system header bar'
optional :footer_message, type: String, desc: 'Message within the system footer bar'
optional :message_background_color, type: String, desc: 'Background color for the system header / footer bar'
optional :message_font_color, type: String, desc: 'Font color for the system header / footer bar'
optional :email_header_and_footer_enabled, type: Boolean, desc: 'Add header and footer to all outgoing emails if enabled'
end
put "application/appearance" do
attrs = declared_params(include_missing: false)
if current_appearance.update(attrs)
present current_appearance, with: Entities::Appearance
else
render_validation_error!(current_appearance)
end
end
end
end
2021-10-27 15:23:28 +05:30
API::Appearance.prepend_mod