2024-07-30 13:41:28 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Admin::Config::SiteSettingsController < Admin::AdminController
|
|
|
|
ADMIN_CONFIG_AREA_ALLOWLISTED_HIDDEN_SETTINGS = %i[
|
|
|
|
extended_site_description
|
|
|
|
about_banner_image
|
|
|
|
community_owner
|
|
|
|
]
|
|
|
|
|
|
|
|
# This endpoint is intended to be used only for admin config areas,
|
|
|
|
# for a specific collection of site settings. The admin site settings
|
|
|
|
# UI itself uses the Admin::SiteSettingsController#index endpoint,
|
|
|
|
# which also supports a `category` and `plugin` filter.
|
|
|
|
def index
|
2024-10-29 06:40:31 +08:00
|
|
|
if params[:filter_names].blank? && SiteSetting.valid_areas.exclude?(params[:filter_area])
|
2024-09-03 07:25:45 +08:00
|
|
|
raise Discourse::InvalidParameters
|
|
|
|
end
|
2024-07-30 13:41:28 +08:00
|
|
|
|
|
|
|
render_json_dump(
|
|
|
|
site_settings:
|
|
|
|
SiteSetting.all_settings(
|
|
|
|
filter_names: params[:filter_names],
|
2024-09-03 07:25:45 +08:00
|
|
|
filter_area: params[:filter_area],
|
2024-07-30 13:41:28 +08:00
|
|
|
include_locale_setting: false,
|
|
|
|
include_hidden: true,
|
|
|
|
filter_allowed_hidden: ADMIN_CONFIG_AREA_ALLOWLISTED_HIDDEN_SETTINGS,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|