2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-10-31 07:02:26 -05:00
|
|
|
class Admin::PluginsController < Admin::StaffController
|
2015-02-06 16:32:59 -06:00
|
|
|
def index
|
2023-12-17 19:42:55 -06:00
|
|
|
render_serialized(
|
2023-12-20 19:37:20 -06:00
|
|
|
Discourse.plugins_sorted_by_name(enabled_only: false),
|
2023-12-17 19:42:55 -06:00
|
|
|
AdminPluginSerializer,
|
|
|
|
root: "plugins",
|
|
|
|
)
|
2015-02-06 16:32:59 -06:00
|
|
|
end
|
2024-03-12 22:15:12 -05:00
|
|
|
|
|
|
|
def show
|
|
|
|
plugin = Discourse.plugins_by_name[params[:plugin_id]]
|
|
|
|
|
|
|
|
# An escape hatch in case a plugin is using an un-prefixed
|
|
|
|
# version of their plugin name for a route.
|
|
|
|
plugin = Discourse.plugins_by_name["discourse-#{params[:plugin_id]}"] if !plugin
|
|
|
|
|
2024-04-02 08:26:15 -05:00
|
|
|
raise Discourse::NotFound if !plugin&.visible?
|
2024-03-12 22:15:12 -05:00
|
|
|
|
|
|
|
render_serialized(plugin, AdminPluginSerializer, root: nil)
|
|
|
|
end
|
2015-02-06 16:32:59 -06:00
|
|
|
end
|